finally nvim lsp workin!
This commit is contained in:
parent
601be3a2ff
commit
7e32c663ac
7
init.lua
7
init.lua
@ -7,6 +7,11 @@ require('nvimTree.lua')
|
|||||||
require('bufferline.lua')
|
require('bufferline.lua')
|
||||||
require('statusline.lua')
|
require('statusline.lua')
|
||||||
|
|
||||||
|
-- lsp
|
||||||
|
require('nvim-lspconfig.lua')
|
||||||
|
require('nvim-compe.lua')
|
||||||
|
require('coc.lua')
|
||||||
|
|
||||||
require('gitsigns.lua')
|
require('gitsigns.lua')
|
||||||
|
|
||||||
require'colorizer'.setup()
|
require'colorizer'.setup()
|
||||||
@ -39,3 +44,5 @@ cmd("hi EndOfBuffer guifg=#282c34")
|
|||||||
-- tree folder name , icon color
|
-- tree folder name , icon color
|
||||||
cmd("highlight NvimTreeFolderIcon guifg = #61afef")
|
cmd("highlight NvimTreeFolderIcon guifg = #61afef")
|
||||||
cmd("highlight NvimTreeFolderName guifg = #61afef")
|
cmd("highlight NvimTreeFolderName guifg = #61afef")
|
||||||
|
|
||||||
|
require('nvim-autopairs').setup()
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
vim.api.nvim_exec([[
|
|
||||||
|
|
||||||
set fillchars=eob:\
|
|
||||||
|
|
||||||
tnoremap <Esc> <C-\><C-n>
|
|
||||||
" start terminal in insert mode
|
|
||||||
au BufEnter * if &buftype == 'terminal' | :startinsert | endif
|
|
||||||
|
|
||||||
" open terminal on the bottom
|
|
||||||
function! OpenTerminal()
|
|
||||||
split term://bash
|
|
||||||
resize 10
|
|
||||||
endfunction
|
|
||||||
nnoremap <c-x> :call OpenTerminal()<CR>
|
|
||||||
nnoremap <c-b> :vnew term://bash<CR>
|
|
||||||
|
|
||||||
set ignorecase
|
|
||||||
set noswapfile
|
|
||||||
set title
|
|
||||||
set shortmess+=c
|
|
||||||
set updatetime=250 "for gitsigns"
|
|
||||||
|
|
||||||
" new tab and switching between em
|
|
||||||
|
|
||||||
nnoremap <c-e> : tabnew<CR>
|
|
||||||
nnoremap <c-w> : tabp <CR>
|
|
||||||
nnoremap <c-u> : tabn <CR>
|
|
||||||
|
|
||||||
map <C-k> <C-w>k
|
|
||||||
map <C-j> <C-w>j
|
|
||||||
map <C-l> <C-w>l
|
|
||||||
map <C-h> <C-w>h
|
|
||||||
|
|
||||||
inoremap kk <ESC>
|
|
||||||
|
|
||||||
let g:indentLine_enabled = 3
|
|
||||||
let g:indentLine_char_list = ['▏']
|
|
||||||
|
|
||||||
norm! gg=G
|
|
||||||
|
|
||||||
set expandtab sw=2
|
|
||||||
|
|
||||||
]])
|
|
49
lua/nvim-compe/lua.lua
Normal file
49
lua/nvim-compe/lua.lua
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
vim.cmd [[packadd nvim-lspconfig]]
|
||||||
|
vim.cmd [[packadd nvim-compe]]
|
||||||
|
|
||||||
|
vim.o.completeopt = "menuone,noselect"
|
||||||
|
|
||||||
|
require'compe'.setup {
|
||||||
|
enabled = true;
|
||||||
|
autocomplete = true;
|
||||||
|
debug = false;
|
||||||
|
min_length = 1;
|
||||||
|
preselect = 'enable';
|
||||||
|
throttle_time = 80;
|
||||||
|
source_timeout = 200;
|
||||||
|
incomplete_delay = 400;
|
||||||
|
max_abbr_width = 100;
|
||||||
|
max_kind_width = 100;
|
||||||
|
max_menu_width = 100;
|
||||||
|
documentation = false;
|
||||||
|
|
||||||
|
source = {
|
||||||
|
path = true;
|
||||||
|
buffer = true;
|
||||||
|
calc = true;
|
||||||
|
vsnip = true;
|
||||||
|
nvim_lsp = true;
|
||||||
|
nvim_lua = true;
|
||||||
|
spell = true;
|
||||||
|
tags = true;
|
||||||
|
snippets_nvim = true;
|
||||||
|
treesitter = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
local t = function(str)
|
||||||
|
return vim.api.nvim_replace_termcodes(str, true, true, true)
|
||||||
|
end
|
||||||
|
_G.s_tab_complete = function()
|
||||||
|
if vim.fn.pumvisible() == 1 then
|
||||||
|
return t "<C-p>"
|
||||||
|
elseif vim.fn.call("vsnip#jumpable", {-1}) == 1 then
|
||||||
|
return t "<Plug>(vsnip-jump-prev)"
|
||||||
|
else
|
||||||
|
return t "<S-Tab>"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true})
|
||||||
|
vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
|
||||||
|
vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
|
32
lua/nvim-lspconfig/lua.lua
Normal file
32
lua/nvim-lspconfig/lua.lua
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
vim.cmd [[packadd nvim-lspconfig]]
|
||||||
|
vim.cmd [[packadd nvim-compe]]
|
||||||
|
|
||||||
|
local function map(mode, lhs, rhs, opts)
|
||||||
|
local options = {noremap = true}
|
||||||
|
if opts then options = vim.tbl_extend('force', options, opts) end
|
||||||
|
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
|
||||||
|
end
|
||||||
|
|
||||||
|
local opts = { noremap=true, silent=true }
|
||||||
|
|
||||||
|
-- Mappings.
|
||||||
|
map('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
||||||
|
map('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
||||||
|
map('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||||||
|
|
||||||
|
map('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||||
|
map('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
||||||
|
map('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
||||||
|
map('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
||||||
|
map('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
||||||
|
map('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
||||||
|
map('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
|
||||||
|
map('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
||||||
|
map('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
|
||||||
|
map('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
|
||||||
|
map('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
|
||||||
|
map('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
|
||||||
|
|
||||||
|
require'lspconfig'.tsserver.setup{}
|
||||||
|
require'lspconfig'.cssls.setup{}
|
||||||
|
require'lspconfig'.html.setup{}
|
@ -5,11 +5,9 @@ return require('packer').startup(function()
|
|||||||
use {'wbthomason/packer.nvim', opt = true}
|
use {'wbthomason/packer.nvim', opt = true}
|
||||||
use { 'kyazdani42/nvim-web-devicons'}
|
use { 'kyazdani42/nvim-web-devicons'}
|
||||||
use { 'kyazdani42/nvim-tree.lua'}
|
use { 'kyazdani42/nvim-tree.lua'}
|
||||||
use { 'neoclide/coc.nvim' , branch = 'release'}
|
|
||||||
use { 'nvim-lua/plenary.nvim'}
|
use { 'nvim-lua/plenary.nvim'}
|
||||||
use { 'lewis6991/gitsigns.nvim'}
|
use { 'lewis6991/gitsigns.nvim'}
|
||||||
use { 'glepnir/galaxyline.nvim'}
|
use { 'glepnir/galaxyline.nvim'}
|
||||||
use { 'tweekmonster/startuptime.vim'}
|
|
||||||
use { 'akinsho/nvim-bufferline.lua'}
|
use { 'akinsho/nvim-bufferline.lua'}
|
||||||
use { '907th/vim-auto-save'}
|
use { '907th/vim-auto-save'}
|
||||||
use { 'nvim-treesitter/nvim-treesitter'}
|
use { 'nvim-treesitter/nvim-treesitter'}
|
||||||
@ -18,4 +16,9 @@ return require('packer').startup(function()
|
|||||||
use { 'Yggdroot/indentLine'}
|
use { 'Yggdroot/indentLine'}
|
||||||
use { 'ryanoasis/vim-devicons'}
|
use { 'ryanoasis/vim-devicons'}
|
||||||
use { 'sbdchd/neoformat'}
|
use { 'sbdchd/neoformat'}
|
||||||
|
use { 'neovim/nvim-lspconfig'}
|
||||||
|
use { 'hrsh7th/nvim-compe'}
|
||||||
|
use { 'windwp/nvim-autopairs'}
|
||||||
|
use { 'alvan/vim-closetag'}
|
||||||
|
use { 'tweekmonster/startuptime.vim'}
|
||||||
end)
|
end)
|
||||||
|
@ -36,9 +36,9 @@ _G.packer_plugins = {
|
|||||||
loaded = true,
|
loaded = true,
|
||||||
path = "/home/sid/.local/share/nvim/site/pack/packer/start/base16-vim"
|
path = "/home/sid/.local/share/nvim/site/pack/packer/start/base16-vim"
|
||||||
},
|
},
|
||||||
["coc.nvim"] = {
|
["completion-nvim"] = {
|
||||||
loaded = true,
|
loaded = true,
|
||||||
path = "/home/sid/.local/share/nvim/site/pack/packer/start/coc.nvim"
|
path = "/home/sid/.local/share/nvim/site/pack/packer/start/completion-nvim"
|
||||||
},
|
},
|
||||||
["galaxyline.nvim"] = {
|
["galaxyline.nvim"] = {
|
||||||
loaded = true,
|
loaded = true,
|
||||||
@ -52,14 +52,6 @@ _G.packer_plugins = {
|
|||||||
loaded = true,
|
loaded = true,
|
||||||
path = "/home/sid/.local/share/nvim/site/pack/packer/start/indentLine"
|
path = "/home/sid/.local/share/nvim/site/pack/packer/start/indentLine"
|
||||||
},
|
},
|
||||||
["lualine.nvim"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/sid/.local/share/nvim/site/pack/packer/start/lualine.nvim"
|
|
||||||
},
|
|
||||||
neoformat = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/sid/.local/share/nvim/site/pack/packer/start/neoformat"
|
|
||||||
},
|
|
||||||
["nvim-bufferline.lua"] = {
|
["nvim-bufferline.lua"] = {
|
||||||
loaded = true,
|
loaded = true,
|
||||||
path = "/home/sid/.local/share/nvim/site/pack/packer/start/nvim-bufferline.lua"
|
path = "/home/sid/.local/share/nvim/site/pack/packer/start/nvim-bufferline.lua"
|
||||||
@ -68,6 +60,10 @@ _G.packer_plugins = {
|
|||||||
loaded = true,
|
loaded = true,
|
||||||
path = "/home/sid/.local/share/nvim/site/pack/packer/start/nvim-colorizer.lua"
|
path = "/home/sid/.local/share/nvim/site/pack/packer/start/nvim-colorizer.lua"
|
||||||
},
|
},
|
||||||
|
["nvim-lspconfig"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/sid/.local/share/nvim/site/pack/packer/start/nvim-lspconfig"
|
||||||
|
},
|
||||||
["nvim-tree.lua"] = {
|
["nvim-tree.lua"] = {
|
||||||
loaded = true,
|
loaded = true,
|
||||||
path = "/home/sid/.local/share/nvim/site/pack/packer/start/nvim-tree.lua"
|
path = "/home/sid/.local/share/nvim/site/pack/packer/start/nvim-tree.lua"
|
||||||
|
Loading…
Reference in New Issue
Block a user