From 3f12734cd387b6fca9e315835e9472ccc03de929 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 16 May 2024 18:01:11 +0100 Subject: [PATCH] Update treesitter configuration Replace usages of custom keybinding functions with `vim.keymap.set()`. --- after/plugin/treesitter.lua | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/after/plugin/treesitter.lua b/after/plugin/treesitter.lua index b961f97..df5bd1a 100644 --- a/after/plugin/treesitter.lua +++ b/after/plugin/treesitter.lua @@ -2,9 +2,6 @@ local configs = require "nvim-treesitter.configs" local context = require "treesitter-context" local ts_repeat_move = require "nvim-treesitter.textobjects.repeatable_move" -local map = require("opdavies.keymap").map -local nmap = require("opdavies.keymap").nmap - configs.setup { autotag = { enable = true, @@ -121,17 +118,19 @@ configs.setup { }, } -nmap { "th", "TSHighlightCapturesUnderCursor" } -nmap { "tp", "TSPlaygroundToggle" } +local set = vim.keymap.set + +set("n", "th", "TSHighlightCapturesUnderCursor") +set("n", "tp", "TSPlaygroundToggle") -- vim way: ; goes to the direction you were moving. -map { { "n", "o", "x" }, ";", ts_repeat_move.repeat_last_move } -map { { "n", "o", "x" }, ",", ts_repeat_move.repeat_last_move_opposite } +set({ "n", "o", "x" }, ";", ts_repeat_move.repeat_last_move) +set({ "n", "o", "x" }, ",", ts_repeat_move.repeat_last_move_opposite) -- Optionally, make builtin f, F, t, T also repeatable with ; and , -map { { "n", "o", "x" }, "f", ts_repeat_move.builtin_f } -map { { "n", "o", "x" }, "F", ts_repeat_move.builtin_F } -map { { "n", "o", "x" }, "t", ts_repeat_move.builtin_t } -map { { "n", "o", "x" }, "T", ts_repeat_move.builtin_T } +set({ "n", "o", "x" }, "f", ts_repeat_move.builtin_f) +set({ "n", "o", "x" }, "F", ts_repeat_move.builtin_F) +set({ "n", "o", "x" }, "t", ts_repeat_move.builtin_t) +set({ "n", "o", "x" }, "T", ts_repeat_move.builtin_T) context.setup { enable = true }