feat(nvim): add coc
This commit is contained in:
parent
46a309f25e
commit
499c4553cc
7
.config/nvim/coc-settings.json
Normal file
7
.config/nvim/coc-settings.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
"languageserver": {
|
||||||
|
"clangd": {
|
||||||
|
"command": "clangd",
|
||||||
|
"rootPatterns": ["compile_flags.txt", "compile_commands.json"],
|
||||||
|
"filetypes": ["c", "cc", "cpp", "c++", "objc", "objcpp"]
|
||||||
|
}
|
||||||
|
}
|
8
.config/nvim/init.lua
Normal file → Executable file
8
.config/nvim/init.lua
Normal file → Executable file
@ -6,7 +6,13 @@ vim.o.softtabstop = 4
|
|||||||
vim.o.shiftwidth = 4
|
vim.o.shiftwidth = 4
|
||||||
vim.o.expandtab = true
|
vim.o.expandtab = true
|
||||||
vim.o.smartindent = true
|
vim.o.smartindent = true
|
||||||
vim.o.autoread = true
|
|
||||||
|
-- Sync clipboard between OS and Neovim.
|
||||||
|
-- See `:help 'clipboard'`
|
||||||
|
vim.o.clipboard = 'unnamedplus'
|
||||||
|
|
||||||
|
-- Save undo history
|
||||||
|
vim.o.undofile = true
|
||||||
|
|
||||||
--vim.keymap.set({"n", "v", "i"}, "<leader><leader>", "<Esc>", {noremap = true})
|
--vim.keymap.set({"n", "v", "i"}, "<leader><leader>", "<Esc>", {noremap = true})
|
||||||
|
|
||||||
|
@ -3,10 +3,11 @@ return require('packer').startup(function()
|
|||||||
use 'sonph/onehalf'
|
use 'sonph/onehalf'
|
||||||
use 'navarasu/onedark.nvim'
|
use 'navarasu/onedark.nvim'
|
||||||
use {
|
use {
|
||||||
'nvim-telescope/telescope.nvim', tag = '0.1.1',
|
'nvim-telescope/telescope.nvim', tag = '0.1.4',
|
||||||
-- or , branch = '0.1.x',
|
-- or , branch = '0.1.x',
|
||||||
requires = { {'nvim-lua/plenary.nvim'} }
|
requires = { {'nvim-lua/plenary.nvim'} }
|
||||||
}
|
}
|
||||||
|
|
||||||
require('onedark').setup {
|
require('onedark').setup {
|
||||||
style = 'darker'
|
style = 'darker'
|
||||||
}
|
}
|
||||||
@ -18,24 +19,38 @@ return require('packer').startup(function()
|
|||||||
-- vim.cmd('colorscheme rose-pine')
|
-- vim.cmd('colorscheme rose-pine')
|
||||||
-- end
|
-- end
|
||||||
-- })
|
-- })
|
||||||
use('nvim-treesitter/nvim-treesitter', {run = ':TSUpdate'})
|
|
||||||
use {
|
|
||||||
'VonHeikemen/lsp-zero.nvim',
|
|
||||||
branch = 'v2.x',
|
|
||||||
requires = {
|
|
||||||
-- LSP Support
|
|
||||||
{'neovim/nvim-lspconfig'},
|
|
||||||
{'williamboman/mason.nvim', run = function()
|
|
||||||
pcall(vim.cmd, 'MasonUpdate')
|
|
||||||
end,},
|
|
||||||
{'williamboman/mason-lspconfig.nvim'}, -- Optional
|
|
||||||
|
|
||||||
-- Autocompletion
|
use {
|
||||||
{'hrsh7th/nvim-cmp'}, -- Required
|
"williamboman/mason.nvim",
|
||||||
{'hrsh7th/cmp-nvim-lsp'}, -- Required
|
"williamboman/mason-lspconfig.nvim",
|
||||||
{'L3MON4D3/LuaSnip'}, -- Required
|
'neovim/nvim-lspconfig'
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
use 'hrsh7th/nvim-cmp' -- Autocompletion plugin
|
||||||
|
use 'hrsh7th/cmp-nvim-lsp' -- Autocompletion with LSPs
|
||||||
|
use 'hrsh7th/cmp-buffer'
|
||||||
|
use 'hrsh7th/cmp-path'
|
||||||
|
|
||||||
|
use {'neoclide/coc.nvim', branch = 'release'}
|
||||||
|
|
||||||
|
use('nvim-treesitter/nvim-treesitter', {run = ':TSUpdate'})
|
||||||
|
|
||||||
|
--use {
|
||||||
|
-- 'VonHeikemen/lsp-zero.nvim',
|
||||||
|
-- branch = 'v2.x',
|
||||||
|
-- requires = {
|
||||||
|
-- -- LSP Support
|
||||||
|
-- {'neovim/nvim-lspconfig'},
|
||||||
|
-- {'williamboman/mason.nvim', run = function()
|
||||||
|
-- pcall(vim.cmd, 'MasonUpdate')
|
||||||
|
-- end,},
|
||||||
|
-- {'williamboman/mason-lspconfig.nvim'}, -- Optional
|
||||||
|
|
||||||
|
-- -- Autocompletion
|
||||||
|
-- {'hrsh7th/nvim-cmp'}, -- Required
|
||||||
|
-- {'hrsh7th/cmp-nvim-lsp'}, -- Required
|
||||||
|
-- {'L3MON4D3/LuaSnip'}, -- Required
|
||||||
|
-- }
|
||||||
|
--}
|
||||||
|
|
||||||
-- Auto pairs
|
-- Auto pairs
|
||||||
use {
|
use {
|
||||||
@ -45,4 +60,34 @@ return require('packer').startup(function()
|
|||||||
|
|
||||||
--harpoon
|
--harpoon
|
||||||
use("theprimeagen/harpoon")
|
use("theprimeagen/harpoon")
|
||||||
|
|
||||||
|
---- neogen
|
||||||
|
--local i = require("neogen.types.template").item
|
||||||
|
--local annotation = {
|
||||||
|
-- { nil, "/**", { no_results = true, type = { "func", "file", "class" } } },
|
||||||
|
-- { nil, "** \\file", { no_results = true, type = { "file" } } },
|
||||||
|
-- { nil, "** \\brief $1", { no_results = true, type = { "func", "file", "class" } } },
|
||||||
|
-- { nil, "*/", { no_results = true, type = { "func", "file", "class" } } },
|
||||||
|
-- { nil, "", { no_results = true, type = { "file" } } },
|
||||||
|
|
||||||
|
-- { nil, "/**", { type = { "func", "class", "type" } } },
|
||||||
|
-- { i.ClassName, "** @class %s", { type = { "class" } } },
|
||||||
|
-- { i.Type, "** @typedef %s", { type = { "type" } } },
|
||||||
|
-- { nil, "** \\brief $1", { type = { "func", "class", "type" } } },
|
||||||
|
-- { nil, "**", { type = { "func", "class", "type" } } },
|
||||||
|
-- { i.Tparam, "** \\tparam %s $1" },
|
||||||
|
-- { i.Parameter, "** \\param %s $1" },
|
||||||
|
-- { i.Return, "** \\return $1" },
|
||||||
|
-- { nil, "*/", { type = { "func", "class", "type" } } },
|
||||||
|
--}
|
||||||
|
--require("neogen").setup({
|
||||||
|
-- languages = {
|
||||||
|
-- c = {
|
||||||
|
-- template = {
|
||||||
|
-- annotation_convention = "my_annotation",
|
||||||
|
-- my_annotation = annotation
|
||||||
|
-- }
|
||||||
|
-- }
|
||||||
|
-- }
|
||||||
|
--})
|
||||||
end)
|
end)
|
||||||
|
184
.config/nvim/plugin/coc.lua
Normal file
184
.config/nvim/plugin/coc.lua
Normal file
@ -0,0 +1,184 @@
|
|||||||
|
-- Some servers have issues with backup files, see #649
|
||||||
|
vim.opt.backup = false
|
||||||
|
vim.opt.writebackup = false
|
||||||
|
|
||||||
|
-- Having longer updatetime (default is 4000 ms = 4s) leads to noticeable
|
||||||
|
-- delays and poor user experience
|
||||||
|
vim.opt.updatetime = 300
|
||||||
|
|
||||||
|
-- Always show the signcolumn, otherwise it would shift the text each time
|
||||||
|
-- diagnostics appeared/became resolved
|
||||||
|
vim.opt.signcolumn = "yes"
|
||||||
|
|
||||||
|
local keyset = vim.keymap.set
|
||||||
|
-- Autocomplete
|
||||||
|
function _G.check_back_space()
|
||||||
|
local col = vim.fn.col('.') - 1
|
||||||
|
return col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') ~= nil
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Use Tab for trigger completion with characters ahead and navigate
|
||||||
|
-- NOTE: There's always a completion item selected by default, you may want to enable
|
||||||
|
-- no select by setting `"suggest.noselect": true` in your configuration file
|
||||||
|
-- NOTE: Use command ':verbose imap <tab>' to make sure Tab is not mapped by
|
||||||
|
-- other plugins before putting this into your config
|
||||||
|
local opts = {silent = true, noremap = true, expr = true, replace_keycodes = false}
|
||||||
|
keyset("i", "<TAB>", 'coc#pum#visible() ? coc#pum#next(1) : v:lua.check_back_space() ? "<TAB>" : coc#refresh()', opts)
|
||||||
|
keyset("i", "<S-TAB>", [[coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"]], opts)
|
||||||
|
|
||||||
|
-- Make <CR> to accept selected completion item or notify coc.nvim to format
|
||||||
|
-- <C-g>u breaks current undo, please make your own choice
|
||||||
|
keyset("i", "<cr>", [[coc#pum#visible() ? coc#pum#confirm() : "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"]], opts)
|
||||||
|
|
||||||
|
-- Use <c-j> to trigger snippets
|
||||||
|
keyset("i", "<c-j>", "<Plug>(coc-snippets-expand-jump)")
|
||||||
|
-- Use <c-space> to trigger completion
|
||||||
|
keyset("i", "<c-space>", "coc#refresh()", {silent = true, expr = true})
|
||||||
|
|
||||||
|
-- Use `[g` and `]g` to navigate diagnostics
|
||||||
|
-- Use `:CocDiagnostics` to get all diagnostics of current buffer in location list
|
||||||
|
keyset("n", "[g", "<Plug>(coc-diagnostic-prev)", {silent = true})
|
||||||
|
keyset("n", "]g", "<Plug>(coc-diagnostic-next)", {silent = true})
|
||||||
|
|
||||||
|
-- GoTo code navigation
|
||||||
|
keyset("n", "gd", "<Plug>(coc-definition)", {silent = true})
|
||||||
|
keyset("n", "gy", "<Plug>(coc-type-definition)", {silent = true})
|
||||||
|
keyset("n", "gi", "<Plug>(coc-implementation)", {silent = true})
|
||||||
|
keyset("n", "gr", "<Plug>(coc-references)", {silent = true})
|
||||||
|
|
||||||
|
|
||||||
|
-- Use K to show documentation in preview window
|
||||||
|
function _G.show_docs()
|
||||||
|
local cw = vim.fn.expand('<cword>')
|
||||||
|
if vim.fn.index({'vim', 'help'}, vim.bo.filetype) >= 0 then
|
||||||
|
vim.api.nvim_command('h ' .. cw)
|
||||||
|
elseif vim.api.nvim_eval('coc#rpc#ready()') then
|
||||||
|
vim.fn.CocActionAsync('doHover')
|
||||||
|
else
|
||||||
|
vim.api.nvim_command('!' .. vim.o.keywordprg .. ' ' .. cw)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
keyset("n", "K", '<CMD>lua _G.show_docs()<CR>', {silent = true})
|
||||||
|
|
||||||
|
|
||||||
|
-- Highlight the symbol and its references on a CursorHold event(cursor is idle)
|
||||||
|
vim.api.nvim_create_augroup("CocGroup", {})
|
||||||
|
vim.api.nvim_create_autocmd("CursorHold", {
|
||||||
|
group = "CocGroup",
|
||||||
|
command = "silent call CocActionAsync('highlight')",
|
||||||
|
desc = "Highlight symbol under cursor on CursorHold"
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
-- Symbol renaming
|
||||||
|
keyset("n", "<leader>rn", "<Plug>(coc-rename)", {silent = true})
|
||||||
|
|
||||||
|
|
||||||
|
-- Formatting selected code
|
||||||
|
keyset("x", "<leader>f", "<Plug>(coc-format-selected)", {silent = true})
|
||||||
|
keyset("n", "<leader>f", "<Plug>(coc-format-selected)", {silent = true})
|
||||||
|
|
||||||
|
|
||||||
|
-- Setup formatexpr specified filetype(s)
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
group = "CocGroup",
|
||||||
|
pattern = "typescript,json",
|
||||||
|
command = "setl formatexpr=CocAction('formatSelected')",
|
||||||
|
desc = "Setup formatexpr specified filetype(s)."
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Update signature help on jump placeholder
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
group = "CocGroup",
|
||||||
|
pattern = "CocJumpPlaceholder",
|
||||||
|
command = "call CocActionAsync('showSignatureHelp')",
|
||||||
|
desc = "Update signature help on jump placeholder"
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Apply codeAction to the selected region
|
||||||
|
-- Example: `<leader>aap` for current paragraph
|
||||||
|
local opts = {silent = true, nowait = true}
|
||||||
|
keyset("x", "<leader>a", "<Plug>(coc-codeaction-selected)", opts)
|
||||||
|
keyset("n", "<leader>a", "<Plug>(coc-codeaction-selected)", opts)
|
||||||
|
|
||||||
|
-- Remap keys for apply code actions at the cursor position.
|
||||||
|
keyset("n", "<leader>ac", "<Plug>(coc-codeaction-cursor)", opts)
|
||||||
|
-- Remap keys for apply source code actions for current file.
|
||||||
|
keyset("n", "<leader>as", "<Plug>(coc-codeaction-source)", opts)
|
||||||
|
-- Apply the most preferred quickfix action on the current line.
|
||||||
|
keyset("n", "<leader>qf", "<Plug>(coc-fix-current)", opts)
|
||||||
|
|
||||||
|
-- Remap keys for apply refactor code actions.
|
||||||
|
keyset("n", "<leader>re", "<Plug>(coc-codeaction-refactor)", { silent = true })
|
||||||
|
keyset("x", "<leader>r", "<Plug>(coc-codeaction-refactor-selected)", { silent = true })
|
||||||
|
keyset("n", "<leader>r", "<Plug>(coc-codeaction-refactor-selected)", { silent = true })
|
||||||
|
|
||||||
|
-- Run the Code Lens actions on the current line
|
||||||
|
keyset("n", "<leader>cl", "<Plug>(coc-codelens-action)", opts)
|
||||||
|
|
||||||
|
|
||||||
|
-- Map function and class text objects
|
||||||
|
-- NOTE: Requires 'textDocument.documentSymbol' support from the language server
|
||||||
|
keyset("x", "if", "<Plug>(coc-funcobj-i)", opts)
|
||||||
|
keyset("o", "if", "<Plug>(coc-funcobj-i)", opts)
|
||||||
|
keyset("x", "af", "<Plug>(coc-funcobj-a)", opts)
|
||||||
|
keyset("o", "af", "<Plug>(coc-funcobj-a)", opts)
|
||||||
|
keyset("x", "ic", "<Plug>(coc-classobj-i)", opts)
|
||||||
|
keyset("o", "ic", "<Plug>(coc-classobj-i)", opts)
|
||||||
|
keyset("x", "ac", "<Plug>(coc-classobj-a)", opts)
|
||||||
|
keyset("o", "ac", "<Plug>(coc-classobj-a)", opts)
|
||||||
|
|
||||||
|
|
||||||
|
-- Remap <C-f> and <C-b> to scroll float windows/popups
|
||||||
|
---@diagnostic disable-next-line: redefined-local
|
||||||
|
local opts = {silent = true, nowait = true, expr = true}
|
||||||
|
keyset("n", "<C-f>", 'coc#float#has_scroll() ? coc#float#scroll(1) : "<C-f>"', opts)
|
||||||
|
keyset("n", "<C-b>", 'coc#float#has_scroll() ? coc#float#scroll(0) : "<C-b>"', opts)
|
||||||
|
keyset("i", "<C-f>",
|
||||||
|
'coc#float#has_scroll() ? "<c-r>=coc#float#scroll(1)<cr>" : "<Right>"', opts)
|
||||||
|
keyset("i", "<C-b>",
|
||||||
|
'coc#float#has_scroll() ? "<c-r>=coc#float#scroll(0)<cr>" : "<Left>"', opts)
|
||||||
|
keyset("v", "<C-f>", 'coc#float#has_scroll() ? coc#float#scroll(1) : "<C-f>"', opts)
|
||||||
|
keyset("v", "<C-b>", 'coc#float#has_scroll() ? coc#float#scroll(0) : "<C-b>"', opts)
|
||||||
|
|
||||||
|
|
||||||
|
-- Use CTRL-S for selections ranges
|
||||||
|
-- Requires 'textDocument/selectionRange' support of language server
|
||||||
|
keyset("n", "<C-s>", "<Plug>(coc-range-select)", {silent = true})
|
||||||
|
keyset("x", "<C-s>", "<Plug>(coc-range-select)", {silent = true})
|
||||||
|
|
||||||
|
|
||||||
|
-- Add `:Format` command to format current buffer
|
||||||
|
vim.api.nvim_create_user_command("Format", "call CocAction('format')", {})
|
||||||
|
|
||||||
|
-- " Add `:Fold` command to fold current buffer
|
||||||
|
vim.api.nvim_create_user_command("Fold", "call CocAction('fold', <f-args>)", {nargs = '?'})
|
||||||
|
|
||||||
|
-- Add `:OR` command for organize imports of the current buffer
|
||||||
|
vim.api.nvim_create_user_command("OR", "call CocActionAsync('runCommand', 'editor.action.organizeImport')", {})
|
||||||
|
|
||||||
|
-- Add (Neo)Vim's native statusline support
|
||||||
|
-- NOTE: Please see `:h coc-status` for integrations with external plugins that
|
||||||
|
-- provide custom statusline: lightline.vim, vim-airline
|
||||||
|
vim.opt.statusline:prepend("%{coc#status()}%{get(b:,'coc_current_function','')}")
|
||||||
|
|
||||||
|
-- Mappings for CoCList
|
||||||
|
-- code actions and coc stuff
|
||||||
|
---@diagnostic disable-next-line: redefined-local
|
||||||
|
local opts = {silent = true, nowait = true}
|
||||||
|
-- Show all diagnostics
|
||||||
|
keyset("n", "<space>a", ":<C-u>CocList diagnostics<cr>", opts)
|
||||||
|
-- Manage extensions
|
||||||
|
keyset("n", "<space>e", ":<C-u>CocList extensions<cr>", opts)
|
||||||
|
-- Show commands
|
||||||
|
keyset("n", "<space>c", ":<C-u>CocList commands<cr>", opts)
|
||||||
|
-- Find symbol of current document
|
||||||
|
keyset("n", "<space>o", ":<C-u>CocList outline<cr>", opts)
|
||||||
|
-- Search workspace symbols
|
||||||
|
keyset("n", "<space>s", ":<C-u>CocList -I symbols<cr>", opts)
|
||||||
|
-- Do default action for next item
|
||||||
|
keyset("n", "<space>j", ":<C-u>CocNext<cr>", opts)
|
||||||
|
-- Do default action for previous item
|
||||||
|
keyset("n", "<space>k", ":<C-u>CocPrev<cr>", opts)
|
||||||
|
-- Resume latest coc list
|
||||||
|
keyset("n", "<space>p", ":<C-u>CocListResume<cr>", opts)
|
@ -1,13 +1,117 @@
|
|||||||
local lsp = require('lsp-zero').preset({})
|
-- Initialize Mason and specify which language servers to install
|
||||||
|
--require("mason").setup()
|
||||||
|
--require("mason-lspconfig").setup({
|
||||||
|
-- ensured_installed = { "rust_analyzer" }
|
||||||
|
--})
|
||||||
|
--
|
||||||
|
---- Define lspconfig settings for rust_analyzer
|
||||||
|
--local on_attach = function(_, _)
|
||||||
|
-- local opts = { buffer = bufnr, remap = false }
|
||||||
|
-- vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
||||||
|
--end
|
||||||
|
--
|
||||||
|
--local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||||
|
--
|
||||||
|
---- Configure autocomplete using nvim-cmp
|
||||||
|
--local cmp = require("cmp")
|
||||||
|
--cmp.setup({
|
||||||
|
-- mapping = {
|
||||||
|
-- ["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||||
|
-- ["<C-n>"] = cmp.mapping.select_next_item(),
|
||||||
|
-- ["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||||
|
-- ["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||||
|
-- ["<C-Space>"] = cmp.mapping.complete(),
|
||||||
|
-- ["<C-y>"] = cmp.mapping.confirm({ select = true }),
|
||||||
|
-- ["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||||
|
-- },
|
||||||
|
-- sources = {
|
||||||
|
-- { name = 'nvim_lsp' },
|
||||||
|
-- { name = 'buffer' },
|
||||||
|
-- { name = 'path' },
|
||||||
|
-- },
|
||||||
|
-- experimental = { ghost_text = false },
|
||||||
|
-- formatting = { fields = { 'menu', 'abbr', 'kind' } },
|
||||||
|
-- confirm_opts = { behavior = cmp.ConfirmBehavior.Replace, select = false },
|
||||||
|
-- window = {
|
||||||
|
-- --completion = cmp.config.window.bordered(),
|
||||||
|
-- --documentation = cmp.config.window.bordered(),
|
||||||
|
-- },
|
||||||
|
-- capabilities = capabilities,
|
||||||
|
--})
|
||||||
|
--
|
||||||
|
---- Set up Rust Analyzer
|
||||||
|
--local lspconfig = require('lspconfig')
|
||||||
|
--lspconfig.rust_analyzer.setup {
|
||||||
|
-- capabilities = capabilities,
|
||||||
|
-- on_attach = on_attach
|
||||||
|
--}
|
||||||
|
--vim.keymap.set('n', '<space>e', vim.diagnostic.open_float)
|
||||||
|
--vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
|
||||||
|
--vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
|
||||||
|
---- vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist)
|
||||||
|
|
||||||
lsp.on_attach(function(client, bufnr)
|
|
||||||
local opts = {buffer = bufnr, remap = false}
|
|
||||||
|
|
||||||
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
-- old
|
||||||
end)
|
--require("mason").setup()
|
||||||
|
--require("mason-lspconfig").setup({
|
||||||
|
-- ensure_installed = { "rust_analyzer" }
|
||||||
|
--})
|
||||||
|
--
|
||||||
|
--local on_attach = function(_, _)
|
||||||
|
-- local opts = {buffer = bufnr, remap = false}
|
||||||
|
-- vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
||||||
|
--end
|
||||||
|
--
|
||||||
|
--local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||||
|
--require("configs.nvim-cmp")
|
||||||
|
--require('nvim-cmp').setup{}
|
||||||
|
--require('cmp').setup({
|
||||||
|
-- mapping = {
|
||||||
|
-- ['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||||
|
-- ['<C-n>'] = cmp.mapping.select_next_item(),
|
||||||
|
-- ['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||||
|
-- ['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||||
|
-- ['<C-Space>'] = cmp.mapping.complete(),
|
||||||
|
-- ['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||||
|
-- },
|
||||||
|
-- sources = {
|
||||||
|
-- { name = 'nvim_lsp' },
|
||||||
|
-- { name = 'buffer' },
|
||||||
|
-- { name = 'path' },
|
||||||
|
-- },
|
||||||
|
-- experimental = { ghost_text = false },
|
||||||
|
-- formatting = { fields = { 'menu', 'abbr', 'kind' } },
|
||||||
|
-- confirm_opts = { behavior = cmp.ConfirmBehavior.Replace, select = false },
|
||||||
|
-- window = {
|
||||||
|
-- completion = cmp.config.window.bordered(),
|
||||||
|
-- documentation = cmp.config.window.bordered(),
|
||||||
|
-- },
|
||||||
|
-- capabilities = capabilities,
|
||||||
|
--})
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--require("lspconfig").rust_analyzer.setup {
|
||||||
|
-- capabilities = capabilities
|
||||||
|
-- on_attach = on_attach
|
||||||
|
--}
|
||||||
|
|
||||||
lsp.ensure_installed({
|
--local lsp = require('lsp-zero').preset({})
|
||||||
'tsserver',
|
--
|
||||||
'eslint',
|
-- lsp.on_attach(function(client, bufnr)
|
||||||
})
|
-- local opts = {buffer = bufnr, remap = false}
|
||||||
lsp.setup()
|
--
|
||||||
|
-- vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
||||||
|
-- end)
|
||||||
|
--
|
||||||
|
----lsp['rust_analyzer'].setup({
|
||||||
|
---- capabilities = capabilities,
|
||||||
|
---- on_attach = on_attach
|
||||||
|
----})
|
||||||
|
--
|
||||||
|
--lsp.ensure_installed({
|
||||||
|
-- 'tsserver',
|
||||||
|
-- 'eslint',
|
||||||
|
-- 'rust_analyzer'
|
||||||
|
--})
|
||||||
|
--lsp.setup()
|
||||||
|
----lsp.rust_analyzer.setup()
|
||||||
|
5
.config/nvim/plugin/neogen.lua
Executable file
5
.config/nvim/plugin/neogen.lua
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
--require('neogen').generate()
|
||||||
|
--local opts = { noremap = true, silent = true }
|
||||||
|
--
|
||||||
|
--vim.api.nvim_set_keymap("n", "<Leader>nf", ":lua require('neogen').generate()<CR>", opts)
|
||||||
|
|
@ -49,8 +49,8 @@ local function save_profiles(threshold)
|
|||||||
end
|
end
|
||||||
|
|
||||||
time([[Luarocks path setup]], true)
|
time([[Luarocks path setup]], true)
|
||||||
local package_path_str = "/home/grimhilt/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/grimhilt/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/grimhilt/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/grimhilt/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
|
local package_path_str = "/home/grimhilt/.cache/nvim/packer_hererocks/2.1.1693350652/share/lua/5.1/?.lua;/home/grimhilt/.cache/nvim/packer_hererocks/2.1.1693350652/share/lua/5.1/?/init.lua;/home/grimhilt/.cache/nvim/packer_hererocks/2.1.1693350652/lib/luarocks/rocks-5.1/?.lua;/home/grimhilt/.cache/nvim/packer_hererocks/2.1.1693350652/lib/luarocks/rocks-5.1/?/init.lua"
|
||||||
local install_cpath_pattern = "/home/grimhilt/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so"
|
local install_cpath_pattern = "/home/grimhilt/.cache/nvim/packer_hererocks/2.1.1693350652/lib/lua/5.1/?.so"
|
||||||
if not string.find(package.path, package_path_str, 1, true) then
|
if not string.find(package.path, package_path_str, 1, true) then
|
||||||
package.path = package.path .. ';' .. package_path_str
|
package.path = package.path .. ';' .. package_path_str
|
||||||
end
|
end
|
||||||
@ -74,26 +74,31 @@ end
|
|||||||
time([[try_loadstring definition]], false)
|
time([[try_loadstring definition]], false)
|
||||||
time([[Defining packer_plugins]], true)
|
time([[Defining packer_plugins]], true)
|
||||||
_G.packer_plugins = {
|
_G.packer_plugins = {
|
||||||
LuaSnip = {
|
["cmp-buffer"] = {
|
||||||
loaded = true,
|
loaded = true,
|
||||||
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/LuaSnip",
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/cmp-buffer",
|
||||||
url = "https://github.com/L3MON4D3/LuaSnip"
|
url = "https://github.com/hrsh7th/cmp-buffer"
|
||||||
},
|
},
|
||||||
["cmp-nvim-lsp"] = {
|
["cmp-nvim-lsp"] = {
|
||||||
loaded = true,
|
loaded = true,
|
||||||
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
|
||||||
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
|
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
|
||||||
},
|
},
|
||||||
|
["cmp-path"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/cmp-path",
|
||||||
|
url = "https://github.com/hrsh7th/cmp-path"
|
||||||
|
},
|
||||||
|
["coc.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/coc.nvim",
|
||||||
|
url = "https://github.com/neoclide/coc.nvim"
|
||||||
|
},
|
||||||
harpoon = {
|
harpoon = {
|
||||||
loaded = true,
|
loaded = true,
|
||||||
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/harpoon",
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/harpoon",
|
||||||
url = "https://github.com/theprimeagen/harpoon"
|
url = "https://github.com/theprimeagen/harpoon"
|
||||||
},
|
},
|
||||||
["lsp-zero.nvim"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/lsp-zero.nvim",
|
|
||||||
url = "https://github.com/VonHeikemen/lsp-zero.nvim"
|
|
||||||
},
|
|
||||||
["mason-lspconfig.nvim"] = {
|
["mason-lspconfig.nvim"] = {
|
||||||
loaded = true,
|
loaded = true,
|
||||||
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim",
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim",
|
||||||
|
Loading…
Reference in New Issue
Block a user