diff options
| author | Stephan Seitz <stephan.seitz@fau.de> | 2020-08-22 20:46:40 +0200 |
|---|---|---|
| committer | Thomas Vigouroux <39092278+vigoux@users.noreply.github.com> | 2020-08-31 18:56:41 +0200 |
| commit | 5948aba886e8aad26043402684cf85c307813c4d (patch) | |
| tree | ea402ab5c1468fb76c49a0e1f39a6c60b1260831 /lua/nvim-treesitter/textobjects | |
| parent | ffe7d96dfda89857a757656ba9e4b079fff6e33f (diff) | |
feat(refactor.navigation): add navigation.goto_{next,previous}_usage
Diffstat (limited to 'lua/nvim-treesitter/textobjects')
| -rw-r--r-- | lua/nvim-treesitter/textobjects/move.lua | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/lua/nvim-treesitter/textobjects/move.lua b/lua/nvim-treesitter/textobjects/move.lua index 8cfb7118..1dd2f132 100644 --- a/lua/nvim-treesitter/textobjects/move.lua +++ b/lua/nvim-treesitter/textobjects/move.lua @@ -1,7 +1,6 @@ -local utils = require'nvim-treesitter.utils' +local ts_utils = require'nvim-treesitter.ts_utils' local shared = require'nvim-treesitter.textobjects.shared' local attach = require'nvim-treesitter.textobjects.attach' -local api = vim.api local M = {} @@ -9,18 +8,7 @@ function M.goto_adjacent(query_string, forward, start, same_parent, overlapping_ local bufnr, _, node = shared.textobject_at_point(query_string) local adjacent = shared.get_adjacent(forward, node, query_string, same_parent, overlapping_range_ok, bufnr) - if adjacent then - utils.set_jump() - - local adjacent_textobject_range = {adjacent:range()} - local position - if start then - position = { adjacent_textobject_range[1] + 1, adjacent_textobject_range[2] } - else - position = { adjacent_textobject_range[3] + 1, adjacent_textobject_range[4] } - end - api.nvim_win_set_cursor(api.nvim_get_current_win(), position) - end + ts_utils.goto_node(adjacent, not start) end -- luacheck: push ignore 631 |
