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 {
|
return {
|
||||||
'lukas-reineke/indent-blankline.nvim',
|
'lukas-reineke/indent-blankline.nvim',
|
||||||
|
|
||||||
opts = {
|
config = function()
|
||||||
|
require('indent_blankline').setup {
|
||||||
enabled = false,
|
enabled = false,
|
||||||
},
|
}
|
||||||
|
|
||||||
config = function(_, opts)
|
|
||||||
require('indent_blankline').setup(opts)
|
|
||||||
|
|
||||||
-- show/hide indent guides
|
-- show/hide indent guides
|
||||||
vim.keymap.set('n', '<leader>si', '<cmd>IndentBlanklineToggle<cr>')
|
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
|
if filetype_attach then filetype_attach(client, bufnr) end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local config = function()
|
||||||
return {
|
|
||||||
'neovim/nvim-lspconfig',
|
|
||||||
|
|
||||||
config = function()
|
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
local has_cmp, cmp = pcall(require, 'cmp_nvim_lsp')
|
local has_cmp, cmp = pcall(require, 'cmp_nvim_lsp')
|
||||||
if has_cmp then
|
if has_cmp then
|
||||||
|
@ -48,6 +44,10 @@ return {
|
||||||
})
|
})
|
||||||
lsp[server].setup(opts)
|
lsp[server].setup(opts)
|
||||||
end
|
end
|
||||||
end,
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
'neovim/nvim-lspconfig',
|
||||||
|
config = config,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
return {
|
local config = function()
|
||||||
'nvim-lualine/lualine.nvim',
|
|
||||||
|
|
||||||
config = function()
|
|
||||||
local MODE_MAP = {
|
local MODE_MAP = {
|
||||||
['n'] = 'Normal ',
|
['n'] = 'Normal ',
|
||||||
['no'] = 'O-Pend ',
|
['no'] = 'O-Pend ',
|
||||||
|
@ -176,6 +173,10 @@ return {
|
||||||
'nvim-tree',
|
'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')
|
local api = require('nvim-tree.api')
|
||||||
|
api.config.mappings.default_on_attach(bufnr)
|
||||||
|
|
||||||
local opts = function(desc)
|
local opts = function(desc)
|
||||||
return { desc = 'nvim-tree: ' .. desc, buffer = bufnr, silent = true }
|
return { desc = 'nvim-tree: ' .. desc, buffer = bufnr, silent = true }
|
||||||
end
|
end
|
||||||
|
|
||||||
api.config.mappings.default_on_attach(bufnr)
|
|
||||||
|
|
||||||
vim.keymap.set('n', 'l', api.node.open.edit, opts('open'))
|
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', '<CR>', api.node.open.edit, opts('open'))
|
||||||
vim.keymap.set('n', 'o', 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'))
|
vim.keymap.set('n', 'h', api.node.navigate.parent_close, opts('close directory'))
|
||||||
end
|
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,
|
|
||||||
|
|
||||||
git = {
|
git = {
|
||||||
ignore = false, -- don't hide files from .gitignore
|
ignore = false, -- don't hide files from .gitignore
|
||||||
|
@ -41,14 +37,15 @@ return {
|
||||||
group_empty = true, -- folders that contain only one folder are grouped
|
group_empty = true, -- folders that contain only one folder are grouped
|
||||||
highlight_git = true, -- enable highlight based on git attributes
|
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>nn', '<cmd>NvimTreeOpen<cr>')
|
||||||
vim.keymap.set('n', '<leader>nf', '<cmd>NvimTreeFindFile<cr>')
|
vim.keymap.set('n', '<leader>nf', '<cmd>NvimTreeFindFile<cr>')
|
||||||
vim.keymap.set('n', '<leader>nc', '<cmd>NvimTreeClose<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 = {
|
local config = function()
|
||||||
'nvim-telescope/telescope.nvim',
|
|
||||||
|
|
||||||
config = function(_, opts)
|
|
||||||
local telescope = require 'telescope'
|
local telescope = require 'telescope'
|
||||||
local actions = require 'telescope.actions'
|
local actions = require 'telescope.actions'
|
||||||
local actions_layout = require 'telescope.actions.layout'
|
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>fo', builtin.vim_options, { desc = ' [F]ind vim [O]ptions' })
|
||||||
map('n', '<leader>fs', builtin.grep_string, { desc = ' [F]ind [S]tring' })
|
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' })
|
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 = {
|
local file_browser = {
|
||||||
'nvim-telescope/telescope-file-browser.nvim',
|
'nvim-telescope/telescope-file-browser.nvim',
|
||||||
|
|
||||||
dependencies = {
|
dependencies = { 'nvim-telescope/telescope.nvim' },
|
||||||
'nvim-telescope/telescope.nvim',
|
|
||||||
},
|
|
||||||
|
|
||||||
config = function()
|
config = function()
|
||||||
require('telescope').load_extension 'file_browser'
|
require('telescope').load_extension 'file_browser'
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
return {
|
local config = function()
|
||||||
{
|
require('nvim-treesitter.configs').setup {
|
||||||
'nvim-treesitter/nvim-treesitter',
|
|
||||||
|
|
||||||
opts = {
|
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
'bash',
|
'bash',
|
||||||
'c',
|
'c',
|
||||||
|
@ -26,7 +23,7 @@ return {
|
||||||
highlight = {
|
highlight = {
|
||||||
enable = true,
|
enable = true,
|
||||||
disable = {
|
disable = {
|
||||||
'help',
|
'vimdoc',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -84,15 +81,17 @@ return {
|
||||||
playground = {
|
playground = {
|
||||||
enable = true,
|
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>sp', '<cmd>TSPlaygroundToggle<cr>')
|
||||||
vim.keymap.set('n', '<leader>sh', '<cmd>TSHighlightCapturesUnderCursor<cr>')
|
vim.keymap.set('n', '<leader>sh', '<cmd>TSHighlightCapturesUnderCursor<cr>')
|
||||||
vim.keymap.set('n', '<leader>sn', '<cmd>TSNodeUnderCursor<cr>')
|
vim.keymap.set('n', '<leader>sn', '<cmd>TSNodeUnderCursor<cr>')
|
||||||
end,
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
'nvim-treesitter/nvim-treesitter',
|
||||||
|
config = config,
|
||||||
},
|
},
|
||||||
|
|
||||||
'nvim-treesitter/nvim-treesitter-refactor',
|
'nvim-treesitter/nvim-treesitter-refactor',
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
return {
|
return {
|
||||||
'lukas-reineke/virt-column.nvim',
|
'lukas-reineke/virt-column.nvim',
|
||||||
|
|
||||||
opts = {
|
config = function()
|
||||||
|
require('virt-column').setup {
|
||||||
char = '│',
|
char = '│',
|
||||||
},
|
}
|
||||||
|
|
||||||
config = function(_, opts)
|
|
||||||
require('virt-column').setup(opts)
|
|
||||||
|
|
||||||
local toggle_virtual_column = function()
|
local toggle_virtual_column = function()
|
||||||
if vim.o.colorcolumn == '' then
|
if vim.o.colorcolumn == '' then
|
||||||
|
|
Loading…
Add table
Reference in a new issue