summaryrefslogtreecommitdiff
path: root/lua/nvim-treesitter/textobjects/swap.lua
diff options
context:
space:
mode:
authorStephan Seitz <stephan.seitz@fau.de>2020-09-20 23:20:37 +0200
committerStephan Seitz <stephan.lauf@yahoo.de>2020-10-04 14:20:20 +0200
commit3362f4519671da29b437c48a7c54bec8550a4f9d (patch)
treed43fa3815b25e4a9178b4d15bfa134d4c13839b6 /lua/nvim-treesitter/textobjects/swap.lua
parent7f325538cca8682d931a944fbf74b35408022232 (diff)
Remove textobjects module
Diffstat (limited to 'lua/nvim-treesitter/textobjects/swap.lua')
-rw-r--r--lua/nvim-treesitter/textobjects/swap.lua35
1 files changed, 0 insertions, 35 deletions
diff --git a/lua/nvim-treesitter/textobjects/swap.lua b/lua/nvim-treesitter/textobjects/swap.lua
deleted file mode 100644
index bb681fdd..00000000
--- a/lua/nvim-treesitter/textobjects/swap.lua
+++ /dev/null
@@ -1,35 +0,0 @@
-local ts_utils = require'nvim-treesitter.ts_utils'
-local shared = require'nvim-treesitter.textobjects.shared'
-local attach = require'nvim-treesitter.textobjects.attach'
-
-local M = {}
-
-local function swap_textobject(query_string, direction)
- local bufnr, textobject_range, node = shared.textobject_at_point(query_string)
- if not node then return end
-
- local step = direction > 0 and 1 or -1
- local overlapping_range_ok = false
- local same_parent = true
- for _ = 1, math.abs(direction), step do
- local forward = direction > 0
- local adjacent = shared.get_adjacent(forward, node, query_string, same_parent, overlapping_range_ok, bufnr)
- ts_utils.swap_nodes(textobject_range, adjacent, bufnr, "yes, set cursor!")
- end
-end
-
-function M.swap_next(query_string)
- swap_textobject(query_string, 1)
-end
-
-function M.swap_previous(query_string)
- swap_textobject(query_string, -1)
-end
-
-local normal_mode_functions = {"swap_next",
- "swap_previous"}
-
-M.attach = attach.make_attach(normal_mode_functions, "swap")
-M.deattach = attach.make_detach(normal_mode_functions, "swap")
-
-return M