summary refs log tree commit diff
path: root/.vim
diff options
context:
space:
mode:
Diffstat (limited to '.vim')
-rw-r--r--.vim/init.lua8
-rw-r--r--.vim/lua/plugins.lua89
2 files changed, 79 insertions, 18 deletions
diff --git a/.vim/init.lua b/.vim/init.lua
index 5dc645c..9016baf 100644
--- a/.vim/init.lua
+++ b/.vim/init.lua
@@ -1,3 +1,4 @@
+-- vim: fdm=marker
 local cmd = vim.cmd
 local g = vim.g
 
@@ -23,9 +24,8 @@ opt.cursorline = true
 opt.expandtab = true
 opt.exrc = true
 opt.fillchars = 'fold:─'
-opt.foldenable = true
+opt.foldenable = false
 opt.foldlevel = 0
-opt.foldmethod = 'marker'
 opt.hidden = true
 opt.inccommand = 'split'
 opt.incsearch = true
@@ -69,6 +69,7 @@ local tnoremap = require('astronauta.keymap').tnoremap
 nnoremap { 'Q', function() cmd [[ quitall ]] end, silent = false }
 nnoremap { 'gb', function() cmd [[ bnext ]] end }
 nnoremap { 'gB', function() cmd [[ bprevious ]] end }
+nnoremap { '<tab>',  function() cmd [[ silent! normal za ]] end }
 
 -- terminal
 tnoremap { '<esc>', [[ <c-\><c-n> ]] }
@@ -98,6 +99,9 @@ augroup {
     {'FileType', 'i3config', [[ setlocal commentstring=#\ %s ]]},
     {'FileType', 'jsonc', [[ setlocal commentstring=//\ %s ]]},
   },
+  foldenable = {
+    {'VimEnter', '.vim/*', [[setlocal foldenable]]},
+  }
 }
 -- }}}
 
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()