Neovim lua config

This commit is contained in:
Daan Vanoverloop 2021-08-24 18:17:11 +02:00
parent 2fbe1bf195
commit 3e2f735511
11 changed files with 740 additions and 30 deletions

7
.config/nvim/init.lua Normal file
View File

@ -0,0 +1,7 @@
require('plugins')
require('options')
require('treesitter')
require('format')
require('keys')
require('completion')
require('statusline')

View File

@ -29,7 +29,7 @@ Plug 'nikvdp/ejs-syntax'
Plug 'pangloss/vim-javascript' Plug 'pangloss/vim-javascript'
Plug 'MaxMEllon/vim-jsx-pretty' Plug 'MaxMEllon/vim-jsx-pretty'
Plug 'jelera/vim-javascript-syntax' Plug 'jelera/vim-javascript-syntax'
Plug 'w0rp/ale' "Plug 'w0rp/ale'
Plug 'prettier/prettier' Plug 'prettier/prettier'
Plug 'flrnprz/plastic.vim' Plug 'flrnprz/plastic.vim'
Plug 'rakr/vim-one' Plug 'rakr/vim-one'
@ -40,36 +40,222 @@ Plug 'vim-pandoc/vim-pandoc'
Plug 'vim-pandoc/vim-pandoc-syntax' Plug 'vim-pandoc/vim-pandoc-syntax'
Plug 'junegunn/fzf.vim' Plug 'junegunn/fzf.vim'
Plug 'tpope/vim-dadbod' Plug 'tpope/vim-dadbod'
"Plug 'lervag/vimtex' Plug 'lervag/vimtex'
Plug 'dpelle/vim-LanguageTool' Plug 'dpelle/vim-LanguageTool'
Plug 'neoclide/coc.nvim', {'branch': 'release'} "Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'tikhomirov/vim-glsl' Plug 'tikhomirov/vim-glsl'
Plug 'soli/prolog-vim' Plug 'soli/prolog-vim'
Plug 'tpope/vim-dispatch'
"Plug 'rafcamlet/coc-nvim-lua'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'neovim/nvim-lspconfig'
Plug 'hrsh7th/nvim-compe'
Plug 'nvim-lua/lsp-status.nvim'
"Plug 'evanleck/vim-svelte', {'branch': 'main'}
Plug 'leafOfTree/vim-svelte-plugin'
Plug 'prettier/vim-prettier', { 'do': 'yarn install' }
call plug#end() " required call plug#end() " required
filetype plugin indent on " required filetype plugin indent on " required
let g:prettier#config#tab_width = 2
lua <<EOF
require'nvim-treesitter.configs'.setup {
highlight = {
enable = true,
custom_captures = {
-- Highlight the @foo.bar capture group with the "Identifier" highlight group.
["foo.bar"] = "Identifier",
},
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "gnn",
node_incremental = "grn",
scope_incremental = "grc",
node_decremental = "grm",
},
},
}
require'compe'.setup {
enabled = true;
autocomplete = true;
debug = false;
min_length = 1;
preselect = 'always';
throttle_time = 80;
source_timeout = 200;
resolve_timeout = 800;
incomplete_delay = 400;
max_abbr_width = 100;
max_kind_width = 100;
max_menu_width = 100;
documentation = {
border = { '', '' ,'', ' ', '', '', '', ' ' }, -- the border option is the same as `|help nvim_open_win|`
winhighlight = "NormalFloat:CompeDocumentation,FloatBorder:CompeDocumentationBorder",
max_width = 120,
min_width = 60,
max_height = math.floor(vim.o.lines * 0.3),
min_height = 1,
};
source = {
path = true;
buffer = true;
calc = true;
nvim_lsp = true;
nvim_lua = true;
vsnip = true;
ultisnips = true;
luasnip = true;
};
}
EOF
inoremap <silent><expr> <C-Space> compe#complete()
inoremap <silent><expr> <CR> compe#confirm('<CR>')
inoremap <silent><expr> <C-e> compe#close('<C-e>')
inoremap <silent><expr> <C-f> compe#scroll({ 'delta': +4 })
inoremap <silent><expr> <C-d> compe#scroll({ 'delta': -4 })
lua << END
local lsp_status = require('lsp-status')
lsp_status.register_progress()
local lspconfig = require('lspconfig')
-- Some arbitrary servers
lspconfig.clangd.setup({
handlers = lsp_status.extensions.clangd.setup(),
init_options = {
clangdFileStatus = true
},
on_attach = lsp_status.on_attach,
capabilities = lsp_status.capabilities
})
lspconfig.rust_analyzer.setup({
on_attach = lsp_status.on_attach,
capabilities = lsp_status.capabilities
})
lspconfig.pyright.setup({
on_attach = lsp_status.on_attach,
capabilities = lsp_status.capabilities
})
lspconfig.elmls.setup({
on_attach = lsp_status.on_attach,
capabilities = lsp_status.capabilities
})
lspconfig.svelte.setup({
on_attach = lsp_status.on_attach,
capabilities = lsp_status.capabilities
})
lspconfig.tsserver.setup({
on_attach = lsp_status.on_attach,
capabilities = lsp_status.capabilities
})
lspconfig.gdscript.setup({
on_attach = function (client)
local _notify = client.notify
client.notify = function (method, params)
if method == 'textDocument/didClose' then
-- Godot doesn't implement didClose yet
return
end
_notify(method, params)
end
lsp_status.on_attach(client)
end,
capabilities = lsp_status.capabilities,
flags = {
debounce_text_changes = 150,
}
})
END
" Statusline
function! LspStatus() abort
let status = luaeval('require("lsp-status").status()')
return trim(status)
endfunction
call airline#parts#define_function('lsp_status', 'LspStatus')
call airline#parts#define_condition('lsp_status', 'luaeval("#vim.lsp.buf_get_clients() > 0")')
let g:airline#extensions#nvimlsp#enabled = 0
let g:airline_section_x = airline#section#create_right(['lsp_status'])
" Errors in Red
hi LspDiagnosticsVirtualTextError guifg=red ctermfg=red
" Warnings in Yellow
hi LspDiagnosticsVirtualTextWarning guifg=yellow ctermfg=yellow
" Info and Hints in White
hi LspDiagnosticsVirtualTextInformation guifg=white ctermfg=white
hi LspDiagnosticsVirtualTextHint guifg=white ctermfg=white
" Underline the offending code
hi LspDiagnosticsUnderlineError guifg=NONE ctermfg=NONE cterm=underline gui=underline
hi LspDiagnosticsUnderlineWarning guifg=NONE ctermfg=NONE cterm=underline gui=underline
hi LspDiagnosticsUnderlineInformation guifg=NONE ctermfg=NONE cterm=underline gui=underline
hi LspDiagnosticsUnderlineHint guifg=NONE ctermfg=NONE cterm=underline gui=underline
lua << EOF
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics, {
-- Enable underline, use default values
underline = true,
-- Enable virtual text only on Warning or above, override spacing to 2
virtual_text = {
spacing = 2,
},
}
)
EOF
autocmd ColorScheme * :lua require('vim.lsp.diagnostic')._define_default_signs_and_highlights()
autocmd CursorHold * lua vim.lsp.diagnostic.show_line_diagnostics()
autocmd FileType matlab setlocal keywordprg=info\ octave\ --vi-keys\ --index-search autocmd FileType matlab setlocal keywordprg=info\ octave\ --vi-keys\ --index-search
augroup filetypedetect augroup filetypedetect
" Mail " Mail
autocmd BufRead,BufNewFile *mutt-* setfiletype mail autocmd BufRead,BufNewFile *mutt-* setfiletype mail
autocmd BufRead,BufNewFile *.gd set filetype=gdscript3
augroup END augroup END
let g:languagetool_jar = "/home/daan/.local/share/languagetool/languagetool-commandline.jar" let g:languagetool_jar = "/home/daan/.local/share/LanguageTool-5.2-SNAPSHOT/languagetool-commandline.jar"
let g:jsx_ext_required = 0 let g:jsx_ext_required = 0
let g:neosnippet#enable_completed_snippet = 1 let g:neosnippet#enable_completed_snippet = 1
let g:autocomplete_flow#insert_paren_after_function = 0 let g:autocomplete_flow#insert_paren_after_function = 0
let g:languagetool_jar = "~/Documents/LanguageTool-4.9.1/languagetool-commandline.jar" let g:fzf_buffers_jump = 1
"let g:coc_filetype_map = {
"\ 'md': 'tex',
"\ }
set tags+=./.tags set tags+=./.tags
set nobackup set nobackup
set nowritebackup set nowritebackup
set guifont=Fira\ Code:h12
"Credit joshdick "Credit joshdick
"Use 24-bit (true-color) mode in Vim/Neovim when outside tmux. "Use 24-bit (true-color) mode in Vim/Neovim when outside tmux.
"If you're using tmux version 2.2 or later, you can remove the outermost $TMUX check and use tmux's 24-bit color support "If you're using tmux version 2.2 or later, you can remove the outermost $TMUX check and use tmux's 24-bit color support
@ -227,31 +413,8 @@ set expandtab
:set ma :set ma
let g:C_Mapfeader = ',' let g:C_Mapfeader = ','
nnoremap <cr> :noh<CR><CR>:<backspace>
imap <C-k> <Plug>(neosnippet_expand_or_jump) "let g:coc_snippet_next = '<tab>'
smap <C-k> <Plug>(neosnippet_expand_or_jump)
xmap <C-k> <Plug>(neosnippet_expand_target)
imap <expr><TAB> neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)"
\: pumvisible() ? "\<C-n>" : "\<TAB>"
smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)"
\: "\<TAB>"
inoremap <silent><expr> <TAB>
\ pumvisible() ? coc#_select_confirm() :
\ coc#expandableOrJumpable() ? "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
let g:coc_snippet_next = '<tab>'
nnoremap <C-f> :Files<cr> nnoremap <C-f> :Files<cr>
nnoremap <C-b> :Buffers<cr> nnoremap <C-b> :Buffers<cr>
@ -274,5 +437,5 @@ imap <Down> <Esc>
imap <Left> <Esc> imap <Left> <Esc>
imap <Right> <Esc> imap <Right> <Esc>
set completeopt=menu,noinsert set completeopt=menuone,noselect

