nvim: add GuessIndent

nix-components
pegasust 2022-09-02 07:00:54 -07:00
parent c5bf754ec8
commit 019a04c5b2
1 changed files with 244 additions and 229 deletions

View File

@ -76,6 +76,7 @@ Plug('onsails/lspkind-nvim')
-- DevExp
Plug('windwp/nvim-autopairs') -- matches pairs like [] (),...
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('lewis6991/gitsigns.nvim') -- add git info to sign columns
Plug('tpope/vim-fugitive') -- git commands in nvim
@ -237,6 +238,20 @@ require('nvim-autopairs').setup {
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
remap('n', '<leader>m', function() require('harpoon.mark').add_file() end)
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>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('<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>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>wl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
@ -349,11 +364,11 @@ require('mason-lspconfig').setup_handlers({
},
workspace = {
library = vim.api.nvim_get_runtime_file('', true)
},
},
telemetry = { enable = false }
}
}
}
}
end
})
require('zk').setup({
@ -363,7 +378,7 @@ require('zk').setup({
cmd = { "zk", "lsp" },
name = "zk",
on_attach = on_attach,
},
},
auto_attach = {
enable = true,
filetypes = { "markdown" }
@ -411,11 +426,11 @@ cmp.setup {
mapping = cmp.mapping.preset.insert {
['<C-u>'] = 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 {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
select = true,
},
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
@ -423,7 +438,7 @@ cmp.setup {
luasnip.expand_or_jump()
else
fallback()
end
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then