Browse Source

Update nvim config

master
Tovi Jaeschke-Rogers 11 months ago
parent
commit
f295b60bf3
11 changed files with 364 additions and 51 deletions
  1. +39
    -35
      .config/nvim/lazy-lock.json
  2. +15
    -0
      .config/nvim/lua/tovi/core/commands.lua
  3. +1
    -0
      .config/nvim/lua/tovi/core/init.lua
  4. +1
    -0
      .config/nvim/lua/tovi/plugins/formatting.lua
  5. +19
    -11
      .config/nvim/lua/tovi/plugins/harpoon.lua
  6. +75
    -0
      .config/nvim/lua/tovi/plugins/laravel.lua
  7. +4
    -0
      .config/nvim/lua/tovi/plugins/linting.lua
  8. +13
    -0
      .config/nvim/lua/tovi/plugins/lsp/lspconfig.lua
  9. +1
    -1
      .config/nvim/lua/tovi/plugins/lsp/mason.lua
  10. +100
    -0
      .config/nvim/lua/tovi/plugins/nvim-treesitter-textobjects.lua
  11. +96
    -4
      .config/nvim/lua/tovi/plugins/nvim-treesitter.lua

+ 39
- 35
.config/nvim/lazy-lock.json View File

@ -1,49 +1,53 @@
{ {
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
"FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" },
"LuaSnip": { "branch": "master", "commit": "46c91e814732c1630b8a8b50d04acbf54b8320fa" },
"LuaSnip": { "branch": "master", "commit": "82108e7e31cc6fc223cc5df5cae6d89f70bb199f" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"conform.nvim": { "branch": "master", "commit": "ca3dfba94600aa62bfc88ae37cbd4f17eaea2553" },
"copilot.vim": { "branch": "release", "commit": "309b3c803d1862d5e84c7c9c5749ae04010123b8" },
"conform.nvim": { "branch": "master", "commit": "47ceff644e9d00872f410be374cc973eefa20ba9" },
"copilot.vim": { "branch": "release", "commit": "5b19fb001d7f31c4c7c5556d7a97b243bd29f45f" },
"dart-vim-plugin": { "branch": "master", "commit": "928302ec931caf0dcf21835cca284ccd2b192f7b" }, "dart-vim-plugin": { "branch": "master", "commit": "928302ec931caf0dcf21835cca284ccd2b192f7b" },
"dressing.nvim": { "branch": "master", "commit": "fe3071330a0720ce3695ac915820c8134b22d1b0" },
"friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" },
"dressing.nvim": { "branch": "master", "commit": "94b0d24483d56f3777ee0c8dc51675f21709318c" },
"friendly-snippets": { "branch": "main", "commit": "69a2c1675b66e002799f5eef803b87a12f593049" },
"fugitive-gitlab.vim": { "branch": "master", "commit": "55fed481c0309b3405dd3d72921d687bf36873a8" }, "fugitive-gitlab.vim": { "branch": "master", "commit": "55fed481c0309b3405dd3d72921d687bf36873a8" },
"gitsigns.nvim": { "branch": "main", "commit": "af0f583cd35286dd6f0e3ed52622728703237e50" },
"go.nvim": { "branch": "master", "commit": "38f6402fa5362f2c31a31439294d9e24eda46b13" },
"guihua.lua": { "branch": "master", "commit": "cd68996069abedffcd677ca7eee3a660b79e5b32" },
"harpoon": { "branch": "master", "commit": "c1aebbad9e3d13f20bedb8f2ce8b3a94e39e424a" },
"gitsigns.nvim": { "branch": "main", "commit": "3e6e91b09f0468c32d3b96dcacf4b947f037ce25" },
"go.nvim": { "branch": "master", "commit": "24d2fa373d55d9900cd4b502a88214dc17e6fab6" },
"guihua.lua": { "branch": "master", "commit": "9fb6795474918b492d9ab01b1ebaf85e8bf6fe0b" },
"harpoon": { "branch": "harpoon2", "commit": "2cd4e03372f7ee5692c8caa220f479ea07970f17" },
"laravel.nvim": { "branch": "main", "commit": "a4d6f85f2be05aca0b4dd1feb8f28cb8b4e68420" },
"lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" },
"lazygit.nvim": { "branch": "main", "commit": "de35012036d43bca03628d40d083f7c02a4cda3f" },
"leap.nvim": { "branch": "main", "commit": "b6ae80f8fc9993638608fc1a51c6ab0eeb12618c" },
"lspkind.nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" },
"lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "6eb8cae80f2e4322ec82cd9f8fa423f6d1eb02c3" },
"mason-tool-installer.nvim": { "branch": "main", "commit": "e4f34741daa9cf95de68a603d3e7a6844a69fdf0" },
"mason.nvim": { "branch": "main", "commit": "41e75af1f578e55ba050c863587cffde3556ffa6" },
"minintro.nvim": { "branch": "master", "commit": "6bbb922a5628f5bc746fa2e13dbf5f9b6049c6b1" },
"neotest": { "branch": "master", "commit": "901891484db3d46ce43d56871273dc7d40621356" },
"neotest-go": { "branch": "main", "commit": "1a15e1136db43775214a3e7a598f8930c29c94b7" },
"lazygit.nvim": { "branch": "main", "commit": "1e08e3f5ac1152339690140e61a4a32b3bdc7de5" },
"leap.nvim": { "branch": "main", "commit": "b63f14d7474002573710d10f02f1af33a4910490" },
"lspkind.nvim": { "branch": "master", "commit": "7f26cf5e27e2bd910ce0ea00c514da2bf97423b8" },
"lualine.nvim": { "branch": "master", "commit": "566b7036f717f3d676362742630518a47f132fff" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "0989bdf4fdf7b5aa4c74131d7ffccc3f399ac788" },
"mason-tool-installer.nvim": { "branch": "main", "commit": "8b70e7f1e0a4119c1234c3bde4a01c241cabcc74" },
"mason.nvim": { "branch": "main", "commit": "e110bc3be1a7309617cecd77bfe4bf86ba1b8134" },
"minintro.nvim": { "branch": "master", "commit": "b7fa58cc549e8d2b362a217a7620d9aedc47d47e" },
"neotest": { "branch": "master", "commit": "1ee3fcc150207f33dba8c9b3f478e5a0148d661d" },
"neotest-go": { "branch": "main", "commit": "d29d20d912aca81a07c50022d880cc66f0d26542" },
"neotest-phpunit": { "branch": "main", "commit": "e2dfa3280d2a33495a3f710bc364d2cfd1f40c83" }, "neotest-phpunit": { "branch": "main", "commit": "e2dfa3280d2a33495a3f710bc364d2cfd1f40c83" },
"nightfly": { "branch": "master", "commit": "06ad2689ebd251a71c6caeb9fb47e231773c9b47" },
"nvim-cmp": { "branch": "main", "commit": "0b751f6beef40fd47375eaf53d3057e0bfa317e4" },
"nvim-colorizer.lua": { "branch": "master", "commit": "dde3084106a70b9a79d48f426f6d6fec6fd203f7" },
"nvim-lint": { "branch": "master", "commit": "775ae0e5a451dd6c5d15de7a828ea72d2c54e8cf" },
"nvim-lsp-file-operations": { "branch": "master", "commit": "1e0ffa0acc92f88f9f2b68df47ccbe1917653a42" },
"nvim-lspconfig": { "branch": "master", "commit": "90a28fd7637b66e055af62387ecee06f7cbd3173" },
"nvim-tree.lua": { "branch": "master", "commit": "874ae6e9445a5eb5ba430e5fd10212450a261ad7" },
"nvim-treesitter": { "branch": "master", "commit": "075a64addc33390028ea124a1046a43497f05cd1" },
"nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" },
"nvim-web-devicons": { "branch": "master", "commit": "3fafeea5f339223e888fd15eb4032260849cb038" },
"oil.nvim": { "branch": "master", "commit": "3727410e4875ad8ba339c585859a9391d643b9ed" },
"plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" },
"nightfly": { "branch": "master", "commit": "0c6e2e88bf15634af94a91fcc2e20e28a09dfecd" },
"nui.nvim": { "branch": "main", "commit": "35da9ca1de0fc4dda96c2e214d93d363c145f418" },
"nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" },
"nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" },
"nvim-lint": { "branch": "master", "commit": "8df53b5dde8ea80f0a039775777eae6648a10229" },
"nvim-lsp-file-operations": { "branch": "master", "commit": "8e7223e138590c1bd9d86d3de810e65939d8b12f" },
"nvim-lspconfig": { "branch": "master", "commit": "796394fd19fb878e8dbc4fd1e9c9c186ed07a5f4" },
"nvim-tree.lua": { "branch": "master", "commit": "b8c3a23e76f861d5f0ff3f6714b9b56388984d0b" },
"nvim-treesitter": { "branch": "master", "commit": "8cd2b230174efbf7b5d9f49fe2f90bda6b5eb16e" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "85b9d0cbd4ff901abcda862b50dbb34e0901848b" },
"nvim-ts-autotag": { "branch": "main", "commit": "8515e48a277a2f4947d91004d9aa92c29fdc5e18" },
"nvim-web-devicons": { "branch": "master", "commit": "db0c864375c198cacc171ff373e76bfce2a85045" },
"oil.nvim": { "branch": "master", "commit": "c4cc8240f1c71defcb67c45da96e44b968d29e5f" },
"plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
"telescope-undo.nvim": { "branch": "main", "commit": "a3dcb6e32a3a59a5570a7cda33171eeef9753345" },
"telescope.nvim": { "branch": "0.1.x", "commit": "7011eaae0ac1afe036e30c95cf80200b8dc3f21a" },
"telescope-undo.nvim": { "branch": "main", "commit": "d3afc1c105535a90caec092ce27a113f77ba7b84" },
"telescope.nvim": { "branch": "0.1.x", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" },
"undotree": { "branch": "master", "commit": "36ff7abb6b60980338344982ad4cdf03f7961ecd" }, "undotree": { "branch": "master", "commit": "36ff7abb6b60980338344982ad4cdf03f7961ecd" },
"vim-fugitive": { "branch": "master", "commit": "46eaf8918b347906789df296143117774e827616" },
"vim-dotenv": { "branch": "master", "commit": "5c51cfcf8d87280d6414e03cd6b253eb70ecb800" },
"vim-fugitive": { "branch": "master", "commit": "59659093581aad2afacedc81f009ed6a4bfad275" },
"vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" } "vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" }
} }

