Add lsp servers

main
Buddy Sandidge 1 year ago
parent acf86e8285
commit 3fec732003

@ -31,8 +31,8 @@ vim.opt.list = true
vim.opt.smartcase = true
vim.opt.wrap = false
vim.opt.whichwrap:append {
['<'] = true,
['>'] = true,
['['] = true,
[']'] = true,
['<'] = true,
['>'] = true,
['['] = true,
[']'] = true,
}

@ -1,61 +1,61 @@
local function config()
local cmp = require 'cmp'
local luasnip = require 'luasnip'
local cmp = require 'cmp'
local luasnip = require 'luasnip'
local function expand(args)
luasnip.lsp_expand(args.body)
end
local function expand(args)
luasnip.lsp_expand(args.body)
end
local function tab_mapping(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end
local function tab_mapping(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end
local function back_tab_mapping(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end
local function back_tab_mapping(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end
cmp.setup {
enabled = true,
cmp.setup {
enabled = true,
snippet = { expand = expand },
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
},
snippet = { expand = expand },
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
},
mapping = cmp.mapping.preset.insert {
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete({}),
['<Tab>'] = cmp.mapping(tab_mapping, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(back_tab_mapping, { 'i', 's' }),
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
},
}
mapping = cmp.mapping.preset.insert {
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete({}),
['<Tab>'] = cmp.mapping(tab_mapping, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(back_tab_mapping, { 'i', 's' }),
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
},
}
end
return {
'hrsh7th/nvim-cmp',
config = config,
dependencies = {
'saadparwaiz1/cmp_luasnip',
'hrsh7th/cmp-nvim-lsp',
},
'hrsh7th/nvim-cmp',
config = config,
dependencies = {
'saadparwaiz1/cmp_luasnip',
'hrsh7th/cmp-nvim-lsp',
},
}

@ -1,22 +1,7 @@
local config = function()
local wk = require 'which-key'
wk.setup()
wk.register {
['<leader>c'] = { name = '[C]ode', _ = 'which_key_ignore' },
['<leader>d'] = { name = '[D]ocument', _ = 'which_key_ignore' },
['<leader>g'] = { name = '[G]it', _ = 'which_key_ignore' },
['<leader>h'] = { name = 'More git', _ = 'which_key_ignore' },
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
}
end
return {
'folke/which-key.nvim',
config = config,
dependencies = {
{ 'tpope/vim-sleuth', tag = 'v2.0' },
{ 'tpope/vim-surround', tag = 'v2.2' },
},
'tpope/vim-surround',
tag = 'v2.2',
dependencies = {
{ 'tpope/vim-sleuth', tag = 'v2.0' },
},
}

@ -1,93 +0,0 @@
local function on_attach(_, bufnr)
local nmap = function(keys, func, desc)
if desc then
desc = 'LSP: ' .. desc
end
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
end
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
nmap('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
nmap('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
nmap('<leader>D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition')
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
-- See `:help K` for why this keymap
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
-- Lesser used LSP functionality
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
nmap('<leader>wl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, '[W]orkspace [L]ist Folders')
-- Create a command `:Format` local to the LSP buffer
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
vim.lsp.buf.format()
end, { desc = 'Format current buffer with LSP' })
end
local function config()
local mason = require 'mason'
local mason_lspconfig = require 'mason-lspconfig'
local neodev = require 'neodev'
mason.setup()
neodev.setup()
local servers = {
-- clangd = {},
-- pyright = {},
-- rust_analyzer = {},
-- tsserver = {},
-- html = { filetypes = { 'html', 'twig', 'hbs'} },
gopls = {},
lua_ls = {
Lua = {
workspace = { checkThirdParty = false },
telemetry = { enable = false },
},
},
}
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
mason_lspconfig.setup {
ensure_installed = vim.tbl_keys(servers),
}
mason_lspconfig.setup_handlers {
function(server_name)
require('lspconfig')[server_name].setup {
capabilities = capabilities,
on_attach = on_attach,
settings = servers[server_name],
filetypes = (servers[server_name] or {}).filetypes,
}
end,
}
end
return {
-- LSP Configuration & Plugins
'neovim/nvim-lspconfig',
config = config,
dependencies = {
-- Automatically install LSPs to stdpath for neovim
'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim',
-- Useful status updates for LSP
{ 'j-hui/fidget.nvim', tag = 'legacy', opts = {} },
-- Additional lua configuration, makes nvim stuff amazing!
'folke/neodev.nvim',
'folke/trouble.nvim',
},
}

@ -0,0 +1,112 @@
# chezmoi:template:left-delimiter=--{{
--{{- /* vim: set filetype=lua: */ -}}
local function on_attach(_, buffer)
local function nmap(keys, func, desc)
if desc then
desc = 'LSP: ' .. desc
end
vim.keymap.set('n', keys, func, { buffer = buffer, desc = desc })
end
local function inspect_workspace_folders()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end
local function format_buffer(_)
vim.lsp.buf.format()
end
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
local builtin = require 'telescope.builtin'
nmap('gd', builtin.lsp_definitions, '[G]oto [D]efinition')
nmap('gr', builtin.lsp_references, '[G]oto [R]eferences')
nmap('gI', builtin.lsp_implementations, '[G]oto [I]mplementation')
nmap('<leader>D', builtin.lsp_type_definitions, 'Type [D]efinition')
nmap('<leader>ds', builtin.lsp_document_symbols, '[D]ocument [S]ymbols')
nmap('<leader>ws', builtin.lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
-- See `:help K` for why this keymap
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
-- Lesser used LSP functionality
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
nmap('<leader>wl', inspect_workspace_folders, '[W]orkspace [L]ist Folders')
-- Create a command `:Format` local to the LSP buffer
vim.api.nvim_buf_create_user_command(buffer, 'Format', format_buffer, {
desc = 'Format current buffer with LSP',
})
end
local function config()
local cmp_nvim_lsp = require 'cmp_nvim_lsp'
local lspconfig = require 'lspconfig'
local mason = require 'mason'
local mason_lspconfig = require 'mason-lspconfig'
local neodev = require 'neodev'
mason.setup()
neodev.setup()
local servers = {
bashls = {},
bufls = {},
taplo = {},
dockerls = {},
jsonls = {},
jqls = {},
marksman = {},
sqlls = {},
vimls = {},
yamlls = {},
--{{ if lookPath "node" -}}
eslint = {},
--{{- end }}
--{{ if lookPath "go" -}}
gopls = {},
templ = {},
-- golangci_lint_ls = {},
--{{- end }}
lua_ls = {
Lua = {
workspace = { checkThirdParty = false },
telemetry = { enable = false },
},
},
}
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = cmp_nvim_lsp.default_capabilities(capabilities)
mason_lspconfig.setup {
ensure_installed = vim.tbl_keys(servers),
}
mason_lspconfig.setup_handlers {
function(server_name)
lspconfig[server_name].setup {
capabilities = capabilities,
on_attach = on_attach,
settings = servers[server_name],
filetypes = (servers[server_name] or {}).filetypes,
}
end,
}
end
return {
'neovim/nvim-lspconfig',
config = config,
dependencies = {
{ 'williamboman/mason.nvim', tag = 'v1.*' },
{ 'williamboman/mason-lspconfig.nvim', tag = 'v1.*' },
{ 'j-hui/fidget.nvim', tag = 'legacy', opts = {} },
{ 'folke/neodev.nvim', tag = 'v2.*' },
{ 'folke/trouble.nvim', tag = 'v2.*' },
},
}

@ -1,12 +1,12 @@
local function config()
local luasnip = require 'luasnip'
luasnip.setup()
luasnip.config.setup({})
local luasnip = require 'luasnip'
luasnip.setup()
luasnip.config.setup({})
end
return {
'L3MON4D3/LuaSnip',
config = config,
tag = 'v2.*',
dependencies = {},
'L3MON4D3/LuaSnip',
config = config,
tag = 'v2.*',
dependencies = {},
}

@ -1,97 +1,97 @@
-- Telescope live_grep in git root
-- Function to find the git root directory based on the current buffer's path
local function find_git_root()
-- Use the current buffer's path as the starting point for the git search
local current_file = vim.api.nvim_buf_get_name(0)
local current_dir
local cwd = vim.fn.getcwd()
-- If the buffer is not associated with a file, return nil
if current_file == '' then
current_dir = cwd
else
-- Extract the directory from the current file's path
current_dir = vim.fn.fnamemodify(current_file, ':h')
end
-- Use the current buffer's path as the starting point for the git search
local current_file = vim.api.nvim_buf_get_name(0)
local current_dir
local cwd = vim.fn.getcwd()
-- If the buffer is not associated with a file, return nil
if current_file == '' then
current_dir = cwd
else
-- Extract the directory from the current file's path
current_dir = vim.fn.fnamemodify(current_file, ':h')
end
-- Find the Git root directory from the current file's path
local git_root = vim.fn.systemlist('git -C ' .. vim.fn.escape(current_dir, ' ') .. ' rev-parse --show-toplevel')[1]
if vim.v.shell_error ~= 0 then
print('Not a git repository. Searching on current working directory')
return cwd
end
return git_root
-- Find the Git root directory from the current file's path
local git_root = vim.fn.systemlist('git -C ' .. vim.fn.escape(current_dir, ' ') .. ' rev-parse --show-toplevel')[1]
if vim.v.shell_error ~= 0 then
print('Not a git repository. Searching on current working directory')
return cwd
end
return git_root
end
-- Custom live_grep function to search in git root
local function live_grep_git_root()
local git_root = find_git_root()
if git_root then
require('telescope.builtin').live_grep({
search_dirs = { git_root },
})
end
local git_root = find_git_root()
if git_root then
require('telescope.builtin').live_grep({
search_dirs = { git_root },
})
end
end
vim.api.nvim_create_user_command('LiveGrepGitRoot', live_grep_git_root, {})
local telescope_setup = {
defaults = {
mappings = {
i = {
['<C-u>'] = false,
['<C-d>'] = false,
},
},
},
defaults = {
mappings = {
i = {
['<C-u>'] = false,
['<C-d>'] = false,
},
},
},
}
local function config()
-- See `:help telescope` and `:help telescope.setup()`
local telescope = require('telescope')
local builtin = require('telescope.builtin')
local themes = require('telescope.themes')
-- See `:help telescope` and `:help telescope.setup()`
local telescope = require('telescope')
local builtin = require('telescope.builtin')
local themes = require('telescope.themes')
telescope.setup(telescope_setup)
telescope.setup(telescope_setup)
-- Enable telescope fzf native, if installed
pcall(telescope.load_extension, 'fzf')
-- Enable telescope fzf native, if installed
pcall(telescope.load_extension, 'fzf')
local fuzzy_find = function()
-- You can pass additional configuration to telescope to change theme, layout, etc.
builtin.current_buffer_fuzzy_find(themes.get_dropdown({
winblend = 10,
previewer = false,
}))
end
local fuzzy_find = function()
-- You can pass additional configuration to telescope to change theme, layout, etc.
builtin.current_buffer_fuzzy_find(themes.get_dropdown({
winblend = 10,
previewer = false,
}))
end
-- See `:help telescope.builtin`
vim.keymap.set('n', '<leader>?', builtin.oldfiles, { desc = '[?] Find recently opened files' })
vim.keymap.set('n', '<leader><space>', builtin.buffers, { desc = '[ ] Find existing buffers' })
vim.keymap.set('n', '<leader>/', fuzzy_find, { desc = '[/] Fuzzily search in current buffer' })
vim.keymap.set('n', '<leader>gf', builtin.git_files, { desc = 'Search [G]it [F]iles' })
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
vim.keymap.set('n', '<leader>sG', live_grep_git_root, { desc = '[S]earch by [G]rep on Git Root' })
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
-- See `:help telescope.builtin`
vim.keymap.set('n', '<leader>?', builtin.oldfiles, { desc = '[?] Find recently opened files' })
vim.keymap.set('n', '<leader><space>', builtin.buffers, { desc = '[ ] Find existing buffers' })
vim.keymap.set('n', '<leader>/', fuzzy_find, { desc = '[/] Fuzzily search in current buffer' })
vim.keymap.set('n', '<leader>gf', builtin.git_files, { desc = 'Search [G]it [F]iles' })
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
vim.keymap.set('n', '<leader>sG', live_grep_git_root, { desc = '[S]earch by [G]rep on Git Root' })
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
end
local is_make_installed = function()
return vim.fn.executable('make') == 1
return vim.fn.executable('make') == 1
end
return {
'nvim-telescope/telescope.nvim',
branch = '0.1.x',
config = config,
dependencies = {
'nvim-lua/plenary.nvim',
{
'nvim-telescope/telescope-fzf-native.nvim',
cond = is_make_installed,
build = 'make',
},
},
'nvim-telescope/telescope.nvim',
branch = '0.1.x',
config = config,
dependencies = {
'nvim-lua/plenary.nvim',
{
'nvim-telescope/telescope-fzf-native.nvim',
cond = is_make_installed,
build = 'make',
},
},
}

@ -1,17 +1,17 @@
local function config()
vim.cmd.colorscheme 'gruvbox'
vim.cmd.colorscheme 'gruvbox'
end
return {
'morhetz/gruvbox',
priority = 1000,
config = config,
dependencies = {
'nvim-lualine/lualine.nvim',
opts = {
options = {
theme = 'gruvbox',
},
},
},
'morhetz/gruvbox',
priority = 1000,
config = config,
dependencies = {
'nvim-lualine/lualine.nvim',
opts = {
options = {
theme = 'gruvbox',
},
},
},
}

@ -3,58 +3,58 @@ vim.g.loaded_netrwPlugin = 1
vim.opt.termguicolors = true
local function handle_closed(window)
local tab = vim.api.nvim_win_get_tabpage(window)
local buffer = vim.api.nvim_win_get_buf(window)
local info = vim.fn.getbufinfo(buffer)[1]
local filter_window = function(w)
return w ~= window
end
local windows = vim.tbl_filter(filter_window, vim.api.nvim_tabpage_list_wins(tab))
local buffers = vim.tbl_map(vim.api.nvim_win_get_buf, windows)
if info.name:match('.*NvimTree_%d*$') then
if not vim.tbl_isempty(buffers) then
require('nvim-tree.api').tree.close()
end
return
end
if #buffers ~= 1 then
return
end
local last_info = vim.fn.getbufinfo(buffers[1])[1]
if last_info.name:match('.*NvimTree_%d*$') then
vim.schedule(function()
if #vim.api.nvim_list_wins() == 1 then
vim.cmd 'quit'
else
vim.api.nvim_win_close(windows[1], true)
end
end)
end
local tab = vim.api.nvim_win_get_tabpage(window)
local buffer = vim.api.nvim_win_get_buf(window)
local info = vim.fn.getbufinfo(buffer)[1]
local function filter_window(w)
return w ~= window
end
local windows = vim.tbl_filter(filter_window, vim.api.nvim_tabpage_list_wins(tab))
local buffers = vim.tbl_map(vim.api.nvim_win_get_buf, windows)
if info.name:match('.*NvimTree_%d*$') then
if not vim.tbl_isempty(buffers) then
require('nvim-tree.api').tree.close()
end
return
end
if #buffers ~= 1 then
return
end
local last_info = vim.fn.getbufinfo(buffers[1])[1]
if last_info.name:match('.*NvimTree_%d*$') then
vim.schedule(function()
if #vim.api.nvim_list_wins() == 1 then
vim.cmd 'quit'
else
vim.api.nvim_win_close(windows[1], true)
end
end)
end
end
local config = function()
require('nvim-tree').setup()
vim.api.nvim_create_autocmd('WinClosed', {
nested = true,
callback = function()
local window = tonumber(vim.fn.expand('<amatch>'))
vim.schedule_wrap(handle_closed(window))
end,
})
local function config()
require('nvim-tree').setup()
vim.api.nvim_create_autocmd('WinClosed', {
nested = true,
callback = function()
local window = tonumber(vim.fn.expand('<amatch>'))
handle_closed(window)
end,
})
end
return {
'nvim-tree/nvim-tree.lua',
config = config,
keys = {
{ '<leader>nt', ':NvimTreeToggle<CR>', desc = 'toggle nvim tree' }
},
dependencies = {
'nvim-tree/nvim-web-devicons', opts = {}
},
'nvim-tree/nvim-tree.lua',
config = config,
keys = {
{ '<leader>nt', ':NvimTreeToggle<CR>', desc = 'toggle nvim tree' }
},
dependencies = {
'nvim-tree/nvim-web-devicons', opts = {}
},
}

@ -1,93 +1,93 @@
local treesitter_config_setup = {
-- Add languages to be installed here that you want installed for treesitter
ensure_installed = {
'bash', 'c', 'cpp', 'go', 'lua', 'python', 'rust',
'tsx', 'javascript', 'typescript', 'vimdoc', 'vim',
},
-- Add languages to be installed here that you want installed for treesitter
ensure_installed = {
'bash', 'c', 'cpp', 'go', 'lua', 'python', 'rust',
'tsx', 'javascript', 'typescript', 'vimdoc', 'vim',
},
auto_install = true,
sync_install = false,
auto_install = true,
sync_install = false,
modules = {},
ignore_install = {},
modules = {},
ignore_install = {},
highlight = { enable = true },
indent = { enable = true },
highlight = { enable = true },
indent = { enable = true },
incremental_selection = {
enable = true,
keymaps = {
init_selection = '<c-space>',
node_incremental = '<c-space>',
scope_incremental = '<c-s>',
node_decremental = '<M-space>',
},
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = '<c-space>',
node_incremental = '<c-space>',
scope_incremental = '<c-s>',
node_decremental = '<M-space>',
},
},
textobjects = {
select = {
enable = true,
-- Automatically jump forward to textobj, similar to targets.vim
lookahead = true,
keymaps = {
-- You can use the capture groups defined in textobjects.scm
['aa'] = '@parameter.outer',
['ia'] = '@parameter.inner',
['af'] = '@function.outer',
['if'] = '@function.inner',
['ac'] = '@class.outer',
['ic'] = '@class.inner',
},
},
textobjects = {
select = {
enable = true,
-- Automatically jump forward to textobj, similar to targets.vim
lookahead = true,
keymaps = {
-- You can use the capture groups defined in textobjects.scm
['aa'] = '@parameter.outer',
['ia'] = '@parameter.inner',
['af'] = '@function.outer',
['if'] = '@function.inner',
['ac'] = '@class.outer',
['ic'] = '@class.inner',
},
},
swap = {
enable = true,
swap_next = {
['<leader>a'] = '@parameter.inner',
},
swap_previous = {
['<leader>A'] = '@parameter.inner',
},
},
swap = {
enable = true,
swap_next = {
['<leader>a'] = '@parameter.inner',
},
swap_previous = {
['<leader>A'] = '@parameter.inner',
},
},
move = {
enable = true,
-- whether to set jumps in the jumplist
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',
},
},
},
move = {
enable = true,
-- whether to set jumps in the jumplist
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',
},
},
},
}
local function treesitter_configs()
require('nvim-treesitter.configs').setup(treesitter_config_setup)
require('nvim-treesitter.configs').setup(treesitter_config_setup)
end
local function config()
vim.defer_fn(treesitter_configs, 0)
vim.defer_fn(treesitter_configs, 0)
end
return {
-- Highlight, edit, and navigate code
'nvim-treesitter/nvim-treesitter',
config = config,
build = ':TSUpdate',
dependencies = {
'nvim-treesitter/nvim-treesitter-textobjects',
},
-- Highlight, edit, and navigate code
'nvim-treesitter/nvim-treesitter',
config = config,
build = ':TSUpdate',
dependencies = {
'nvim-treesitter/nvim-treesitter-textobjects',
},
}

@ -0,0 +1,25 @@
local function init()
vim.o.timeout = true
vim.o.timeoutlen = 300
end
local function config()
local wk = require 'which-key'
wk.setup()
wk.register {
['<leader>c'] = { name = '[C]ode', _ = 'which_key_ignore' },
['<leader>d'] = { name = '[D]ocument', _ = 'which_key_ignore' },
['<leader>g'] = { name = '[G]it', _ = 'which_key_ignore' },
['<leader>h'] = { name = 'More git', _ = 'which_key_ignore' },
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
}
end
return {
'folke/which-key.nvim',
init = init,
config = config,
event = "VeryLazy",
}

@ -15,6 +15,6 @@ indent_style = tab
indent_size = 4
indent_style = space
[*.{json,yml,yaml}]
[*.{json,yml,yaml,lua}]
indent_style = space
indent_size = 2

Loading…
Cancel
Save