nvim config
This commit is contained in:
61
lua/plugins/cmp.lua
Normal file
61
lua/plugins/cmp.lua
Normal file
@@ -0,0 +1,61 @@
|
||||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
version = false, -- last release is way too old
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"onsails/lspkind.nvim"
|
||||
},
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
local lspkind = require("lspkind")
|
||||
cmp.setup({
|
||||
sources = {
|
||||
{ name = "nvim_lsp" }
|
||||
},
|
||||
formatting = {
|
||||
fields = { 'abbr', 'icon', 'kind', 'menu' },
|
||||
format = lspkind.cmp_format({
|
||||
maxwidth = {
|
||||
-- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
|
||||
-- can also be a function to dynamically calculate max width such as
|
||||
-- menu = function() return math.floor(0.45 * vim.o.columns) end,
|
||||
menu = 50, -- leading text (labelDetails)
|
||||
abbr = 50, -- actual suggestion item
|
||||
},
|
||||
ellipsis_char = '...', -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first)
|
||||
show_labelDetails = true, -- show labelDetails in menu. Disabled by default
|
||||
|
||||
-- The function below will be called before any actual modifications from lspkind
|
||||
-- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30))
|
||||
before = function (entry, vim_item)
|
||||
return vim_item
|
||||
end
|
||||
})
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
-- Navigate between completion items
|
||||
['<C-p>'] = cmp.mapping.select_prev_item({behavior = 'select'}),
|
||||
['<C-n>'] = cmp.mapping.select_next_item({behavior = 'select'}),
|
||||
|
||||
-- `Enter` key to confirm completion
|
||||
['<CR>'] = cmp.mapping.confirm({select = false}),
|
||||
|
||||
-- Ctrl+Space to trigger completion menu
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
|
||||
-- Scroll up and down in the completion documentation
|
||||
['<C-u>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(4),
|
||||
}),
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
vim.snippet.expand(args.body)
|
||||
end,
|
||||
}
|
||||
})
|
||||
end,
|
||||
main = "lazyvim.util.cmp",
|
||||
}
|
||||
4
lua/plugins/core.lua
Normal file
4
lua/plugins/core.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
return {
|
||||
{ "folke/lazy.nvim", version = false },
|
||||
-- { "LazyVim/LazyVim", version = false },
|
||||
}
|
||||
10
lua/plugins/diffview.lua
Normal file
10
lua/plugins/diffview.lua
Normal file
@@ -0,0 +1,10 @@
|
||||
return {
|
||||
"sindrets/diffview.nvim",
|
||||
dependencies = {
|
||||
"nvim-web-devicons"
|
||||
},
|
||||
options = {
|
||||
enhanced_diff_hl = true,
|
||||
|
||||
}
|
||||
}
|
||||
14
lua/plugins/gitsigns.lua
Normal file
14
lua/plugins/gitsigns.lua
Normal file
@@ -0,0 +1,14 @@
|
||||
return {
|
||||
"lewis6991/gitsigns.nvim",
|
||||
config = function()
|
||||
require('gitsigns').setup({
|
||||
signs = {
|
||||
add = { text = '+' },
|
||||
change = { text = '~' },
|
||||
delete = { text = '_' },
|
||||
topdelete = { text = '‾' },
|
||||
changedelete = { text = '~' },
|
||||
},
|
||||
})
|
||||
end
|
||||
}
|
||||
149
lua/plugins/lspconfig.lua
Normal file
149
lua/plugins/lspconfig.lua
Normal file
@@ -0,0 +1,149 @@
|
||||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
servers = {
|
||||
}
|
||||
},
|
||||
config = function()
|
||||
local lspconfig = require('lspconfig')
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
|
||||
|
||||
lspconfig.texlab.setup({
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
texlab = {
|
||||
build = {
|
||||
executable = 'latexmk',
|
||||
args = { '-pdf', '-interaction=nonstopmode', '-synctex=1', '%f' },
|
||||
onSave = true,
|
||||
},
|
||||
chktex = { onOpenAndSave = true }, -- Enables linting
|
||||
}
|
||||
}
|
||||
})
|
||||
lspconfig.rust_analyzer.setup({
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
['rust-analyzer'] = {
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
},
|
||||
imports = {
|
||||
granularity = {
|
||||
group = "module",
|
||||
},
|
||||
prefix = "self",
|
||||
},
|
||||
cargo = {
|
||||
buildScripts = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
procMacro = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
lspconfig.lua_ls.setup({
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = { version = 'LuaJIT' },
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = { vim.env.VIMRUNTIME },
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
lspconfig.cssls.setup({
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
scss = {
|
||||
validate = true
|
||||
},
|
||||
css = {
|
||||
validate = true
|
||||
}
|
||||
}
|
||||
})
|
||||
lspconfig.somesass_ls.setup({
|
||||
capabilities = capabilities,
|
||||
filetypes = { "sass", "scss" }
|
||||
})
|
||||
lspconfig.yamlls.setup({
|
||||
capabilities = capabilities,
|
||||
filetypes = { "yaml", "yaml.docker-compose", "yaml.gitlab" },
|
||||
settings = {
|
||||
yaml = {
|
||||
validate = true,
|
||||
hover = true,
|
||||
completion = true,
|
||||
format = {
|
||||
enable = true
|
||||
},
|
||||
schemaStore = {
|
||||
enable = true,
|
||||
url = "https://schemastore.org",
|
||||
},
|
||||
schemas = {
|
||||
["http://json.schemastore.org/github-workflow"] = ".github/workflows/*",
|
||||
["http://json.schemastore.org/github-action"] = ".github/action.{yml,yaml}",
|
||||
["http://json.schemastore.org/prettierrc"] = ".prettierrc.{yml,yaml}",
|
||||
["http://json.schemastore.org/kustomization"] = "kustomization.{yml,yaml}",
|
||||
kubernetes = "*.yaml"
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
lspconfig.ts_ls.setup({
|
||||
capabilities = capabilities,
|
||||
init_options = {
|
||||
plugins = {
|
||||
{
|
||||
name = "@vue/typescript-plugin",
|
||||
location = "/usr/local/lib/node_modules/@vue/typescript-plugin",
|
||||
languages = {"javascript", "typescript", "vue"},
|
||||
},
|
||||
},
|
||||
|
||||
}
|
||||
})
|
||||
lspconfig.bashls.setup({
|
||||
capabilities = capabilities,
|
||||
filetypes = { "sh", "bash", "zsh" },
|
||||
settings = {
|
||||
bashIde = {
|
||||
globPattern = "**/*@(.sh|.inc|.bash|.command|.zsh|zshrc|.zshrc|zsh_*|.zsh_*)"
|
||||
}
|
||||
},
|
||||
single_file_support = true
|
||||
})
|
||||
lspconfig.jsonls.setup({
|
||||
capabilities = capabilities
|
||||
})
|
||||
-- lspconfig.helm_ls.setup({
|
||||
-- capabilities = capabilities,
|
||||
-- filetypes = { "helm" },
|
||||
-- settings = {
|
||||
-- ['helm_ls'] = {
|
||||
-- yamlls = {
|
||||
-- enabled = true,
|
||||
-- path = "yaml-language-server",
|
||||
-- enabledForFilesGlob = "*.{yaml,yml}",
|
||||
-- config = {
|
||||
-- schemas = {
|
||||
-- kubernetes = "templates/**",
|
||||
-- },
|
||||
-- completion = true,
|
||||
-- hover = true,
|
||||
-- },
|
||||
-- }
|
||||
-- }
|
||||
-- }
|
||||
-- })
|
||||
end,
|
||||
version = "~1.0.0"
|
||||
}
|
||||
10
lua/plugins/lspsaga.lua
Normal file
10
lua/plugins/lspsaga.lua
Normal file
@@ -0,0 +1,10 @@
|
||||
return {
|
||||
'nvimdev/lspsaga.nvim',
|
||||
config = function()
|
||||
require('lspsaga').setup({})
|
||||
end,
|
||||
dependencies = {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
'nvim-tree/nvim-web-devicons',
|
||||
}
|
||||
}
|
||||
7
lua/plugins/lualine.lua
Normal file
7
lua/plugins/lualine.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
return {
|
||||
'nvim-lualine/lualine.nvim',
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
config = function()
|
||||
require('lualine').setup()
|
||||
end
|
||||
}
|
||||
1
lua/plugins/polyglot.lua
Normal file
1
lua/plugins/polyglot.lua
Normal file
@@ -0,0 +1 @@
|
||||
return { "sheerun/vim-polyglot" }
|
||||
22
lua/plugins/seeker.lua
Normal file
22
lua/plugins/seeker.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
return {
|
||||
'2kabhishek/seeker.nvim',
|
||||
dependencies = { 'folke/snacks.nvim' },
|
||||
cmd = { 'Seeker' },
|
||||
keys = {
|
||||
{ '<leader>fa', ':Seeker files<CR>', desc = 'Seek Files' },
|
||||
{ '<leader>ff', ':Seeker git_files<CR>', desc = 'Seek Git Files' },
|
||||
{ '<leader>fg', ':Seeker grep<CR>', desc = 'Seek Grep' },
|
||||
{ '<leader>fw', ':Seeker grep_word<CR>', mode = { 'n', 'x' }, desc = 'Seek Grep Word' },
|
||||
},
|
||||
opts = {
|
||||
picker_provider = "snacks",
|
||||
-- toggle_key = "<C-e>", -- Key to toggle between seeker modes (default)
|
||||
picker_opts = {
|
||||
focus = "list", -- Customize options passed to the snacks picker
|
||||
-- toggle_key = "<C-e>", -- Key to toggle between seeker modes (default)
|
||||
picker_opts = {
|
||||
focus = "list", -- Customize options passed to the snacks picker
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
27
lua/plugins/tree.lua
Normal file
27
lua/plugins/tree.lua
Normal file
@@ -0,0 +1,27 @@
|
||||
return {
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons"
|
||||
},
|
||||
config = function()
|
||||
local config = {
|
||||
hijack_cursor = true,
|
||||
sort = {
|
||||
sorter = "modification_time",
|
||||
},
|
||||
view = {
|
||||
width = 30,
|
||||
},
|
||||
renderer = {
|
||||
group_empty = true,
|
||||
},
|
||||
filters = {
|
||||
dotfiles = false,
|
||||
},
|
||||
filesystem_watchers = {
|
||||
enable = true
|
||||
}
|
||||
}
|
||||
require("nvim-tree").setup(config)
|
||||
end
|
||||
}
|
||||
5
lua/plugins/treesitter.lua
Normal file
5
lua/plugins/treesitter.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
return {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
lazy = false,
|
||||
build = ':TSUpdate'
|
||||
}
|
||||
34
lua/plugins/ufo.lua
Normal file
34
lua/plugins/ufo.lua
Normal file
@@ -0,0 +1,34 @@
|
||||
return {
|
||||
"kevinhwang91/nvim-ufo",
|
||||
version = false, -- last release is way too old
|
||||
dependencies = {
|
||||
"kevinhwang91/promise-async",
|
||||
},
|
||||
config = function()
|
||||
vim.o.foldcolumn = '1' -- '0' is not bad
|
||||
vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
|
||||
vim.o.foldlevelstart = 99
|
||||
vim.o.foldenable = true
|
||||
|
||||
-- Using ufo provider need remap `zR` and `zM`. If Neovim is 0.6.1, remap yourself
|
||||
vim.keymap.set('n', 'zR', require('ufo').openAllFolds)
|
||||
vim.keymap.set('n', 'zM', require('ufo').closeAllFolds)
|
||||
|
||||
-- Option 2: nvim lsp as LSP client
|
||||
-- Tell the server the capability of foldingRange,
|
||||
-- Neovim hasn't added foldingRange to default capabilities, users must add it manually
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities.textDocument.foldingRange = {
|
||||
dynamicRegistration = false,
|
||||
lineFoldingOnly = true
|
||||
}
|
||||
local language_servers = vim.lsp.get_clients() -- or list servers manually like {'gopls', 'clangd'}
|
||||
for _, ls in ipairs(language_servers) do
|
||||
require('lspconfig')[ls].setup({
|
||||
capabilities = capabilities
|
||||
-- you can add other fields for setting up lsp server in this table
|
||||
})
|
||||
end
|
||||
require('ufo').setup()
|
||||
end
|
||||
}
|
||||
16
lua/plugins/vimtex.lua
Normal file
16
lua/plugins/vimtex.lua
Normal file
@@ -0,0 +1,16 @@
|
||||
return {
|
||||
"lervag/vimtex",
|
||||
lazy = false, -- we don't want to lazy load VimTeX
|
||||
-- tag = "v2.15", -- uncomment to pin to a specific release
|
||||
init = function()
|
||||
-- VimTeX configuration goes here, e.g.
|
||||
vim.g.vimtex_compiler_latexmk = {
|
||||
options = {
|
||||
'-pdf',
|
||||
'-synctex=1',
|
||||
'-interaction=nonstopmode',
|
||||
},
|
||||
}
|
||||
vim.g.vimtex_view_method = 'zathura'
|
||||
end
|
||||
}
|
||||
Reference in New Issue
Block a user