update config for coc

This commit is contained in:
jonathan santis 2025-03-14 14:05:53 +01:00
parent 0a1941bc10
commit a2d1257002

View File

@ -1,5 +1,4 @@
#require 'lspconfig'.clangd.setup{}
-- require 'lspconfig'.clangd.setup{}
vim.g.zig_fmt_autosave = 0
vim.cmd("set number")
vim.cmd("set tabstop=4")
@ -9,18 +8,17 @@ vim.cmd("set shiftwidth=4")
vim.cmd("set ttyfast")
vim.cmd("let mapleader=','")
vim.cmd("set makeprg=zig\\ run\\ %<.zig")
local vim = vim
local Plug = vim.fn['plug#']
vim.call('plug#begin')
Plug('neovim/nvim-lspconfig') -- https://github.com/neovim/nvim-lspconfig
Plug('ziglang/zig.vim') -- https://github.com/ziglang/zig.vim
Plug('ray-x/lsp_signature.nvim')
Plug('nvim-lua/plenary.nvim')
Plug('nvim-telescope/telescope.nvim')
vim.call('plug#end')
Plug('neoclide/coc.nvim',{branch = 'release'})
vim.call('plug#end')
require 'lspconfig'.zls.setup{}
@ -87,3 +85,24 @@ vim.keymap.set('n', '<leader>fr', builtin.lsp_references, { desc = 'Telescope li
vim.keymap.set('n', '<leader>fs', builtin.lsp_document_symbols, { desc = 'Telescope list all document symbols' })
vim.keymap.set('n', '<leader>fd', builtin.lsp_definitions, { desc = 'Telescope defintions under cursor' })
vim.keymap.set('n', '<leader>ft', builtin.lsp_type_definitions, { desc = 'Telescope definition of type under cursor' })
vim.cmd("autocmd FileType python map <buffer> <F9> :w<CR>:exec '!python' shellescape(@%, 1)<CR>")
vim.cmd("colorscheme desert")
-- config for coc autocompletion
vim.api.nvim_set_keymap('n','gd',"<Plug>(coc-definition)",{silent=true})
vim.api.nvim_set_keymap('n','gy',"<Plug>(coc-type-definition)",{silent=true})
vim.api.nvim_set_keymap('n','gr',"<Plug>(coc-reference)",{silent=true})
vim.api.nvim_set_keymap('n','[g',"<Plug>(coc-diagnostic-prev)",{silent=true})
vim.api.nvim_set_keymap('n',']g',"<Plug>(coc-diagnostic-next)",{silent=true})
vim.api.nvim_set_keymap('n','<space>s',":<C-u>CocList -I symbols<cr>",{noremap=true,silent=true})
vim.api.nvim_set_keymap('n','<space>d',":<C-u>CocList diagnostics<cr>",{noremap=true,silent=true})
vim.api.nvim_set_keymap('n','<leader>do',"<Plug>(coc-codeaction)",{silent=true})
vim.api.nvim_set_keymap('n','<leader>rn',"<Plug>(coc-rename)",{silent=true})
-- equivalent to let
vim.g.coc_global_extensions = {"coc-tsserver","coc-json","coc-css","coc-eslint","coc-prettier","coc-java","coc-html","coc-htmldjango","coc-pyright"}
vim.api.nvim_set_keymap('i','<cr>',"coc#pum#visible() ? coc#pum#confirm() : \"\\<cr>\"",{expr=true,silent=true})