update plugins to include language server and tree sitter
parent
591afb0b45
commit
80b3d066b3
|
@ -1,12 +1,7 @@
|
|||
call plug#begin('~/.config/nvim/autoload/plugged')
|
||||
Plug 'junegunn/vim-easy-align'
|
||||
Plug 'tpope/vim-rails'
|
||||
Plug 'vim-ruby/vim-ruby'
|
||||
Plug 'hashivim/vim-terraform'
|
||||
Plug 'cespare/vim-toml'
|
||||
Plug 'ntpeters/vim-better-whitespace'
|
||||
Plug 'itchyny/vim-gitbranch'
|
||||
Plug 'rust-lang/rust.vim'
|
||||
Plug 'airblade/vim-gitgutter'
|
||||
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
|
||||
Plug 'junegunn/fzf.vim'
|
||||
|
@ -15,9 +10,10 @@ Plug 'vim-airline/vim-airline-themes'
|
|||
Plug 'kyazdani42/nvim-web-devicons'
|
||||
Plug 'kyazdani42/nvim-tree.lua'
|
||||
Plug 'svermeulen/vimpeccable'
|
||||
Plug 'sp5/nvim-colors-solarized'
|
||||
Plug 'NoahTheDuke/vim-just'
|
||||
Plug 'dewyze/vim-tada'
|
||||
Plug 'neovim/nvim-lspconfig'
|
||||
Plug 'nvim-treesitter/nvim-treesitter', {'do': 'TSUpdate'}
|
||||
call plug#end()
|
||||
|
||||
set nocompatible
|
||||
|
@ -70,8 +66,6 @@ filetype plugin indent on
|
|||
autocmd FileType make set noexpandtab shiftwidth=8 softtabstop=0
|
||||
autocmd FileType rust set shiftwidth=4 softtabstop=4 tabstop=4
|
||||
autocmd FileType terraform set expandtab
|
||||
let g:rustfmt_autosave = 1
|
||||
let g:terraform_fmt_on_save = 1
|
||||
autocmd FileType html set shiftwidth=4 softtabstop=4 tabstop=4
|
||||
autocmd FileType javascript set shiftwidth=4 softtabstop=4 tabstop=4
|
||||
autocmd FileType htmldjango set shiftwidth=4 softtabstop=4 tabstop=4
|
||||
|
@ -102,13 +96,6 @@ autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
|
|||
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
|
||||
autocmd BufWinLeave * call clearmatches()
|
||||
|
||||
let g:ale_linters = {
|
||||
\ 'rust': ['analyzer'],
|
||||
\ 'sh': ['shellcheck','shfmt','remove_trailing_lines','trim_whitespace'],
|
||||
\ }
|
||||
let g:ale_cursor_detail = 0
|
||||
let g:ale_fix_on_save = 1
|
||||
|
||||
" Start interactive EasyAlign in visual mode (e.g. vipga)
|
||||
xmap ga <Plug>(EasyAlign)
|
||||
|
||||
|
@ -148,6 +135,8 @@ noremap <F6> :call NumberToggle()<cr>
|
|||
nnoremap <leader>e :NvimTreeToggle<CR>
|
||||
nnoremap <leader>r :NvimTreeRefresh<CR>
|
||||
|
||||
let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.7 } }
|
||||
|
||||
lua << EOF
|
||||
require("nvim-tree").setup({
|
||||
sort_by = "case_sensitive",
|
||||
|
@ -173,3 +162,115 @@ require("nvim-tree").setup({
|
|||
},
|
||||
})
|
||||
EOF
|
||||
|
||||
lua << EOF
|
||||
require('nvim-treesitter.configs').setup {
|
||||
highlight = {
|
||||
enable = true,
|
||||
disable = {},
|
||||
},
|
||||
indent = {
|
||||
enable = false,
|
||||
disable = {},
|
||||
},
|
||||
ensure_installed = {
|
||||
"tsx",
|
||||
"typescript",
|
||||
"bash",
|
||||
"vim",
|
||||
"json",
|
||||
"yaml",
|
||||
"html",
|
||||
"css",
|
||||
"scss",
|
||||
"lua",
|
||||
"ruby",
|
||||
"rust",
|
||||
}
|
||||
}
|
||||
|
||||
local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
|
||||
-- parser_config.tsx.parser_to_fil = { "javascript", "typescript.tsx" }
|
||||
EOF
|
||||
|
||||
lua << EOF
|
||||
local nvim_lsp = require('lspconfig')
|
||||
local protocol = require('vim.lsp.protocol')
|
||||
|
||||
local on_attach = function(client, bufnr)
|
||||
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
||||
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||||
|
||||
-- Mappings
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
||||
buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
||||
buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
||||
--buf_set_keymap('i', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>lwa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>lwr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>lwl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
||||
buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
|
||||
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>d', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
|
||||
--buf_set_keymap('n', '<C-j>', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>lgn', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
|
||||
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
|
||||
buf_set_keymap('n', 'td', '<Cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
|
||||
|
||||
--if client.name == 'tsserver' then
|
||||
-- client.resolved_capabilities.document_formatting = false
|
||||
--end
|
||||
|
||||
if client.resolved_capabilities.document_formatting then
|
||||
vim.api.nvim_command [[augroup Format]]
|
||||
vim.api.nvim_command [[autocmd! * <buffer>]]
|
||||
vim.api.nvim_command [[autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_seq_sync()]]
|
||||
vim.api.nvim_command [[augroup END]]
|
||||
end
|
||||
|
||||
protocol.CompletionItemKind = {
|
||||
'', -- Text
|
||||
'', -- Method
|
||||
'', -- Function
|
||||
'', -- Constructor
|
||||
'', -- Field
|
||||
'', -- Variable
|
||||
'', -- Class
|
||||
'ﰮ', -- Interface
|
||||
'', -- Module
|
||||
'', -- Property
|
||||
'', -- Unit
|
||||
'', -- Value
|
||||
'', -- Enum
|
||||
'', -- Keyword
|
||||
'', -- Snippet
|
||||
'', -- Color
|
||||
'', -- File
|
||||
'', -- Reference
|
||||
'', -- Folder
|
||||
'', -- EnumMember
|
||||
'', -- Constant
|
||||
'', -- Struct
|
||||
'', -- Event
|
||||
'ﬦ', -- Operator
|
||||
'', -- TypeParameter
|
||||
}
|
||||
end
|
||||
|
||||
nvim_lsp.tsserver.setup {
|
||||
on_attach = on_attach,
|
||||
filetypes = { "typescript", "typescriptreact", "typescript.tsx" }
|
||||
}
|
||||
|
||||
nvim_lsp.solargraph.setup {
|
||||
on_attach = on_attach,
|
||||
flags = {
|
||||
debounce_text_changes = 150,
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
|
Loading…
Reference in New Issue