summaryrefslogtreecommitdiffhomepage
path: root/src/blog/nvim-ts/get-cursor.diff
diff options
context:
space:
mode:
Diffstat (limited to 'src/blog/nvim-ts/get-cursor.diff')
-rw-r--r--src/blog/nvim-ts/get-cursor.diff12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/blog/nvim-ts/get-cursor.diff b/src/blog/nvim-ts/get-cursor.diff
new file mode 100644
index 0000000..3e34afc
--- /dev/null
+++ b/src/blog/nvim-ts/get-cursor.diff
@@ -0,0 +1,12 @@
++local ts_utils = require('nvim-treesitter.ts_utils')
++
+ local function map(lhs, rhs)
+ vim.keymap.set('n', lhs, function()
+- -- TODO
++ local node = ts_utils.get_node_at_cursor()
++ if node == nil then
++ error('No Tree-Sitter parser found.')
++ end
+ end, {
+ buffer = true,
+ noremap = true,