View File

@ -0,0 +1,59 @@
local lspconfig = require 'lspconfig'
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.documentationFormat = { 'markdown', 'plaintext' }
capabilities.textDocument.completion.completionItem.snippetSupport = true
capabilities.textDocument.completion.completionItem.preselectSupport = true
capabilities.textDocument.completion.completionItem.insertReplaceSupport = true
capabilities.textDocument.completion.completionItem.labelDetailsSupport = true
capabilities.textDocument.completion.completionItem.deprecatedSupport = true
capabilities.textDocument.completion.completionItem.commitCharactersSupport = true
capabilities.textDocument.completion.completionItem.tagSupport = { valueSet = { 1 } }
capabilities.textDocument.completion.completionItem.resolveSupport = {
properties = {
'documentation',
'detail',
'additionalTextEdits',
},
}
-- Enable some language servers with the additional completion capabilities offered by nvim-cmp
local servers = { 'clangd', 'rust_analyzer', 'pyright', 'tsserver', 'svelte' }
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
-- on_attach = my_custom_on_attach,
capabilities = capabilities,
}
end
-- luasnip setup
local luasnip = require 'luasnip'
-- nvim-cmp setup
local cmp = require 'cmp'
cmp.setup {
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end,
},
mapping = {
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
['<Tab>'] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(cmp.mapping.select_prev_item(), { 'i', 's' }),
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'nvim_lua' },
{ name = 'luasnip' },
},
}