+ 15
- 0
.config/nvim/lua/tovi/core/commands.lua View File

@ -0,0 +1,15 @@
local function ToggleTabs()
local options = {"tabstop", "softtabstop", "shiftwidth"}
for _, option in ipairs(options) do
local current_value = vim.opt[option]:get()
vim.opt[option] = (current_value == 4) and 2 or 4
end
end
vim.api.nvim_create_user_command(
'ToggleTabs',
ToggleTabs,
{ nargs = 0 }
)

+ 1
- 0
.config/nvim/lua/tovi/core/init.lua View File

@ -1,4 +1,5 @@
require('tovi.core.options') require('tovi.core.options')
require('tovi.core.remaps') require('tovi.core.remaps')
require('tovi.core.autocmd') require('tovi.core.autocmd')
require('tovi.core.commands')

+ 1
- 0
.config/nvim/lua/tovi/plugins/formatting.lua View File

@ -18,6 +18,7 @@ return {
rust = { "rustfmt" }, rust = { "rustfmt" },
shell = { "shfmt", "shellcheck" }, shell = { "shfmt", "shellcheck" },
python = { "isort", "black" }, python = { "isort", "black" },
php = { "phpcbf" }
}, },
-- format_on_save = { -- format_on_save = {
-- lsp_fallback = true, -- lsp_fallback = true,


+ 19
- 11
.config/nvim/lua/tovi/plugins/harpoon.lua View File

@ -1,41 +1,49 @@
return { return {
"ThePrimeagen/harpoon", "ThePrimeagen/harpoon",
branch = "harpoon2",
dependencies = { dependencies = {
"nvim-lua/plenary.nvim", "nvim-lua/plenary.nvim",
}, },
config = function() config = function()
local mark = require("harpoon.mark")
local ui = require("harpoon.ui")
local harpoon = require("harpoon")
-- REQUIRED
harpoon:setup()
-- REQUIRED
-- set keymaps -- set keymaps
local keymap = vim.keymap -- for conciseness local keymap = vim.keymap -- for conciseness
keymap.set("n", "<leader>a", mark.add_file, { desc = "Mark file with harpoon" })
keymap.set("n", "<leader>th", mark.toggle_file, { desc = "Toggle file with harpoon" })
keymap.set("n", "<C-e>", ui.toggle_quick_menu, { desc = "Toggle quick menu for harpoon" })
keymap.set("n", "<leader>a", function ()
harpoon:list():append()
end, { desc = "Mark file with harpoon" })
keymap.set("n", "<C-e>", function ()
harpoon.ui:toggle_quick_menu()
end, { desc = "Toggle quick menu for harpoon" })
keymap.set("n", "<C-,>", function() keymap.set("n", "<C-,>", function()
ui.nav_prev()
harpoon:list():prev()
end, { desc = "Go to previous harpoon mark" }) end, { desc = "Go to previous harpoon mark" })
keymap.set("n", "<C-.>", function() keymap.set("n", "<C-.>", function()
ui.nav_next()
harpoon:list():next()
end, { desc = "Go to next harpoon mark" }) end, { desc = "Go to next harpoon mark" })
keymap.set("n", "<C-h>", function() keymap.set("n", "<C-h>", function()
ui.nav_file(1)
harpoon:list():select(1)
end, { desc = "Go to first harpoon file" }) end, { desc = "Go to first harpoon file" })
keymap.set("n", "<C-j>", function() keymap.set("n", "<C-j>", function()
ui.nav_file(2)
harpoon:list():select(2)
end, { desc = "Go to second harpoon file" }) end, { desc = "Go to second harpoon file" })
keymap.set("n", "<C-k>", function() keymap.set("n", "<C-k>", function()
ui.nav_file(3)
harpoon:list():select(3)
end, { desc = "Go to third harpoon file" }) end, { desc = "Go to third harpoon file" })
keymap.set("n", "<C-l>", function() keymap.set("n", "<C-l>", function()
ui.nav_file(4)
harpoon:list():select(4)
end, { desc = "Go to fourth harpoon file" }) end, { desc = "Go to fourth harpoon file" })
end, end,
} }

+ 75
- 0
.config/nvim/lua/tovi/plugins/laravel.lua View File

@ -0,0 +1,75 @@
return {
"tovijaeschke/laravel.nvim",
dependencies = {
"nvim-telescope/telescope.nvim",
"tpope/vim-dotenv",
"MunifTanjim/nui.nvim",
-- "nvimtools/none-ls.nvim",
},
cmd = { "Sail", "Artisan", "Composer", "Npm", "Yarn", "Laravel" },
keys = {
{ "<leader>la", ":Laravel artisan<cr>" },
{ "<leader>lr", ":Laravel routes<cr>" },
{ "<leader>lm", ":Laravel related<cr>" },
},
event = { "VeryLazy" },
config = function ()
local laravel = require("laravel")
laravel.setup({
lsp_server = "intelephense",
features = {
null_ls = {
enable = false,
},
},
environments = {
env_variable = "NVIM_LARAVEL_ENV",
auto_dicover = false,
default = "docker-compose",
definitions = {
{
name = "sail",
condition = {
file_exists = { "vendor/bin/sail", "docker-compose.yml" },
},
commands = {
sail = { "vendor/bin/sail" },
{
commands = { "php", "composer", "npm", "yarn" },
prefix = { "vendor/bin/sail" },
},
},
},
{
name = "docker-compose",
condition = {
file_exists = { "docker-compose.yml" },
executable = { "docker" },
},
commands = {
compose = { "docker", "compose" },
{
commands = { "php", "composer", "npm" },
docker = {
container = {
env = "APP_SERVICE",
default = "fpm",
},
exec = { "docker", "compose", "exec", "-it" },
run = { "docker", "compose", "run" },
},
},
},
},
{
name = "local",
condition = {
executable = { "php" },
},
},
}
}
})
end,
}

+ 4
- 0
.config/nvim/lua/tovi/plugins/linting.lua View File

@ -4,6 +4,10 @@ return {
config = function() config = function()
local lint = require("lint") local lint = require("lint")
lint.linters.ecs = {
cmd = "ecs",
}
lint.linters_by_ft = { lint.linters_by_ft = {
javascript = { "eslint_d" }, javascript = { "eslint_d" },
typescript = { "eslint_d" }, typescript = { "eslint_d" },


+ 13
- 0
.config/nvim/lua/tovi/plugins/lsp/lspconfig.lua View File

@ -8,6 +8,7 @@ return {
config = function() config = function()
-- import lspconfig plugin -- import lspconfig plugin
local lspconfig = require("lspconfig") local lspconfig = require("lspconfig")
local util = require("lspconfig.util")
-- import cmp-nvim-lsp plugin -- import cmp-nvim-lsp plugin
local cmp_nvim_lsp = require("cmp_nvim_lsp") local cmp_nvim_lsp = require("cmp_nvim_lsp")
@ -114,8 +115,20 @@ return {
-- configure php server -- configure php server
lspconfig["intelephense"].setup({ lspconfig["intelephense"].setup({
root_dir = function(pattern)
local cwd = vim.loop.cwd()
local root = util.root_pattern('composer.json')(pattern)
-- prefer cwd if root is a descendant
return util.path.is_descendant(cwd, root) and cwd or root
end,
capabilities = capabilities, capabilities = capabilities,
on_attach = on_attach, on_attach = on_attach,
init_options = {
licenceKey = "/home/tovi/.local/share/nvim/intelephense-licence.txt"
},
settings = {
}
}) })
-- configure python server -- configure python server


+ 1
- 1
.config/nvim/lua/tovi/plugins/lsp/mason.lua View File

@ -47,7 +47,7 @@ return {
"eslint_d", "eslint_d",
"jsonlint", "jsonlint",
"markdownlint", "markdownlint",
"phpcs",
"tlint",
"gospel", "gospel",
"golangci-lint", "golangci-lint",
"pylint", "pylint",


+ 100
- 0
.config/nvim/lua/tovi/plugins/nvim-treesitter-textobjects.lua View File

@ -0,0 +1,100 @@
return {
lazy = false,
enabled = true,
dependencies = { "nvim-treesitter/nvim-treesitter" },
config = function()
require("nvim-treesitter.configs").setup({
incremental_selection = {
enable = true,
keymaps = {
-- mappings for incremental selection (visual mappings)
init_selection = "gnn", -- maps in normal mode to init the node/scope selection
node_incremental = "grn", -- increment to the upper named parent
scope_incremental = "grc", -- increment to the upper scope (as defined in locals.scm)
node_decremental = "grm", -- decrement to the previous node
},
},
textobjects = {
-- syntax-aware textobjects
enable = true,
lsp_interop = {
enable = true,
peek_definition_code = {
["af"] = "@function.outer",
["if"] = "@class.outer",
},
},
keymaps = {
["iL"] = {
-- you can define your own textobjects directly here
go = "(function_definition) @function",
},
-- or you use the queries from supported languages with textobjects.scm
["af"] = "@function.outer",
["if"] = "@function.inner",
["aC"] = "@class.outer",
["iC"] = "@class.inner",
["ac"] = "@conditional.outer",
["ic"] = "@conditional.inner",
["ae"] = "@block.outer",
["ie"] = "@block.inner",
["al"] = "@loop.outer",
["il"] = "@loop.inner",
["is"] = "@statement.inner",
["as"] = "@statement.outer",
["ad"] = "@comment.outer",
["am"] = "@call.outer",
["im"] = "@call.inner",
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
["]m"] = "@function.outer",
["]]"] = "@class.outer",
},
goto_next_end = {
["]M"] = "@function.outer",
["]["] = "@class.outer",
},
goto_previous_start = {
["[m"] = "@function.outer",
["[["] = "@class.outer",
},
goto_previous_end = {
["[M"] = "@function.outer",
["[]"] = "@class.outer",
},
},
select = {
enable = true,
keymaps = {
-- You can use the capture groups defined in textobjects.scm
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
-- Or you can define your own textobjects like this
["iF"] = {
python = "(function_definition) @function",
cpp = "(function_definition) @function",
c = "(function_definition) @function",
java = "(method_declaration) @function",
go = "(method_declaration) @function",
},
},
},
swap = {
enable = true,
swap_next = {
["<leader>a"] = "@parameter.inner",
},
swap_previous = {
["<leader>A"] = "@parameter.inner",
},
},
},
})
end,
}

+ 96
- 4
.config/nvim/lua/tovi/plugins/nvim-treesitter.lua View File

@ -5,13 +5,15 @@ return {
build = ":TSUpdate", build = ":TSUpdate",
dependencies = { dependencies = {
"windwp/nvim-ts-autotag", "windwp/nvim-ts-autotag",
"nvim-treesitter/nvim-treesitter-textobjects",
}, },
config = function() config = function()
-- import nvim-treesitter plugin -- import nvim-treesitter plugin
local treesitter = require("nvim-treesitter.configs") local treesitter = require("nvim-treesitter.configs")
-- configure treesitter -- configure treesitter
treesitter.setup({ -- enable syntax highlighting
treesitter.setup({
-- enable syntax highlighting
highlight = { highlight = {
enable = true, enable = true,
}, },
@ -47,7 +49,97 @@ return {
}, },
-- auto install above language parsers -- auto install above language parsers
auto_install = true, auto_install = true,
})
end,
},
textobjects = {
select = {
enable = true,
-- Automatically jump forward to textobj, similar to targets.vim
lookahead = true,
keymaps = {
-- You can use the capture groups defined in textobjects.scm
["aa"] = "@parameter.outer",
["ia"] = "@parameter.inner",
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
["ab"] = "@block.outer",
["ib"] = "@block.inner",
["al"] = "@loop.outer",
["il"] = "@loop.inner",
["am"] = "@call.outer",
["im"] = "@call.inner",
["ai"] = "@conditional.outer",
["ii"] = "@conditional.inner",
},
selection_modes = {
['@parameter.outer'] = 'v', -- charwise
['@function.outer'] = 'V', -- linewise
['@class.outer'] = '<c-v>', -- blockwise
},
include_surrounding_whitespace = true,
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
["]m"] = "@function.outer",
["]]"] = "@class.outer",
},
goto_next_end = {
["]M"] = "@function.outer",
["]["] = "@class.outer",
},
goto_previous_start = {
["[m"] = "@function.outer",
["[["] = "@class.outer",
},
goto_previous_end = {
["[M"] = "@function.outer",
["[]"] = "@class.outer",
},
goto_next = {
["]i"] = "@conditional.outer",
["]l"] = "@loop.outer",
},
goto_previous = {
["[i"] = "@conditional.outer",
["[l"] = "@loop.outer",
}
},
swap = {
enable = true,
swap_next = {
["<leader>s"] = "@parameter.inner",
},
swap_previous = {
["<leader>S"] = "@parameter.inner",
},
},
},
})
local ts_repeat_move = require("nvim-treesitter.textobjects.repeatable_move")
local keymap = vim.keymap
-- vim way: ; goes to the direction you were moving.
keymap.set({ "n", "x", "o" }, ";", ts_repeat_move.repeat_last_move)
keymap.set({ "n", "x", "o" }, ",", ts_repeat_move.repeat_last_move_opposite)
-- Optionally, make builtin f, F, t, T also repeatable with ; and ,
keymap.set({ "n", "x", "o" }, "f", ts_repeat_move.builtin_f)
keymap.set({ "n", "x", "o" }, "F", ts_repeat_move.builtin_F)
keymap.set({ "n", "x", "o" }, "t", ts_repeat_move.builtin_t)
keymap.set({ "n", "x", "o" }, "T", ts_repeat_move.builtin_T)
end,
},
} }

Loading…
Cancel
Save