Update autopairs, add stylelint LSP
This commit is contained in:
parent
1833453019
commit
07530fb3f8
28
nvim/autopairs.vimrc
Normal file
28
nvim/autopairs.vimrc
Normal file
@ -0,0 +1,28 @@
|
||||
lua <<EOF
|
||||
local Rule = require('nvim-autopairs.rule')
|
||||
local npairs = require('nvim-autopairs')
|
||||
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
||||
local cmp = require('cmp')
|
||||
|
||||
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
|
||||
|
||||
npairs.setup({
|
||||
check_ts = true,
|
||||
ts_config = {
|
||||
lua = {'string'},-- it will not add a pair on that treesitter node
|
||||
javascript = {'template_string'},
|
||||
java = false,-- don't check treesitter on java
|
||||
}
|
||||
})
|
||||
|
||||
local ts_conds = require('nvim-autopairs.ts-conds')
|
||||
|
||||
|
||||
-- press % => %% is only inside comment or string
|
||||
npairs.add_rules({
|
||||
Rule("%", "%", "lua")
|
||||
:with_pair(ts_conds.is_ts_node({'string','comment'})),
|
||||
Rule("$", "$", "lua")
|
||||
:with_pair(ts_conds.is_not_ts_node({'function'}))
|
||||
})
|
||||
EOF
|
@ -36,7 +36,7 @@ end
|
||||
|
||||
-- Use a loop to conveniently call 'setup' on multiple servers and
|
||||
-- map buffer local keybindings when the language server attaches
|
||||
local servers = { 'solargraph', 'rust_analyzer', 'gopls', 'tsserver' }
|
||||
local servers = { 'solargraph', 'rust_analyzer', 'gopls', 'tsserver', 'stylelint_lsp' }
|
||||
for _, lsp in ipairs(servers) do
|
||||
nvim_lsp[lsp].setup {
|
||||
on_attach = on_attach,
|
||||
|
@ -1,7 +1,6 @@
|
||||
" Assorted plugins
|
||||
Plug 'cespare/vim-toml', { 'for': 'toml' }
|
||||
Plug 'chrisbra/unicode.vim'
|
||||
Plug 'jiangmiao/auto-pairs'
|
||||
Plug 'leafgarland/typescript-vim', { 'for': 'typescript' }
|
||||
Plug 'leafoftree/vim-svelte-plugin', { 'for': 'svelte' }
|
||||
Plug 'lukas-reineke/indent-blankline.nvim'
|
||||
@ -17,6 +16,7 @@ Plug 'tpope/vim-repeat'
|
||||
Plug 'tpope/vim-surround'
|
||||
Plug 'vim-test/vim-test'
|
||||
Plug 'wakatime/vim-wakatime'
|
||||
Plug 'windwp/nvim-autopairs'
|
||||
|
||||
" LSP and autocomplete
|
||||
Plug 'neovim/nvim-lspconfig' |
|
||||
|
5
vimrc
5
vimrc
@ -73,6 +73,11 @@ if filereadable(expand("~/.config/nvim/nvim-cmp.vimrc"))
|
||||
source ~/.config/nvim/nvim-cmp.vimrc
|
||||
endif
|
||||
|
||||
" Autopairs
|
||||
if filereadable(expand("~/.config/nvim/autopairs.vimrc"))
|
||||
source ~/.config/nvim/autopairs.vimrc
|
||||
endif
|
||||
|
||||
" LSP
|
||||
if filereadable(expand("~/.config/nvim/lspconfig.vimrc"))
|
||||
source ~/.config/nvim/lspconfig.vimrc
|
||||
|
Loading…
x
Reference in New Issue
Block a user