View File

@ -0,0 +1,54 @@
require('formatter').setup({
logging = false,
filetype = {
javascript = {
-- prettier
function()
return {
exe = "prettier",
args = {"--stdin-filepath", vim.api.nvim_buf_get_name(0), '--single-quote'},
stdin = true
}
end
},
svelte = {
-- prettier
function()
return {
exe = "prettier",
args = {
"--stdin-filepath", vim.api.nvim_buf_get_name(0), '--single-quote'
},
stdin = true
}
end
},
rust = {
-- Rustfmt
function()
return {
exe = "rustfmt",
args = {"--emit=stdout"},
stdin = true
}
end
},
lua = {
-- luafmt
function()
return {
exe = "luafmt",
args = {"--indent-count", 2, "--stdin"},
stdin = true
}
end
},
}
})
vim.api.nvim_exec([[
augroup FormatAutogroup
autocmd!
autocmd BufWritePost *.svelte,*.js,*.rs,*.lua FormatWrite
augroup END
]], true)

38
.config/nvim/lua/keys.lua Normal file
View File

@ -0,0 +1,38 @@
local map = vim.api.nvim_set_keymap
local function n(...) map("n", ...) end
local function x(...) map("x", ...) end
local function i(...) map("i", ...) end
-- Telescope
n("<C-f>", "<cmd>Telescope find_files<cr>", { noremap = true })
n("<C-b>", "<cmd>Telescope buffers<cr>", { noremap = true })
-- Tree
n("<S-T>", ":NvimTreeToggle<cr>", {})
-- Movement
n("<C-J>", "<C-W><C-J>", { noremap = true })
n("<C-K>", "<C-W><C-K>", { noremap = true })
n("<C-L>", "<C-W><C-L>", { noremap = true })
n("<C-H>", "<C-W><C-H>", { noremap = true })
-- Tabs
n("<C-T>", ":tabnew<cr>", {})
-- Split
n("<C-S>", ":vsplit<cr>", {})
n("<S-S>", ":split<cr>", {})
-- Quit
n("Q", "<nop>", { noremap = true })
vim.api.nvim_exec(
[[
:command WQ wq
:command Wq wq
:command W w
:command Q q
:command WQa wqa
:command Wqa wqa
]],
true)

