summary refs log tree commit diff
path: root/.vim/lua/plugins.lua
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2021-08-30 18:15:15 +0200
committerRobert Günzler <r@gnzler.io>2021-08-31 12:41:19 +0200
commitb3fe31ba9fadba18538b4dfff8afcc83d049ff27 (patch)
treeb648681d7959fe1dd4b6d69f95d625a22c90cc7e /.vim/lua/plugins.lua
parent938d54a50f8e7e53667f4bbf6efe0e5bc310cd02 (diff)
vim: use treesitter for folds
Diffstat (limited to '.vim/lua/plugins.lua')
-rw-r--r--.vim/lua/plugins.lua89
1 files changed, 73 insertions, 16 deletions
diff --git a/.vim/lua/plugins.lua b/.vim/lua/plugins.lua
index 6f7be9b..ab3ac2b 100644
--- a/.vim/lua/plugins.lua
+++ b/.vim/lua/plugins.lua
@@ -129,29 +129,47 @@ return require('packer').startup({function()
     requires = {
       'nvim-treesitter/completion-treesitter',
       'nvim-treesitter/nvim-treesitter-refactor',
+      'nvim-treesitter/nvim-treesitter-textobjects',
     },
     config = function()
       require('nvim-treesitter.configs').setup {
         ensure_installed = { 
-          "bash",
-          "c",
-          "c_sharp",
-          "css",
-          "dockerfile",
-          "html",
-          "go", "gomod",
-          "javascript",
-          "ledger",
-          "lua",
-          "rust",
-          "typescript",
+          'bash',
+          'c',
+          'c_sharp',
+          'comment',
+          'css',
+          'dockerfile',
+          'go',
+          'gomod',
+          'html',
+          'javascript',
+          'json',
+          'jsonc',
+          'ledger',
+          'lua',
+          'regex',
+          'rust',
+          'scss',
+          'toml',
+          'typescript',
+          'vim',
+          'yaml',
         },
         highlight = {
-          enable = false,
+          enable = true,
         },
         indent = {
           enable = true,
         },
+        incremental_selection = {
+          enable = true,
+          keymaps = {
+            init_selection = 'gnn',
+            node_incremental = 'grn',
+            node_decremental = 'grm',
+          },
+        },
         refactor = {
           navigation = {
             enable = true,
@@ -166,6 +184,23 @@ return require('packer').startup({function()
             },
           },
         },
+        textobjects = {
+          select = {
+            enable = true,
+            keymaps = {
+              ["ib"] = '@block.inner',
+              ["ob"] = '@block.outer',
+              ["ic"] = '@conditional.inner',
+              ["oc"] = '@conditional.outer',
+              ["if"] = '@function.inner',
+              ["of"] = '@function.outer',
+              ["il"] = '@loop.inner',
+              ["ol"] = '@loop.outer',
+              ["is"] = '@scopename.inner',
+              ["os"] = '@scopename.outer',
+            },
+          },
+        },
       }
 
       augroup {
@@ -454,10 +489,32 @@ return require('packer').startup({function()
   use {'jjo/vim-cue', ft = {'cue'}}
   use {'gentoo/gentoo-syntax'}
 
-  -- multi-language support with lazy loading
+  -- polyglot: multi-language support with lazy loading {{{
   -- NOTE: put language specific plugs before this to avoid conflicsts
-  g.polyglot_disabled = { 'autoindent' }
-  use {'sheerun/vim-polyglot'}
+  g.polyglot_disabled = {
+    'autoindent',
+
+    'bash',
+    'c',
+    'c_sharp',
+    'dockerfile',
+    'go',
+    'gomod',
+    'html',
+    'javascript',
+    'json',
+    'jsonc',
+    'ledger',
+    'lua',
+    'rust',
+    'scss',
+    'sh',
+    'toml',
+    'typescript',
+    'vim',
+    'yaml',
+  }
+  use {'sheerun/vim-polyglot'} -- }}}
 
   use {'folke/zen-mode.nvim', -- {{{
     config = function()