Refactor packer config to use packer config parameter instead of
separate requiresmain
parent
989ab0c42a
commit
b985e8a28a
@ -1 +0,0 @@
|
||||
require('bufferline').setup{}
|
@ -0,0 +1,68 @@
|
||||
return function()
|
||||
-- Setup git completion source
|
||||
require("cmp_git").setup()
|
||||
|
||||
-- Set completeopt to have a better completion experience
|
||||
vim.o.completeopt = 'menuone,noselect'
|
||||
|
||||
-- luasnip setup
|
||||
local luasnip = require 'luasnip'
|
||||
|
||||
-- nvim-cmp setup
|
||||
local cmp = require 'cmp'
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||
['<C-n>'] = cmp.mapping.select_next_item(),
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.close(),
|
||||
['<CR>'] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
},
|
||||
['<Tab>'] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
['<S-Tab>'] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
},
|
||||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'path' },
|
||||
{ name = 'git' },
|
||||
{ name = 'buffer' },
|
||||
},
|
||||
}
|
||||
|
||||
-- Enable autopairs when enter is processed
|
||||
-- on completion
|
||||
local cmp_autopairs = require 'nvim-autopairs.completion.cmp'
|
||||
cmp.event:on(
|
||||
'confirm_done',
|
||||
cmp_autopairs.on_confirm_done()
|
||||
)
|
||||
|
||||
-- load friendly-snippets to luasnip
|
||||
require('luasnip/loaders/from_vscode').lazy_load()
|
||||
end
|
@ -1,49 +1,51 @@
|
||||
require('catppuccin').setup({
|
||||
transparent_background = false,
|
||||
term_colors = false,
|
||||
compile = {enabled = true, path = vim.fn.stdpath 'cache' .. '/catppuccin'},
|
||||
styles = {
|
||||
comments = {'italic'},
|
||||
functions = {'italic'},
|
||||
keywords = {'italic'},
|
||||
strings = {},
|
||||
variables = {}
|
||||
},
|
||||
integrations = {
|
||||
treesitter = true,
|
||||
native_lsp = {
|
||||
enabled = true,
|
||||
virtual_text = {
|
||||
errors = {'italic'},
|
||||
hints = {'italic'},
|
||||
warnings = {'italic'},
|
||||
information = {'italic'}
|
||||
},
|
||||
underlines = {
|
||||
errors = {'underline'},
|
||||
hints = {'underline'},
|
||||
warnings = {'underline'},
|
||||
information = {'underline'}
|
||||
}
|
||||
},
|
||||
lsp_trouble = false,
|
||||
lsp_saga = false,
|
||||
gitgutter = true,
|
||||
gitsigns = false,
|
||||
telescope = true,
|
||||
nvimtree = {enabled = false, show_root = false},
|
||||
which_key = false,
|
||||
indent_blankline = {enabled = true, colored_indent_levels = false},
|
||||
dashboard = false,
|
||||
neogit = false,
|
||||
vim_sneak = false,
|
||||
fern = false,
|
||||
barbar = false,
|
||||
bufferline = false,
|
||||
markdown = false,
|
||||
lightspeed = false,
|
||||
ts_rainbow = false,
|
||||
hop = false
|
||||
}
|
||||
})
|
||||
vim.cmd [[colorscheme catppuccin]]
|
||||
return function ()
|
||||
require('catppuccin').setup({
|
||||
transparent_background = false,
|
||||
term_colors = false,
|
||||
compile = {enabled = true, path = vim.fn.stdpath 'cache' .. '/catppuccin'},
|
||||
styles = {
|
||||
comments = {'italic'},
|
||||
functions = {'italic'},
|
||||
keywords = {'italic'},
|
||||
strings = {},
|
||||
variables = {}
|
||||
},
|
||||
integrations = {
|
||||
treesitter = true,
|
||||
native_lsp = {
|
||||
enabled = true,
|
||||
virtual_text = {
|
||||
errors = {'italic'},
|
||||
hints = {'italic'},
|
||||
warnings = {'italic'},
|
||||
information = {'italic'}
|
||||
},
|
||||
underlines = {
|
||||
errors = {'underline'},
|
||||
hints = {'underline'},
|
||||
warnings = {'underline'},
|
||||
information = {'underline'}
|
||||
}
|
||||
},
|
||||
lsp_trouble = false,
|
||||
lsp_saga = false,
|
||||
gitgutter = true,
|
||||
gitsigns = false,
|
||||
telescope = true,
|
||||
nvimtree = {enabled = false, show_root = false},
|
||||
which_key = false,
|
||||
indent_blankline = {enabled = true, colored_indent_levels = false},
|
||||
dashboard = false,
|
||||
neogit = false,
|
||||
vim_sneak = false,
|
||||
fern = false,
|
||||
barbar = false,
|
||||
bufferline = false,
|
||||
markdown = false,
|
||||
lightspeed = false,
|
||||
ts_rainbow = false,
|
||||
hop = false
|
||||
}
|
||||
})
|
||||
vim.cmd [[colorscheme catppuccin]]
|
||||
end
|
||||
|
@ -1,67 +0,0 @@
|
||||
-- Add additional capabilities supported by nvim-cmp
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
|
||||
--
|
||||
-- Set completeopt to have a better completion experience
|
||||
vim.o.completeopt = 'menuone,noselect'
|
||||
|
||||
-- luasnip setup
|
||||
local luasnip = require 'luasnip'
|
||||
|
||||
-- nvim-cmp setup
|
||||
local cmp = require 'cmp'
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||
['<C-n>'] = cmp.mapping.select_next_item(),
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.close(),
|
||||
['<CR>'] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
},
|
||||
['<Tab>'] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
['<S-Tab>'] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
},
|
||||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'path' },
|
||||
{ name = 'git' },
|
||||
{ name = 'buffer' },
|
||||
},
|
||||
}
|
||||
|
||||
-- Enable autopairs when enter is processed
|
||||
-- on completion
|
||||
local cmp_autopairs = require 'nvim-autopairs.completion.cmp'
|
||||
cmp.event:on(
|
||||
'confirm_done',
|
||||
cmp_autopairs.on_confirm_done()
|
||||
)
|
||||
|
||||
-- load friendly-snippets to luasnip
|
||||
require('luasnip/loaders/from_vscode').lazy_load()
|
@ -1,7 +1,8 @@
|
||||
vim.opt.list = true
|
||||
|
||||
require('indent_blankline').setup {
|
||||
space_char_blankline = ' ',
|
||||
show_current_context = true,
|
||||
show_current_context_start = true,
|
||||
}
|
||||
return function ()
|
||||
vim.opt.list = true
|
||||
require('indent_blankline').setup {
|
||||
space_char_blankline = ' ',
|
||||
show_current_context = true,
|
||||
show_current_context_start = true,
|
||||
}
|
||||
end
|
||||
|
@ -1,89 +0,0 @@
|
||||
local M = {}
|
||||
local lspconfig = require('lspconfig');
|
||||
--
|
||||
|
||||
M.lsp_map_keys = function(server, bufnr)
|
||||
local function map_key(...)
|
||||
-- Map to buffer if buffer number is supplied,
|
||||
-- globally otherwise
|
||||
if bufnr == nil then
|
||||
vim.api.nvim_set_keymap(...)
|
||||
else
|
||||
vim.api.nvim_buf_set_keymap(bufnr, ...)
|
||||
end
|
||||
end
|
||||
|
||||
local keymapOpts = {noremap = true, silent = true}
|
||||
map_key('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', keymapOpts)
|
||||
map_key('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', keymapOpts)
|
||||
map_key('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', keymapOpts)
|
||||
map_key('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', keymapOpts)
|
||||
map_key('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>',
|
||||
keymapOpts)
|
||||
map_key('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>',
|
||||
keymapOpts)
|
||||
map_key('n', '<space>wr',
|
||||
'<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', keymapOpts)
|
||||
map_key('n', '<space>wl',
|
||||
'<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>',
|
||||
keymapOpts)
|
||||
map_key('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>',
|
||||
keymapOpts)
|
||||
map_key('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', keymapOpts)
|
||||
map_key('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>',
|
||||
keymapOpts)
|
||||
map_key('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', keymapOpts)
|
||||
map_key('n', '<space>e',
|
||||
'<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>',
|
||||
keymapOpts)
|
||||
map_key('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', keymapOpts)
|
||||
map_key('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', keymapOpts)
|
||||
map_key('n', '<space>q', '<cmd>lua vim.diagnostic.set_loclist()<CR>',
|
||||
keymapOpts)
|
||||
map_key('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', keymapOpts)
|
||||
end
|
||||
|
||||
-- Add additional capabilities supported by nvim-cmp
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
|
||||
|
||||
-- Setup LSP signature plugin
|
||||
require('lsp_signature').setup()
|
||||
|
||||
-- Setup mason
|
||||
require("mason").setup()
|
||||
require("mason-lspconfig").setup({automatic_installation = true})
|
||||
|
||||
-- LSP servers setup
|
||||
lspconfig.tsserver.setup {{}, on_attach = M.lsp_map_keys}
|
||||
lspconfig.yamlls.setup {{}, on_attach = M.lsp_map_keys}
|
||||
lspconfig.jsonls.setup {{}, on_attach = M.lsp_map_keys}
|
||||
lspconfig.html.setup {{}, on_attach = M.lsp_map_keys}
|
||||
lspconfig.marksman.setup {{}, on_attach = M.lsp_map_keys}
|
||||
|
||||
lspconfig.sumneko_lua.setup {
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||
version = 'LuaJIT',
|
||||
-- Setup your lua path
|
||||
path = vim.split(package.path, ';')
|
||||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = {'vim'}
|
||||
},
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = vim.api.nvim_get_runtime_file('', true)
|
||||
},
|
||||
-- Do not send telemetry data containing a randomized but unique identifier
|
||||
telemetry = {enable = false}
|
||||
}
|
||||
},
|
||||
on_attach = M.lsp_map_keys,
|
||||
capabilities = capabilities
|
||||
}
|
||||
|
||||
return M
|
@ -0,0 +1,103 @@
|
||||
local M = {}
|
||||
|
||||
function lsp_map_keys(server, bufnr)
|
||||
print('lsp_map_keys')
|
||||
local function map_key(...)
|
||||
-- Map to buffer if buffer number is supplied,
|
||||
-- globally otherwise
|
||||
if bufnr == nil then
|
||||
vim.api.nvim_set_keymap(...)
|
||||
else
|
||||
vim.api.nvim_buf_set_keymap(bufnr, ...)
|
||||
end
|
||||
end
|
||||
|
||||
local keymapOpts = { noremap = true, silent = true }
|
||||
map_key('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', keymapOpts)
|
||||
map_key('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', keymapOpts)
|
||||
map_key('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', keymapOpts)
|
||||
map_key('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', keymapOpts)
|
||||
map_key('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>',
|
||||
keymapOpts)
|
||||
map_key('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>',
|
||||
keymapOpts)
|
||||
map_key('n', '<space>wr',
|
||||
'<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', keymapOpts)
|
||||
map_key('n', '<space>wl',
|
||||
'<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>',
|
||||
keymapOpts)
|
||||
map_key('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>',
|
||||
keymapOpts)
|
||||
map_key('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', keymapOpts)
|
||||
map_key('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>',
|
||||
keymapOpts)
|
||||
map_key('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', keymapOpts)
|
||||
map_key('n', '<space>e',
|
||||
'<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>',
|
||||
keymapOpts)
|
||||
map_key('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', keymapOpts)
|
||||
map_key('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', keymapOpts)
|
||||
map_key('n', '<space>q', '<cmd>lua vim.diagnostic.set_loclist()<CR>',
|
||||
keymapOpts)
|
||||
map_key('n', '<space>f', '<cmd>lua vim.lsp.buf.format()<CR>', keymapOpts)
|
||||
end
|
||||
|
||||
M.on_attach = function(server, bufnr)
|
||||
print('on_attach')
|
||||
-- Setup lsp signature plugin
|
||||
require('lsp_signature').setup {}
|
||||
|
||||
-- Setup keybinds
|
||||
lsp_map_keys(server, bufnr)
|
||||
end
|
||||
|
||||
|
||||
function M.setup()
|
||||
local lspconfig = require('lspconfig')
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
|
||||
-- Common settings for all servers
|
||||
local lsp_defaults = {
|
||||
on_attach = M.on_attach, -- Common on_attach
|
||||
capabilities = capabilities -- Add additional capabilities supported by nvim-cmp
|
||||
}
|
||||
|
||||
-- Set default config for all servers
|
||||
--lspconfig.util.default_config = vim.tbl_deep_extend('force', lspconfig.util.default_config, lsp_defaults)
|
||||
|
||||
-- Register capabilities to cmp.nvim
|
||||
--require('cmp_nvim_lsp').update_capabilities(capabilities)
|
||||
|
||||
-- LSP servers setup
|
||||
--lspconfig.tsserver.setup {}
|
||||
--lspconfig.yamlls.setup {}
|
||||
--lspconfig.jsonls.setup {}
|
||||
--lspconfig.html.setup {}
|
||||
--lspconfig.marksman.setup {}
|
||||
|
||||
--lspconfig.sumneko_lua.setup {
|
||||
-- settings = {
|
||||
-- Lua = {
|
||||
-- runtime = {
|
||||
-- -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||
-- version = 'LuaJIT',
|
||||
-- -- Setup your lua path
|
||||
-- path = vim.split(package.path, ';')
|
||||
-- },
|
||||
-- diagnostics = {
|
||||
-- -- Get the language server to recognize the `vim` global
|
||||
-- globals = { 'vim' }
|
||||
-- },
|
||||
-- workspace = {
|
||||
-- -- Make the server aware of Neovim runtime files
|
||||
-- library = vim.api.nvim_get_runtime_file('', true)
|
||||
-- },
|
||||
-- -- Do not send telemetry data containing a randomized but unique identifier
|
||||
-- telemetry = { enable = false }
|
||||
-- }
|
||||
-- }
|
||||
--}
|
||||
end
|
||||
|
||||
return M
|
@ -1 +0,0 @@
|
||||
require'nvim-tree'.setup {}
|
@ -1,4 +1,6 @@
|
||||
local telescope = require('telescope')
|
||||
telescope.setup {}
|
||||
telescope.load_extension('fzf')
|
||||
telescope.load_extension('ui-select')
|
||||
return function ()
|
||||
local telescope = require('telescope')
|
||||
telescope.setup {}
|
||||
telescope.load_extension('fzf')
|
||||
telescope.load_extension('ui-select')
|
||||
end
|
||||
|
@ -1,14 +1,16 @@
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
ensure_installed = {
|
||||
'bash', 'c', 'css', 'dockerfile', 'html', 'http', 'java', 'json',
|
||||
'json5', 'latex', 'lua', 'make', 'markdown', 'php', 'python', 'regex',
|
||||
'rst', 'scss', 'toml', 'tsx', 'typescript', 'javascript', 'yaml'
|
||||
},
|
||||
highlight = {enable = true},
|
||||
indent = {enable = true},
|
||||
incremental_selection = {enable = true},
|
||||
context_commentstring = {enable = true}
|
||||
}
|
||||
return function ()
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
ensure_installed = {
|
||||
'bash', 'c', 'css', 'dockerfile', 'html', 'http', 'java', 'json',
|
||||
'json5', 'latex', 'lua', 'make', 'markdown', 'php', 'python', 'regex',
|
||||
'rst', 'scss', 'toml', 'tsx', 'typescript', 'javascript', 'yaml'
|
||||
},
|
||||
highlight = {enable = true},
|
||||
indent = {enable = true},
|
||||
incremental_selection = {enable = true},
|
||||
context_commentstring = {enable = true}
|
||||
}
|
||||
|
||||
--vim.wo.foldmethod = 'expr'
|
||||
--im.wo.foldexpr = 'nvim_treesitter#foldexpr()'
|
||||
--vim.wo.foldmethod = 'expr'
|
||||
--im.wo.foldexpr = 'nvim_treesitter#foldexpr()'
|
||||
end
|
||||
|
Loading…
Reference in New Issue