From 3362f4519671da29b437c48a7c54bec8550a4f9d Mon Sep 17 00:00:00 2001 From: Stephan Seitz Date: Sun, 20 Sep 2020 23:20:37 +0200 Subject: Remove textobjects module --- lua/nvim-treesitter/textobjects/attach.lua | 59 ------------------------------ 1 file changed, 59 deletions(-) delete mode 100644 lua/nvim-treesitter/textobjects/attach.lua (limited to 'lua/nvim-treesitter/textobjects/attach.lua') diff --git a/lua/nvim-treesitter/textobjects/attach.lua b/lua/nvim-treesitter/textobjects/attach.lua deleted file mode 100644 index c7f44375..00000000 --- a/lua/nvim-treesitter/textobjects/attach.lua +++ /dev/null @@ -1,59 +0,0 @@ -local configs = require'nvim-treesitter.configs' -local parsers = require'nvim-treesitter.parsers' -local queries = require'nvim-treesitter.query' -local api = vim.api -local M = {} - -function M.make_attach(normal_mode_functions, submodule) - return function(bufnr, lang) - local config = configs.get_module("textobjects."..submodule) - local lang = lang or parsers.get_buf_lang(bufnr) - - for _, function_call in pairs(normal_mode_functions) do - for mapping, query in pairs(config[function_call] or {}) do - if type(query) == 'table' then - query = query[lang] - elseif not queries.get_query(lang, 'textobjects') then - query = nil - end - if query then - local cmd = ":lua require'nvim-treesitter.textobjects."..submodule.."'."..function_call.."('"..query.."')" - api.nvim_buf_set_keymap(bufnr, "n", mapping, cmd, {silent = true, noremap = true }) - end - end - end - end -end - -function M.make_detach(normal_mode_functions, submodule) - return function(bufnr) - local config = configs.get_module("textobjects."..submodule) - local lang = parsers.get_buf_lang(bufnr) - - for mapping, query in pairs(config.keymaps) do - if type(query) == 'table' then - query = query[lang] - elseif not queries.get_query(lang, 'textobjects') then - query = nil - end - if query then - api.nvim_buf_del_keymap(bufnr, "o", mapping) - api.nvim_buf_del_keymap(bufnr, "v", mapping) - end - end - for _, function_call in pairs(normal_mode_functions) do - for mapping, query in pairs(config[function_call] or {}) do - if type(query) == 'table' then - query = query[lang] - elseif not queries.get_query(lang, 'textobjects') then - query = nil - end - if query then - api.nvim_buf_del_keymap(bufnr, "n", mapping) - end - end - end - end -end - -return M -- cgit v1.2.3