From 5b2e7b2b7c6b3ac3556d4caeba0116af13f9dcb3 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Sun, 17 Sep 2023 23:00:07 +0200 Subject: Add text-objects --- fnl/plugins/editor/treesitter.fnl | 71 ++++++++++++++++++++++++--------------- lazy-lock.json | 2 ++ 2 files changed, 45 insertions(+), 28 deletions(-) diff --git a/fnl/plugins/editor/treesitter.fnl b/fnl/plugins/editor/treesitter.fnl index bb22287..1c85ea4 100644 --- a/fnl/plugins/editor/treesitter.fnl +++ b/fnl/plugins/editor/treesitter.fnl @@ -1,40 +1,55 @@ ;; Treesitter is a tool for building syntax trees for source files. ;; In the neovim context it helps with better coloring. -(local opts {:ensure_installed [:c - :dockerfile - :erlang - :fennel - :go - :haskell - :hcl - :html - :latex - :lua - :make - :markdown - :ocaml - :org - :python - :rust - :sql - :toml - :vim - :yaml] - :sync_install false - :ignore_install [""] - :autopairs {:enable true} - :highlight {:enable true - :additional_vim_regex_highlighting [:org]} - :context_commentstring {:enable true :enable_autocmd false} - :indent {:enable true :disable [:yaml :python :css]} - :playground {:enable true}}) +(local opts + {:ensure_installed [:c + :dockerfile + :erlang + :fennel + :go + :haskell + :hcl + :html + :latex + :lua + :make + :markdown + :ocaml + :org + :python + :rust + :sql + :toml + :vim + :yaml] + :sync_install false + :ignore_install [""] + :autopairs {:enable true} + :highlight {:enable true :additional_vim_regex_highlighting [:org]} + :context_commentstring {:enable true :enable_autocmd false} + :indent {:enable true :disable [:yaml :python :css]} + :playground {:enable true} + :textobjects {:select {:enable true + :lookahead true + :keymaps {:af "@function.outer" + :if "@function.inner" + :ac "@class.outer" + :ic {:query "@class.inner" + :desc "Select inner part of a class region"} + :as {:query "@scope" + :query_group :locals + :desc "Select language scope"}} + :selection_modes {"@parameter.outer" :v + "@function.outer" :V + "@class.outer" :} + :include_surrounding_whitespace true}}}) (fn setup [] (let [treesitter (require :nvim-treesitter.configs)] (treesitter.setup opts))) {1 :nvim-treesitter/nvim-treesitter + :dependencies [{1 :nvim-treesitter/nvim-treesitter-textobjects}] :build ":TSUpdate" :event :VeryLazy :config (fn [] diff --git a/lazy-lock.json b/lazy-lock.json index 25d7e1d..475dac4 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -30,6 +30,7 @@ "minibar.nvim": { "branch": "master", "commit": "353ca4efaf7fff1566bb02e0d7cb51133c41f660" }, "neo-tree.nvim": { "branch": "v2.x", "commit": "80dc74d081823649809f78370fa5b204aa9a853a" }, "neogit": { "branch": "master", "commit": "9d9355137b1e2503a47fedfc395e75a8330163e8" }, + "no-clown-fiesta.nvim": { "branch": "master", "commit": "a4bbbf9b82c54d2a36893f8abdce62084695301c" }, "nui.nvim": { "branch": "main", "commit": "c8de23342caf8d50b15d6b28368d36a56a69d76f" }, "null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" }, "nvim-autopairs": { "branch": "master", "commit": "defad64afbf19381fe31488a7582bbac421d6e38" }, @@ -41,6 +42,7 @@ "nvim-spectre": { "branch": "master", "commit": "97cfd1b0f5a6ab35979ce1bee6c17f54745fd1e5" }, "nvim-surround": { "branch": "main", "commit": "1c2ef599abeeb98e40706830bcd27e90e259367a" }, "nvim-treesitter": { "branch": "master", "commit": "9dd3e07609c5b74c5ac4193d0ce4fe91fb406fea" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "bd103502252027434ec42f628d2dbf54821d4ce6" }, "nvim-web-devicons": { "branch": "master", "commit": "973ab742f143a796a779af4d786ec409116a0d87" }, "nvim-window-picker": { "branch": "main", "commit": "1b1bb834b0acb9eebb11a61664efc665757f1ba2" }, "orgmode": { "branch": "master", "commit": "34f977c090da2ff9f8cea01eecae8bd7d83fdef9" }, -- cgit v1.2.3-70-g09d2