changeset 278:7daae1b70617

Add treesitter config for python
author zegervdv <zegervdv@me.com>
date Mon, 24 Aug 2020 21:50:33 +0200
parents a567e547b45a
children 994e456b145e
files dot_config/nvim/init.vim
diffstat 1 files changed, 32 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/dot_config/nvim/init.vim	Mon Aug 24 21:33:49 2020 +0200
+++ b/dot_config/nvim/init.vim	Mon Aug 24 21:50:33 2020 +0200
@@ -117,6 +117,7 @@
    Plug 'neovim/nvim-lsp'
    Plug 'nvim-lua/completion-nvim'
    Plug 'nvim-lua/diagnostic-nvim'
+   Plug 'nvim-treesitter/nvim-treesitter'
 endif
 
 " Copying
@@ -1248,21 +1249,7 @@
 nnoremap <F9> :PMake<CR>
 " }}}
 " LanguageClient {{{
-nmap <silent> gd <Plug>(coc-definition)
-nmap <silent> gy <Plug>(coc-type-definition)
-nmap <silent> gi <Plug>(coc-implementation)
-nmap <silent> gr <Plug>(coc-references)
 
-" Use K to show documentation in preview window
-nnoremap <silent> K :call <SID>show_documentation()<CR>
-
-function! s:show_documentation()
-  if (index(['vim','help'], &filetype) >= 0)
-    execute 'h '.expand('<cword>')
-  else
-    call CocAction('doHover')
-  endif
-endfunction
 " }}}
 " Splice {{{
 let g:splice_initial_diff_grid=1
@@ -1296,6 +1283,37 @@
 "   autocmd BufWritePre * try | undojoin | Neoformat | catch /^Vim\%((\a\+)\)\=:E790/ | finally | silent Neoformat | endtry
 " augroup END
 " }}}
+lua <<EOF
+require'nvim-treesitter.configs'.setup {
+  highlight = {
+    enable = true,
+  },
+  incremental_selection = {
+    enable = true,
+    keymaps = {
+      init_selection = "gnn",
+      node_incremental = "grn",
+      scope_incremental = "grc",
+      node_decremental = "grm",
+    }
+  },
+  refactor = {
+    smart_rename = {
+      enable = true,
+      keymaps = {
+        smart_rename = "grr",
+      },
+    },
+    navigation = {
+      enable = true,
+      keymaps = {
+        goto_definition = "gnd",
+        list_definitions = "gnD",
+      },
+    },
+  },
+}
+EOF
 " }}}
 
 function! SendOSCClipboard(lines, regtype)