55
.config/nvim/lua/lsp.lua Normal file
View File

@ -0,0 +1,55 @@
local lspconfig = require('lspconfig')
local lsp_status = require('lsp-status')
lsp_status.register_progress()
-- Some arbitrary servers
lspconfig.clangd.setup({
handlers = lsp_status.extensions.clangd.setup(),
init_options = {
clangdFileStatus = true
},
on_attach = lsp_status.on_attach,
capabilities = lsp_status.capabilities
})
lspconfig.rust_analyzer.setup({
on_attach = lsp_status.on_attach,
capabilities = lsp_status.capabilities
})
lspconfig.pyright.setup({
on_attach = lsp_status.on_attach,
capabilities = lsp_status.capabilities
})
lspconfig.elmls.setup({
on_attach = lsp_status.on_attach,
capabilities = lsp_status.capabilities
})
lspconfig.svelte.setup({
on_attach = lsp_status.on_attach,
capabilities = lsp_status.capabilities
})
lspconfig.tsserver.setup({
on_attach = lsp_status.on_attach,
capabilities = lsp_status.capabilities
})
lspconfig.gdscript.setup({
on_attach = function (client)
local _notify = client.notify
client.notify = function (method, params)
if method == 'textDocument/didClose' then
-- Godot doesn't implement didClose yet
return
end
_notify(method, params)
end
lsp_status.on_attach(client)
end,
capabilities = lsp_status.capabilities,
flags = {
debounce_text_changes = 150,
}
})

View File

@ -0,0 +1,24 @@
local o = vim.opt
-- Indentation
o.smartindent = true
o.tabstop = 4
o.shiftwidth = 4
o.expandtab = true
o.backspace = "indent,eol,start"
-- Numbers
o.number = true
o.relativenumber = true
-- Theme
o.background = "dark"
vim.cmd("colorscheme one")
-- Misc
o.mouse = 'a'
o.linebreak = true
o.backup = false
o.swapfile = false
o.showmode = true
o.termguicolors = true

