inital commit
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
plugin/packer_compiled.lua
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
vim.bo.shiftwidth = 2
|
||||||
|
vim.bo.tabstop = 2
|
||||||
|
vim.bo.softtabstop = 2
|
||||||
|
vim.bo.textwidth = 120
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
vim.bo.shiftwidth = 2
|
||||||
|
vim.bo.tabstop = 2
|
||||||
|
vim.bo.softtabstop = 2
|
||||||
|
vim.bo.textwidth = 120
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
local api = vim.api
|
||||||
|
local g = vim.g
|
||||||
|
local opt = vim.opt
|
||||||
|
|
||||||
|
|
||||||
|
-- <Space> leader
|
||||||
|
api.nvim_set_keymap("", "<Space>", "<Nop>", {noremap = true, silent = true })
|
||||||
|
g.mapleader = " "
|
||||||
|
g.maplocalleader = " "
|
||||||
|
|
||||||
|
|
||||||
|
opt.termguicolors = true
|
||||||
|
opt.hlsearch = true
|
||||||
|
opt.number = true
|
||||||
|
opt.relativenumber = true
|
||||||
|
opt.mouse = "a"
|
||||||
|
opt.breakindent = true
|
||||||
|
opt.undofile = true
|
||||||
|
opt.ignorecase = true
|
||||||
|
opt.smartcase = true
|
||||||
|
opt.updatetime = 250
|
||||||
|
opt.signcolumn = "yes"
|
||||||
|
opt.clipboard = "unnamedplus"
|
||||||
|
|
||||||
|
vim.cmd [[
|
||||||
|
augroup YankHighlight
|
||||||
|
autocmd!
|
||||||
|
autocmd TextYankPost * silent! lua vim.highlight.on_yank()
|
||||||
|
augroup end
|
||||||
|
]]
|
||||||
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
function M.setup()
|
||||||
|
local npairs = require "nvim-autopairs"
|
||||||
|
npairs.setup {
|
||||||
|
check_ts = true,
|
||||||
|
}
|
||||||
|
npairs.add_rules(require "nvim-autopairs.rules.endwise-lua")
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
function M.setup()
|
||||||
|
local has_words_before = function()
|
||||||
|
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||||
|
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match "%s" == nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local cmp = require "cmp"
|
||||||
|
local lspkind = require "lspkind"
|
||||||
|
|
||||||
|
local cmp_autopairs = require "nvim-autopairs.completion.cmp"
|
||||||
|
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done { map_char = { tex = "" } })
|
||||||
|
|
||||||
|
cmp.setup {
|
||||||
|
completion = { completeopt = "menu,menuone,noinsert", keyword_length = 1,},
|
||||||
|
experimental = { native_menu = false, ghost_text = false },
|
||||||
|
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
require("luasnip").lsp_expand(args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
formatting = {
|
||||||
|
-- format = function(entry, vim_item)
|
||||||
|
-- vim_item.menu = ({
|
||||||
|
-- buffer = "[Buffer]",
|
||||||
|
-- nvim_lua = "[Lua]",
|
||||||
|
-- treesitter = "[Treesitter]",
|
||||||
|
-- })[entry.source.name]
|
||||||
|
-- return vim_item
|
||||||
|
-- end,
|
||||||
|
format = lspkind.cmp_format({
|
||||||
|
mode = "symbol",
|
||||||
|
maxwidth = 50,
|
||||||
|
ellipsis_char = "...",
|
||||||
|
before = function(entry, vim_item)
|
||||||
|
vim_item.menu = ({
|
||||||
|
buffer = "[Buffer]",
|
||||||
|
nvim_lua = "[Lua]",
|
||||||
|
treesitter = "[Treesitter]",
|
||||||
|
})[entry.source.name]
|
||||||
|
return vim_item
|
||||||
|
end
|
||||||
|
})
|
||||||
|
},
|
||||||
|
mapping = {
|
||||||
|
["<C-k>"] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }),
|
||||||
|
["<C-j>"] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }),
|
||||||
|
["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }),
|
||||||
|
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }),
|
||||||
|
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
|
||||||
|
["<C-e>"] = cmp.mapping { i = cmp.mapping.close(), c = cmp.mapping.close() },
|
||||||
|
["<S-CR>"] = cmp.mapping {
|
||||||
|
i = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace, select = false },
|
||||||
|
c = function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.confirm { behavior = cmp.ConfirmBehavior.Replace, select = false }
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
["<Tab>"] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_next_item()
|
||||||
|
elseif has_words_before() then
|
||||||
|
cmp.complete()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i", "s", "c" }),
|
||||||
|
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_prev_item()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
{"i", "s", "c" }),
|
||||||
|
},
|
||||||
|
|
||||||
|
sources = {
|
||||||
|
{ name = "nvim_lsp"},
|
||||||
|
{ name = "treesitter" },
|
||||||
|
{ name = "buffer" },
|
||||||
|
{ name = "nvim_lua" },
|
||||||
|
{ name = "path" },
|
||||||
|
{ name = "nvim_lsp_signature_help"},
|
||||||
|
},
|
||||||
|
--[[ documentation = {
|
||||||
|
border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" },
|
||||||
|
winhighlight = "NormalFloat:NormalFloat,FloatBorder:TelescopeBorder",
|
||||||
|
}, ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
cmp.setup.cmdline("/", {
|
||||||
|
sources = {
|
||||||
|
{ name = "buffer" },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
cmp.setup.cmdline(":", {
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = "path" },
|
||||||
|
}, {
|
||||||
|
{ name = "cmdline" },
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
function M.setup()
|
||||||
|
local g = vim.g
|
||||||
|
g.indent_blankline_char = "┊"
|
||||||
|
g.indent_blankline_filetype_exclude = {"help", "packer"}
|
||||||
|
g.indent_blankline_buftype_exclude = {"terminal", "nofile"}
|
||||||
|
g.indent_blankline_show_trailing_blankline_indent = false
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
function M.setup()
|
||||||
|
local lsp = {
|
||||||
|
float = {
|
||||||
|
focusable = true,
|
||||||
|
style = "minimal",
|
||||||
|
border = "rounded",
|
||||||
|
},
|
||||||
|
diagnostic = {
|
||||||
|
virtual_text = { spacing = 4, prefix = "●" },
|
||||||
|
underline = true,
|
||||||
|
update_in_insert = true,
|
||||||
|
severity_sort = true,
|
||||||
|
float = {
|
||||||
|
focusable = true,
|
||||||
|
style = "minimal",
|
||||||
|
border = "rounded",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
local diagnostic_signs = {
|
||||||
|
{ name = "DiagnosticSignError", text = "" },
|
||||||
|
{ name = "DiagnosticSignWarn", text = "" },
|
||||||
|
{ name = "DiagnosticSignHint", text = "" },
|
||||||
|
{ name = "DiagnosticSignInfo", text = "" },
|
||||||
|
}
|
||||||
|
for _, sign in ipairs(diagnostic_signs) do
|
||||||
|
vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = sign.name })
|
||||||
|
end
|
||||||
|
-- Diagnostic configuration
|
||||||
|
vim.diagnostic.config(lsp.diagnostic)
|
||||||
|
|
||||||
|
-- Hover configuration
|
||||||
|
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, lsp.float)
|
||||||
|
|
||||||
|
-- Signature help configuration
|
||||||
|
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, lsp.float)
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
local M = {}
|
||||||
|
local servers = {
|
||||||
|
rust_analyzer = {},
|
||||||
|
sumneko_lua = {},
|
||||||
|
gopls = {},
|
||||||
|
}
|
||||||
|
|
||||||
|
local function on_attach(client, bufnr)
|
||||||
|
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||||
|
vim.api.nvim_buf_set_option(0, "formatexpr", "v:lua.vim.lsp.formatexpr")
|
||||||
|
require("config.lsp.keymaps").setup(client, bufnr)
|
||||||
|
end
|
||||||
|
|
||||||
|
local lsp_signature = require "lsp_signature"
|
||||||
|
lsp_signature.setup {
|
||||||
|
bind = true,
|
||||||
|
handler_opts = {
|
||||||
|
border = "rounded",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||||
|
|
||||||
|
local opts = {
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities,
|
||||||
|
flags = {
|
||||||
|
debounce_text_changes = 150,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
require("config.lsp.handlers").setup()
|
||||||
|
|
||||||
|
function M.setup()
|
||||||
|
require("config.lsp.installer").setup(servers, opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
local lsp_installer_servers = require "nvim-lsp-installer.servers"
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
function M.setup(servers, options)
|
||||||
|
for server_name, _ in pairs(servers) do
|
||||||
|
local server_available, server = lsp_installer_servers.get_server(server_name)
|
||||||
|
|
||||||
|
if server_available then
|
||||||
|
server:on_ready(function()
|
||||||
|
local opts = vim.tbl_deep_extend("force", options, servers[server.name] or {})
|
||||||
|
server:setup(opts)
|
||||||
|
end)
|
||||||
|
|
||||||
|
if not server:is_installed() then
|
||||||
|
vim.notify("Installing " .. server.name, vim.log.levels.INFO)
|
||||||
|
server:install()
|
||||||
|
end
|
||||||
|
else
|
||||||
|
vim.notify(server, vim.log.levels.ERROR)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
local whichkey = require "which-key"
|
||||||
|
|
||||||
|
local keymap = vim.api.nvim_set_keymap
|
||||||
|
local buf_keymap = vim.api.nvim_buf_set_keymap
|
||||||
|
|
||||||
|
local function keymappings(client, bufnr)
|
||||||
|
local opts = { noremap = true, silent = true }
|
||||||
|
|
||||||
|
buf_keymap(bufnr, "n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
||||||
|
keymap("n", "[d", "<cmd>lua vim.diagnostic.goto_prev()<CR>", opts)
|
||||||
|
keymap("n", "]d", "<cmd>lua vim.diagnostic.goto_next()<CR>", opts)
|
||||||
|
keymap("n", "[e", "<cmd>lua vim.diagnostic.goto_prev({severity = vim.diagnostic.severity.ERROR})<CR>", opts)
|
||||||
|
keymap("n", "]e", "<cmd>lua vim.diagnostic.goto_next({severity = vim.diagnostic.severity.ERROR})<CR>", opts)
|
||||||
|
|
||||||
|
local keymap_l = {
|
||||||
|
name = "LSP Actions",
|
||||||
|
r = { "<cmd>lua vim.lsp.buf.rename()<CR>", "Rename" },
|
||||||
|
a = { "<cmd>lua vim.lsp.buf.code_action()<CR>", "Code Action" },
|
||||||
|
i = { "<cmd>lua vim.diagnostic.open_float()<CR>", "Line Diagnostics" },
|
||||||
|
d = { "<Cmd>lua vim.lsp.buf.definition()<CR>", "Definition" },
|
||||||
|
D = { "<Cmd>lua vim.lsp.buf.declaration()<CR>", "Declaration" },
|
||||||
|
s = { "<cmd>lua vim.lsp.buf.signature_help()<CR>", "Signature Help" },
|
||||||
|
I = { "<cmd>lua vim.lsp.buf.implementation()<CR>", "Goto Implementation" },
|
||||||
|
t = { "<cmd>lua vim.lsp.buf.type_definition()<CR>", "Goto Type Definition" },
|
||||||
|
f = { "<cmd>lua vim.lsp.buf.format()<CR>", "Format Buffer"},
|
||||||
|
}
|
||||||
|
|
||||||
|
whichkey.register(keymap_l, { buffer = bufnr, prefix = "<leader>c"})
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.setup(client, bufnr)
|
||||||
|
keymappings(client, bufnr)
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
local colors = {
|
||||||
|
bg = "#202328",
|
||||||
|
fg = "#bbc2cf",
|
||||||
|
yellow = "#ECBE7B",
|
||||||
|
cyan = "#008080",
|
||||||
|
darkblue = "#081633",
|
||||||
|
green = "#98be65",
|
||||||
|
orange = "#FF8800",
|
||||||
|
violet = "#a9a1e1",
|
||||||
|
magenta = "#c678dd",
|
||||||
|
blue = "#51afef",
|
||||||
|
red = "#ec5f67",
|
||||||
|
}
|
||||||
|
|
||||||
|
local function separator()
|
||||||
|
return "%="
|
||||||
|
end
|
||||||
|
|
||||||
|
local function lsp_client()
|
||||||
|
local buf_clients = vim.lsp.buf_get_clients()
|
||||||
|
if next(buf_clients) == nil then
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
local buf_client_names = {}
|
||||||
|
for _, client in pairs(buf_clients) do
|
||||||
|
if client.name ~= "null-ls" then
|
||||||
|
table.insert(buf_client_names, client.name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return "[" .. table.concat(buf_client_names, ", ") .. "]"
|
||||||
|
end
|
||||||
|
|
||||||
|
local function lsp_progress(_, is_active)
|
||||||
|
if not is_active then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local messages = vim.lsp.util.get_progress_messages()
|
||||||
|
if #messages == 0 then
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
local status = {}
|
||||||
|
for _, msg in pairs(messages) do
|
||||||
|
local title = ""
|
||||||
|
if msg.title then
|
||||||
|
title = msg.title
|
||||||
|
end
|
||||||
|
table.insert(status, (msg.percentage or 0) .. "%% " .. title)
|
||||||
|
end
|
||||||
|
local spinners = { "⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏" }
|
||||||
|
local ms = vim.loop.hrtime() / 1000000
|
||||||
|
local frame = math.floor(ms / 120) % #spinners
|
||||||
|
return table.concat(status, " ") .. " " .. spinners[frame + 1]
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.setup()
|
||||||
|
local gps = require "nvim-gps"
|
||||||
|
|
||||||
|
require("lualine").setup {
|
||||||
|
options = {
|
||||||
|
icons_enabled = true,
|
||||||
|
theme = "auto",
|
||||||
|
component_separators = { left = "", right = "" },
|
||||||
|
section_separators = { left = "", right = "" },
|
||||||
|
disabled_filetypes = {},
|
||||||
|
always_divide_middle = true,
|
||||||
|
},
|
||||||
|
sections = {
|
||||||
|
lualine_a = { "mode" },
|
||||||
|
lualine_b = { "branch", "diff", "diagnostics" },
|
||||||
|
lualine_c = {
|
||||||
|
{ "filename" },
|
||||||
|
{
|
||||||
|
gps.get_location,
|
||||||
|
cond = gps.is_available,
|
||||||
|
color = { fg = "#f3ca28" },
|
||||||
|
},
|
||||||
|
{ separator },
|
||||||
|
{ lsp_client, icon = " ", color = { fg = colors.violet, gui = "bold" } },
|
||||||
|
{ lsp_progress },
|
||||||
|
},
|
||||||
|
lualine_x = { "encoding", "fileformat", "filetype" },
|
||||||
|
lualine_y = { "progress" },
|
||||||
|
lualine_z = { "location" },
|
||||||
|
},
|
||||||
|
inactive_sections = {
|
||||||
|
lualine_a = {},
|
||||||
|
lualine_b = {},
|
||||||
|
lualine_c = { "filename" },
|
||||||
|
lualine_x = { "location" },
|
||||||
|
lualine_y = {},
|
||||||
|
lualine_z = {},
|
||||||
|
},
|
||||||
|
tabline = {},
|
||||||
|
extensions = {},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
function M.setup()
|
||||||
|
local luasnip = require "luasnip"
|
||||||
|
|
||||||
|
luasnip.config.set_config {
|
||||||
|
history = false,
|
||||||
|
updateevents = "TextChanged,TextChangedI",
|
||||||
|
}
|
||||||
|
|
||||||
|
require("luasnip/loaders/from_vscode").load()
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
function M.setup()
|
||||||
|
local actions = require "telescope.actions"
|
||||||
|
local telescope = require "telescope"
|
||||||
|
|
||||||
|
telescope.load_extension "fzf"
|
||||||
|
telescope.load_extension "project"
|
||||||
|
telescope.load_extension "repo"
|
||||||
|
telescope.load_extension "file_browser"
|
||||||
|
telescope.load_extension "projects"
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
function M.setup()
|
||||||
|
require("nvim-treesitter.configs").setup {
|
||||||
|
ensure_installed = "all",
|
||||||
|
sync_install = false,
|
||||||
|
highlight = {
|
||||||
|
-- enable = true,
|
||||||
|
},
|
||||||
|
|
||||||
|
incremental_selection = {
|
||||||
|
enable = true,
|
||||||
|
keymaps = {
|
||||||
|
init_selection = "gnn",
|
||||||
|
node_incremental = "grn",
|
||||||
|
scope_incremental = "grc",
|
||||||
|
node_decremental = "grm",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
indent = { enable = true },
|
||||||
|
|
||||||
|
textobjects = {
|
||||||
|
select = {
|
||||||
|
enable = true,
|
||||||
|
|
||||||
|
lookahead = true,
|
||||||
|
|
||||||
|
keymaps = {
|
||||||
|
["af"] = "@function.outer",
|
||||||
|
["if"] = "@function.inner",
|
||||||
|
["ac"] = "@class.outer",
|
||||||
|
["ic"] = "@class.inner",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
swap = {
|
||||||
|
enable = true,
|
||||||
|
swap_next = {
|
||||||
|
["<leader>rx"] = "@parameter.inner",
|
||||||
|
},
|
||||||
|
swap_previous = {
|
||||||
|
["<leader>rX"] = "@parameter.inner",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
move = {
|
||||||
|
enable = true,
|
||||||
|
set_jumps = true,
|
||||||
|
goto_next_start = {
|
||||||
|
["]m"] = "@function.outer",
|
||||||
|
["]]"] = "@class.outer",
|
||||||
|
},
|
||||||
|
goto_next_end = {
|
||||||
|
["]M"] = "@function.outer",
|
||||||
|
["]["] = "@class.outer",
|
||||||
|
},
|
||||||
|
goto_previous_start = {
|
||||||
|
["[m"] = "@function.outer",
|
||||||
|
["[["] = "@class.outer",
|
||||||
|
},
|
||||||
|
goto_previous_end = {
|
||||||
|
["[M"] = "@function.outer",
|
||||||
|
["[]"] = "@class.outer",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
lsp_interop = {
|
||||||
|
enable = true,
|
||||||
|
border = "none",
|
||||||
|
peek_definition_code = {
|
||||||
|
["<leader>df"] = "@function.outer",
|
||||||
|
["<leader>dF"] = "@class.outer",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
function M.setup()
|
||||||
|
local whichkey = require "which-key"
|
||||||
|
|
||||||
|
local conf = {
|
||||||
|
window = {
|
||||||
|
border = "single",
|
||||||
|
position = "bottom",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
local opts = {
|
||||||
|
mode = "n",
|
||||||
|
prefix = "<leader>",
|
||||||
|
buffer = nil,
|
||||||
|
silent = true,
|
||||||
|
noremap = true,
|
||||||
|
nowait = false,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
local keymaps_fzf = {
|
||||||
|
name = "Find",
|
||||||
|
f = { "<cmd>lua require('utils.finder').find_files()<cr>", "Files" },
|
||||||
|
b = { "<cmd>Telescope buffers<cr>", "Buffers"},
|
||||||
|
o = { "<cmd>Telescope oldfiles<cr>", "Old Lives"},
|
||||||
|
g = { "<cmd>Telescope live_grep<cr>", "Live Grep"},
|
||||||
|
c = { "<cmd>Telescope commands<cr>", "Commands"},
|
||||||
|
r = { "<cmd>Telescope file_browser<cr>", "File Browser" },
|
||||||
|
w = { "<cmd>Telescope current_buffer<cr>", "Current Buffer"},
|
||||||
|
d = { "<cmd>Telescope diagnostics<cr>", "LSP Diagnostics"},
|
||||||
|
s = { "<cmd>Telescope lsp_workspace_symbols<cr>", "LSP Symbols"},
|
||||||
|
R = { "<cmd>Telescope lsp_references<cr>", "LSP References"},
|
||||||
|
}
|
||||||
|
|
||||||
|
local keymaps_project = {
|
||||||
|
name = "Project",
|
||||||
|
p = { "<cmd>lua require'telescope'.extensions.project.project{}<cr>", "List" },
|
||||||
|
s = { "<cmd>Telescope repo list<cr>", "Search" },
|
||||||
|
}
|
||||||
|
|
||||||
|
local mappings = {
|
||||||
|
["w"] = { "<cmd>update!<CR>", "Save" },
|
||||||
|
["j"] = { "<cmd>HopWord<cr>", "Hop" },
|
||||||
|
b = {
|
||||||
|
name = "Buffer",
|
||||||
|
q = {"<Cmd>bd<Cr>", "Close Buffer"},
|
||||||
|
},
|
||||||
|
f = keymaps_fzf,
|
||||||
|
p = keymaps_project,
|
||||||
|
}
|
||||||
|
whichkey.setup(conf)
|
||||||
|
whichkey.register(mappings, opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
+227
@@ -0,0 +1,227 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
function M.setup()
|
||||||
|
local packer_bootstrap = false
|
||||||
|
|
||||||
|
local conf = {
|
||||||
|
profile = {
|
||||||
|
enable = true,
|
||||||
|
threshold = 0,
|
||||||
|
},
|
||||||
|
display = {
|
||||||
|
open_fn = function()
|
||||||
|
return require("packer.util").float { border = "rounded" }
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
local function packer_init()
|
||||||
|
local fn = vim.fn
|
||||||
|
local install_path = fn.stdpath "data" .. "/site/pack/packer/start/packer.nvim"
|
||||||
|
if fn.empty(fn.glob(install_path)) > 0 then
|
||||||
|
packer_bootstrap = fn.system {
|
||||||
|
"git",
|
||||||
|
"clone",
|
||||||
|
"--depth",
|
||||||
|
"1",
|
||||||
|
"https://github.com/wbthomason/packer.nvim.git",
|
||||||
|
install_path,
|
||||||
|
}
|
||||||
|
vim.cmd [[packadd packer.nvim]]
|
||||||
|
end
|
||||||
|
vim.cmd "autocmd BufWritePost plugins.lua source <afile> | PackerCompile"
|
||||||
|
end
|
||||||
|
|
||||||
|
local function plugins(use)
|
||||||
|
use { "wbthomason/packer.nvim" }
|
||||||
|
|
||||||
|
use {
|
||||||
|
"sainnhe/edge",
|
||||||
|
config = function()
|
||||||
|
vim.cmd "colorscheme edge"
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
use {
|
||||||
|
"folke/which-key.nvim",
|
||||||
|
config = function()
|
||||||
|
require("config.whichkey").setup()
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
use {
|
||||||
|
"lukas-reineke/indent-blankline.nvim",
|
||||||
|
event = "BufReadPre",
|
||||||
|
config = function()
|
||||||
|
require("config.indentblankline").setup()
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
use {
|
||||||
|
"kyazdani42/nvim-web-devicons",
|
||||||
|
module = "nvim-web-devicons",
|
||||||
|
config = function()
|
||||||
|
require("nvim-web-devicons").setup { default = true }
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
use {
|
||||||
|
'numToStr/Comment.nvim',
|
||||||
|
config = function()
|
||||||
|
require('Comment').setup()
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
use { "chaoren/vim-wordmotion" }
|
||||||
|
|
||||||
|
-- Easy hopping
|
||||||
|
use {
|
||||||
|
"phaazon/hop.nvim",
|
||||||
|
cmd = { "HopWord", "HopChar1" },
|
||||||
|
config = function()
|
||||||
|
require("hop").setup {}
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
use {
|
||||||
|
"nvim-lualine/lualine.nvim",
|
||||||
|
after = "nvim-treesitter",
|
||||||
|
config = function()
|
||||||
|
require("config.lualine").setup()
|
||||||
|
end,
|
||||||
|
requires = { "nvim-web-devicons" },
|
||||||
|
}
|
||||||
|
|
||||||
|
use {
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
run = ":TSUpdate",
|
||||||
|
config = function()
|
||||||
|
require("config.treesitter").setup()
|
||||||
|
end,
|
||||||
|
requires = {
|
||||||
|
{ "nvim-treesitter/nvim-treesitter-textobjects" },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
use {
|
||||||
|
"SmiteshP/nvim-gps",
|
||||||
|
requires = "nvim-treesitter/nvim-treesitter",
|
||||||
|
module = "nvim-gps",
|
||||||
|
config = function()
|
||||||
|
require("nvim-gps").setup()
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
use {
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
config = function()
|
||||||
|
require("config.cmp").setup()
|
||||||
|
end,
|
||||||
|
wants = { "LuaSnip", "lspkind.nvim" },
|
||||||
|
requires = {
|
||||||
|
"hrsh7th/cmp-buffer",
|
||||||
|
"hrsh7th/cmp-path",
|
||||||
|
"hrsh7th/cmp-nvim-lua",
|
||||||
|
"ray-x/cmp-treesitter",
|
||||||
|
"hrsh7th/cmp-cmdline",
|
||||||
|
"saadparwaiz1/cmp_luasnip",
|
||||||
|
"hrsh7th/cmp-calc",
|
||||||
|
"f3fora/cmp-spell",
|
||||||
|
"hrsh7th/cmp-emoji",
|
||||||
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
|
"saadparwaiz1/cmp_luasnip",
|
||||||
|
"hrsh7th/cmp-nvim-lsp-signature-help",
|
||||||
|
{
|
||||||
|
"onsails/lspkind.nvim",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"L3MON4D3/LuaSnip",
|
||||||
|
wants = "friendly-snippets",
|
||||||
|
config = function()
|
||||||
|
require("config.luasnip").setup()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
disable = false,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
use {
|
||||||
|
"windwp/nvim-autopairs",
|
||||||
|
wants = "nvim-treesitter",
|
||||||
|
module = { "nvim-autopairs.completion.cmp", "nvim-autopairs" },
|
||||||
|
config = function()
|
||||||
|
require("config.autopairs").setup()
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
use {
|
||||||
|
"windwp/nvim-ts-autotag",
|
||||||
|
wants = "nvim-treesitter",
|
||||||
|
event = "InsertEnter",
|
||||||
|
config = function()
|
||||||
|
require("nvim-ts-autotag").setup { enable = true }
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
use {
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opt = true,
|
||||||
|
event = "BufReadPre",
|
||||||
|
wants = { "nvim-lsp-installer", "cmp-nvim-lsp", "lsp_signature.nvim" },
|
||||||
|
config = function()
|
||||||
|
require("config.lsp").setup()
|
||||||
|
end,
|
||||||
|
requires = {
|
||||||
|
"williamboman/nvim-lsp-installer",
|
||||||
|
"ray-x/lsp_signature.nvim"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
use {
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
opt = true,
|
||||||
|
config = function()
|
||||||
|
require("config.telescope").setup()
|
||||||
|
end,
|
||||||
|
cmd = { "Telescope" },
|
||||||
|
module = "telescope",
|
||||||
|
keys = { "<leader>f", "<leader>p" },
|
||||||
|
wants = {
|
||||||
|
"plenary.nvim",
|
||||||
|
"popup.nvim",
|
||||||
|
"telescope-fzf-native.nvim",
|
||||||
|
"telescope-project.nvim",
|
||||||
|
"telescope-repo.nvim",
|
||||||
|
"telescope-file-browser.nvim",
|
||||||
|
"project.nvim",
|
||||||
|
},
|
||||||
|
requires = {
|
||||||
|
"nvim-lua/popup.nvim",
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
{ "nvim-telescope/telescope-fzf-native.nvim", run = "make" },
|
||||||
|
"nvim-telescope/telescope-project.nvim",
|
||||||
|
"cljoly/telescope-repo.nvim",
|
||||||
|
"nvim-telescope/telescope-file-browser.nvim",
|
||||||
|
{
|
||||||
|
"ahmedkhalf/project.nvim",
|
||||||
|
config = function()
|
||||||
|
require("project_nvim").setup {}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
if packer_bootstrap then
|
||||||
|
print "Plugin Bootstrap - Restart Neovim required after installation!"
|
||||||
|
require("packer").sync()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
packer_init()
|
||||||
|
|
||||||
|
local packer = require "packer"
|
||||||
|
packer.init(conf)
|
||||||
|
packer.startup(plugins)
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
function M.find_files()
|
||||||
|
local opts = {}
|
||||||
|
local telescope = require "telescope.builtin"
|
||||||
|
telescope.find_files(opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
packer_compiled.nvim
|
||||||
Reference in New Issue
Block a user