vim: refactor configuration of plugins
This commit is contained in:
parent
9a6d090015
commit
1954162b2b
7 changed files with 437 additions and 445 deletions
|
@ -1,12 +1,10 @@
|
|||
return {
|
||||
'lukas-reineke/indent-blankline.nvim',
|
||||
|
||||
opts = {
|
||||
config = function()
|
||||
require('indent_blankline').setup {
|
||||
enabled = false,
|
||||
},
|
||||
|
||||
config = function(_, opts)
|
||||
require('indent_blankline').setup(opts)
|
||||
}
|
||||
|
||||
-- show/hide indent guides
|
||||
vim.keymap.set('n', '<leader>si', '<cmd>IndentBlanklineToggle<cr>')
|
||||
|
|
|
@ -29,11 +29,7 @@ local on_attach = function(client, bufnr)
|
|||
if filetype_attach then filetype_attach(client, bufnr) end
|
||||
end
|
||||
|
||||
|
||||
return {
|
||||
'neovim/nvim-lspconfig',
|
||||
|
||||
config = function()
|
||||
local config = function()
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
local has_cmp, cmp = pcall(require, 'cmp_nvim_lsp')
|
||||
if has_cmp then
|
||||
|
@ -48,6 +44,10 @@ return {
|
|||
})
|
||||
lsp[server].setup(opts)
|
||||
end
|
||||
end,
|
||||
end
|
||||
|
||||
return {
|
||||
'neovim/nvim-lspconfig',
|
||||
config = config,
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
return {
|
||||
'nvim-lualine/lualine.nvim',
|
||||
|
||||
config = function()
|
||||
local config = function()
|
||||
local MODE_MAP = {
|
||||
['n'] = 'Normal ',
|
||||
['no'] = 'O-Pend ',
|
||||
|
@ -176,6 +173,10 @@ return {
|
|||
'nvim-tree',
|
||||
}
|
||||
}
|
||||
end,
|
||||
end
|
||||
|
||||
return {
|
||||
'nvim-lualine/lualine.nvim',
|
||||
config = config,
|
||||
}
|
||||
|
||||
|
|
|
@ -1,26 +1,22 @@
|
|||
local on_attach = function(bufnr)
|
||||
local config = function()
|
||||
require('nvim-tree').setup {
|
||||
disable_netrw = true, -- replace netrw with nvim-tree
|
||||
hijack_cursor = true, -- keep the cursor on begin of the filename
|
||||
sync_root_with_cwd = true, -- watch for `DirChanged` and refresh the tree
|
||||
|
||||
on_attach = function(bufnr)
|
||||
local api = require('nvim-tree.api')
|
||||
api.config.mappings.default_on_attach(bufnr)
|
||||
|
||||
local opts = function(desc)
|
||||
return { desc = 'nvim-tree: ' .. desc, buffer = bufnr, silent = true }
|
||||
end
|
||||
|
||||
api.config.mappings.default_on_attach(bufnr)
|
||||
|
||||
vim.keymap.set('n', 'l', api.node.open.edit, opts('open'))
|
||||
vim.keymap.set('n', '<CR>', api.node.open.edit, opts('open'))
|
||||
vim.keymap.set('n', 'o', api.node.open.edit, opts('open'))
|
||||
vim.keymap.set('n', 'h', api.node.navigate.parent_close, opts('close directory'))
|
||||
end
|
||||
|
||||
|
||||
return {
|
||||
'kyazdani42/nvim-tree.lua',
|
||||
|
||||
opts = {
|
||||
disable_netrw = true, -- replace netrw with nvim-tree
|
||||
hijack_cursor = true, -- keep the cursor on begin of the filename
|
||||
sync_root_with_cwd = true, -- watch for `DirChanged` and refresh the tree
|
||||
on_attach = on_attach,
|
||||
end,
|
||||
|
||||
git = {
|
||||
ignore = false, -- don't hide files from .gitignore
|
||||
|
@ -41,14 +37,15 @@ return {
|
|||
group_empty = true, -- folders that contain only one folder are grouped
|
||||
highlight_git = true, -- enable highlight based on git attributes
|
||||
},
|
||||
},
|
||||
|
||||
config = function(_, opts)
|
||||
require('nvim-tree').setup(opts)
|
||||
}
|
||||
|
||||
vim.keymap.set('n', '<leader>nn', '<cmd>NvimTreeOpen<cr>')
|
||||
vim.keymap.set('n', '<leader>nf', '<cmd>NvimTreeFindFile<cr>')
|
||||
vim.keymap.set('n', '<leader>nc', '<cmd>NvimTreeClose<cr>')
|
||||
end,
|
||||
end
|
||||
|
||||
return {
|
||||
'kyazdani42/nvim-tree.lua',
|
||||
config = config,
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
local telescope = {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
|
||||
config = function(_, opts)
|
||||
local config = function()
|
||||
local telescope = require 'telescope'
|
||||
local actions = require 'telescope.actions'
|
||||
local actions_layout = require 'telescope.actions.layout'
|
||||
|
@ -163,15 +160,17 @@ local telescope = {
|
|||
map('n', '<leader>fo', builtin.vim_options, { desc = ' [F]ind vim [O]ptions' })
|
||||
map('n', '<leader>fs', builtin.grep_string, { desc = ' [F]ind [S]tring' })
|
||||
map('v', '<leader>fs', custom.grep_visual, { desc = ' [F]ind visual [S]election' })
|
||||
end,
|
||||
end
|
||||
|
||||
local telescope = {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
config = config,
|
||||
}
|
||||
|
||||
local file_browser = {
|
||||
'nvim-telescope/telescope-file-browser.nvim',
|
||||
|
||||
dependencies = {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
},
|
||||
dependencies = { 'nvim-telescope/telescope.nvim' },
|
||||
|
||||
config = function()
|
||||
require('telescope').load_extension 'file_browser'
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
return {
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
|
||||
opts = {
|
||||
local config = function()
|
||||
require('nvim-treesitter.configs').setup {
|
||||
ensure_installed = {
|
||||
'bash',
|
||||
'c',
|
||||
|
@ -26,7 +23,7 @@ return {
|
|||
highlight = {
|
||||
enable = true,
|
||||
disable = {
|
||||
'help',
|
||||
'vimdoc',
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -84,15 +81,17 @@ return {
|
|||
playground = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
|
||||
config = function(_, opts)
|
||||
require('nvim-treesitter.configs').setup(opts)
|
||||
}
|
||||
|
||||
vim.keymap.set('n', '<leader>sp', '<cmd>TSPlaygroundToggle<cr>')
|
||||
vim.keymap.set('n', '<leader>sh', '<cmd>TSHighlightCapturesUnderCursor<cr>')
|
||||
vim.keymap.set('n', '<leader>sn', '<cmd>TSNodeUnderCursor<cr>')
|
||||
end,
|
||||
end
|
||||
|
||||
return {
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
config = config,
|
||||
},
|
||||
|
||||
'nvim-treesitter/nvim-treesitter-refactor',
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
return {
|
||||
'lukas-reineke/virt-column.nvim',
|
||||
|
||||
opts = {
|
||||
config = function()
|
||||
require('virt-column').setup {
|
||||
char = '│',
|
||||
},
|
||||
|
||||
config = function(_, opts)
|
||||
require('virt-column').setup(opts)
|
||||
}
|
||||
|
||||
local toggle_virtual_column = function()
|
||||
if vim.o.colorcolumn == '' then
|
||||
|
|
Loading…
Add table
Reference in a new issue