View File

@ -0,0 +1,54 @@
vim.cmd [[packadd packer.nvim]]
return require('packer').startup(function()
-- packer
use 'wbthomason/packer.nvim'
-- Languages
use 'rust-lang/rust.vim'
use 'calviken/vim-gdscript3'
use 'vim-pandoc/vim-pandoc'
use 'vim-pandoc/vim-pandoc-syntax'
use 'dpelle/vim-LanguageTool'
use 'tikhomirov/vim-glsl'
use 'leafOfTree/vim-svelte-plugin'
-- Completion
use 'neovim/nvim-lspconfig'
use 'nvim-lua/lsp-status.nvim'
use 'hrsh7th/nvim-cmp'
use 'hrsh7th/cmp-buffer'
use 'hrsh7th/cmp-nvim-lsp'
use 'saadparwaiz1/cmp_luasnip'
use 'L3MON4D3/LuaSnip'
-- Syntax highlighting
use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' }
-- Formatting
use 'mhartington/formatter.nvim'
-- Telescope
use {
'nvim-telescope/telescope.nvim',
requires = { {'nvim-lua/plenary.nvim'} }
}
-- File tree
use {
'kyazdani42/nvim-tree.lua',
requires = 'kyazdani42/nvim-web-devicons'
}
-- Session
use 'rmagatti/auto-session'
-- Theme
use 'rakr/vim-one'
-- Status lioe
use 'glepnir/galaxyline.nvim'
-- Icons
use 'ryanoasis/vim-devicons'
end)

View File

@ -0,0 +1,23 @@
local Session = {}
function Session.save()
vim.cmd("execute 'mksession! ' . getcwd() . '/.session.vim'")
end
function Session.restore()
if vim.filereadable(getcwd() . '/.session.vim')
let initial_args = argv()
execute 'so ' . getcwd() . '/.session.vim'
for file in initial_args
if bufloaded(file) != 1
execute 'tabnew ' . getcwd() . '/' . file
else
execute 'sb ' . file
endif
endfor
let g:session = 1
endif
end
return Session

View File

