nvim: add GuessIndent
parent
c5bf754ec8
commit
019a04c5b2
|
@ -76,6 +76,7 @@ Plug('onsails/lspkind-nvim')
|
||||||
-- DevExp
|
-- DevExp
|
||||||
Plug('windwp/nvim-autopairs') -- matches pairs like [] (),...
|
Plug('windwp/nvim-autopairs') -- matches pairs like [] (),...
|
||||||
Plug('windwp/nvim-ts-autotag') -- matches tags <body>hello</body>
|
Plug('windwp/nvim-ts-autotag') -- matches tags <body>hello</body>
|
||||||
|
Plug('NMAC427/guess-indent.nvim') -- guesses the indentation of an opened buffer
|
||||||
Plug('numToStr/Comment.nvim') -- "gc" to comment visual regions/lines
|
Plug('numToStr/Comment.nvim') -- "gc" to comment visual regions/lines
|
||||||
Plug('lewis6991/gitsigns.nvim') -- add git info to sign columns
|
Plug('lewis6991/gitsigns.nvim') -- add git info to sign columns
|
||||||
Plug('tpope/vim-fugitive') -- git commands in nvim
|
Plug('tpope/vim-fugitive') -- git commands in nvim
|
||||||
|
@ -237,6 +238,20 @@ require('nvim-autopairs').setup {
|
||||||
check_ts = true,
|
check_ts = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
require('guess-indent').setup {
|
||||||
|
auto_cmd = true, -- Set to false to disable automatic execution
|
||||||
|
filetype_exclude = { -- A list of filetypes for which the auto command gets disabled
|
||||||
|
"netrw",
|
||||||
|
"tutor",
|
||||||
|
},
|
||||||
|
buftype_exclude = { -- A list of buffer types for which the auto command gets disabled
|
||||||
|
"help",
|
||||||
|
"nofile",
|
||||||
|
"terminal",
|
||||||
|
"prompt",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
-- harpoon: mark significant files & switch between them
|
-- harpoon: mark significant files & switch between them
|
||||||
remap('n', '<leader>m', function() require('harpoon.mark').add_file() end)
|
remap('n', '<leader>m', function() require('harpoon.mark').add_file() end)
|
||||||
local function harpoon_nav(key, nav_file_index, lead_keybind)
|
local function harpoon_nav(key, nav_file_index, lead_keybind)
|
||||||
|
@ -292,14 +307,14 @@ local on_attach = function(_, bufnr)
|
||||||
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
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')
|
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
||||||
|
|
||||||
-- documentations. See `:help K` for why this keymap
|
-- documentations. See `:help K` for why this keymap
|
||||||
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
|
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
|
||||||
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
|
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
|
||||||
|
|
||||||
-- Lesser used LSP functionality
|
-- Lesser used LSP functionality
|
||||||
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||||
nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
|
nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
|
||||||
nmap('<leader>ja', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
|
nmap('<leader>ja', 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>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
|
||||||
nmap('<leader>wl', function()
|
nmap('<leader>wl', function()
|
||||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||||
|
@ -349,11 +364,11 @@ require('mason-lspconfig').setup_handlers({
|
||||||
},
|
},
|
||||||
workspace = {
|
workspace = {
|
||||||
library = vim.api.nvim_get_runtime_file('', true)
|
library = vim.api.nvim_get_runtime_file('', true)
|
||||||
},
|
},
|
||||||
telemetry = { enable = false }
|
telemetry = { enable = false }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
require('zk').setup({
|
require('zk').setup({
|
||||||
|
@ -363,7 +378,7 @@ require('zk').setup({
|
||||||
cmd = { "zk", "lsp" },
|
cmd = { "zk", "lsp" },
|
||||||
name = "zk",
|
name = "zk",
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
},
|
},
|
||||||
auto_attach = {
|
auto_attach = {
|
||||||
enable = true,
|
enable = true,
|
||||||
filetypes = { "markdown" }
|
filetypes = { "markdown" }
|
||||||
|
@ -411,11 +426,11 @@ cmp.setup {
|
||||||
mapping = cmp.mapping.preset.insert {
|
mapping = cmp.mapping.preset.insert {
|
||||||
['<C-u>'] = cmp.mapping.scroll_docs(-4),
|
['<C-u>'] = cmp.mapping.scroll_docs(-4),
|
||||||
['<C-d>'] = cmp.mapping.scroll_docs(4),
|
['<C-d>'] = cmp.mapping.scroll_docs(4),
|
||||||
['<C-Space>'] = cmp.mapping.complete(),
|
['<C-Space>'] = cmp.mapping.complete(),
|
||||||
['<CR>'] = cmp.mapping.confirm {
|
['<CR>'] = cmp.mapping.confirm {
|
||||||
behavior = cmp.ConfirmBehavior.Replace,
|
behavior = cmp.ConfirmBehavior.Replace,
|
||||||
select = true,
|
select = true,
|
||||||
},
|
},
|
||||||
['<Tab>'] = cmp.mapping(function(fallback)
|
['<Tab>'] = cmp.mapping(function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
cmp.select_next_item()
|
cmp.select_next_item()
|
||||||
|
@ -423,7 +438,7 @@ cmp.setup {
|
||||||
luasnip.expand_or_jump()
|
luasnip.expand_or_jump()
|
||||||
else
|
else
|
||||||
fallback()
|
fallback()
|
||||||
end
|
end
|
||||||
end, { 'i', 's' }),
|
end, { 'i', 's' }),
|
||||||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
|
|
Loading…
Reference in New Issue