finally nvim lsp workin!
parent
601be3a2ff
commit
7e32c663ac
@ -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
|
|
||||||
|
|
||||||
]])
|
|
@ -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})
|
@ -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{}
|
Loading…
Reference in New Issue