@ -0,0 +1,210 @@
local gl = require('galaxyline')
local colors = require('galaxyline.theme').default
local condition = require('galaxyline.condition')
local gls = gl.section
gl.short_line_list = {'NvimTree','vista','dbui','packer'}
gls.left[1] = {
RainbowRed = {
provider = function() return '' end,
highlight = {colors.blue,colors.bg}
},
}
gls.left[2] = {
ViMode = {
provider = function()
-- auto change color according the vim mode
local mode_color = {n = colors.red, i = colors.green,v=colors.blue,
[''] = colors.blue,V=colors.blue,
c = colors.magenta,no = colors.red,s = colors.orange,
S=colors.orange,[''] = colors.orange,
ic = colors.yellow,R = colors.violet,Rv = colors.violet,
cv = colors.red,ce=colors.red, r = colors.cyan,
rm = colors.cyan, ['r?'] = colors.cyan,
['!'] = colors.red,t = colors.red}
vim.api.nvim_command('hi GalaxyViMode guifg='..mode_color[vim.fn.mode()])
return ''
end,
highlight = {colors.red,colors.bg,'bold'},
},
}
gls.left[3] = {
FileSize = {
provider = 'FileSize',
condition = condition.buffer_not_empty,
highlight = {colors.fg,colors.bg}
}
}
gls.left[4] ={
FileIcon = {
provider = 'FileIcon',
condition = condition.buffer_not_empty,
highlight = {require('galaxyline.provider_fileinfo').get_file_icon_color,colors.bg},
},
}
gls.left[5] = {
FileName = {
provider = 'FileName',
condition = condition.buffer_not_empty,
highlight = {colors.magenta,colors.bg,'bold'}
}
}
gls.left[6] = {
LineInfo = {
provider = 'LineColumn',
separator = ' ',
separator_highlight = {'NONE',colors.bg},
highlight = {colors.fg,colors.bg},
},
}
gls.left[7] = {
PerCent = {
provider = 'LinePercent',
separator = ' ',
separator_highlight = {'NONE',colors.bg},
highlight = {colors.fg,colors.bg,'bold'},
}
}
gls.left[8] = {
DiagnosticError = {
provider = 'DiagnosticError',
icon = '',
highlight = {colors.red,colors.bg}
}
}
gls.left[9] = {
DiagnosticWarn = {
provider = 'DiagnosticWarn',
icon = '',
highlight = {colors.yellow,colors.bg},
}
}
gls.left[10] = {
DiagnosticHint = {
provider = 'DiagnosticHint',
icon = '',
highlight = {colors.cyan,colors.bg},
}
}
gls.left[11] = {
DiagnosticInfo = {
provider = 'DiagnosticInfo',
icon = '',
highlight = {colors.blue,colors.bg},
}
}
gls.mid[1] = {
ShowLspClient = {
provider = 'GetLspClient',
condition = function ()
local tbl = {['dashboard'] = true,['']=true}
if tbl[vim.bo.filetype] then
return false
end
return true
end,
icon = ' LSP:',
highlight = {colors.cyan,colors.bg,'bold'}
}
}
gls.right[1] = {
FileEncode = {
provider = 'FileEncode',
condition = condition.hide_in_width,
separator = ' ',
separator_highlight = {'NONE',colors.bg},
highlight = {colors.green,colors.bg,'bold'}
}
}
gls.right[2] = {
FileFormat = {
provider = 'FileFormat',
condition = condition.hide_in_width,
separator = ' ',
separator_highlight = {'NONE',colors.bg},
highlight = {colors.green,colors.bg,'bold'}
}
}
gls.right[3] = {
GitIcon = {
provider = function() return '' end,
condition = condition.check_git_workspace,
separator = ' ',
separator_highlight = {'NONE',colors.bg},
highlight = {colors.violet,colors.bg,'bold'},
}
}
gls.right[4] = {
GitBranch = {
provider = 'GitBranch',
condition = condition.check_git_workspace,
highlight = {colors.violet,colors.bg,'bold'},
}
}
gls.right[5] = {
DiffAdd = {
provider = 'DiffAdd',
condition = condition.hide_in_width,
icon = '',
highlight = {colors.green,colors.bg},
}
}
gls.right[6] = {
DiffModified = {
provider = 'DiffModified',
condition = condition.hide_in_width,
icon = '',
highlight = {colors.orange,colors.bg},
}
}
gls.right[7] = {
DiffRemove = {
provider = 'DiffRemove',
condition = condition.hide_in_width,
icon = '',
highlight = {colors.red,colors.bg},
}
}
gls.right[8] = {
RainbowBlue = {
provider = function() return '' end,
highlight = {colors.blue,colors.bg}
},
}
gls.short_line_left[1] = {
BufferType = {
provider = 'FileTypeName',
separator = ' ',
separator_highlight = {'NONE',colors.bg},
highlight = {colors.blue,colors.bg,'bold'}
}
}
gls.short_line_left[2] = {
SFileName = {
provider = 'SFileName',
condition = condition.buffer_not_empty,
highlight = {colors.fg,colors.bg,'bold'}
}
}
gls.short_line_right[1] = {
BufferIcon = {
provider= 'BufferIcon',
highlight = {colors.fg,colors.bg}
}
}

View File

@ -0,0 +1,23 @@
require'nvim-treesitter.configs'.setup {
highlight = {
enable = true,
custom_captures = {
-- Highlight the @foo.bar capture group with the "Identifier" highlight group.
["foo.bar"] = "Identifier",
},
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "gnn",
node_incremental = "grn",
scope_incremental = "grc",
node_decremental = "grm",
},
},
}