summaryrefslogtreecommitdiffhomepage
path: root/src/blog/nvim-ts/get-cursor.diff.gsp
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2023-11-14 18:10:22 +0100
committerThomas Voss <mail@thomasvoss.com> 2023-11-14 18:10:22 +0100
commitea77956c0224d9f9997d60e91642a4e255750f5b (patch)
tree7d47222427808b35f9fe07fb5e3249d08fadf109 /src/blog/nvim-ts/get-cursor.diff.gsp
parentd31314638a4499ce36def937b61d2069f496eaaa (diff)
Add a new blog post
Diffstat (limited to 'src/blog/nvim-ts/get-cursor.diff.gsp')
-rw-r--r--src/blog/nvim-ts/get-cursor.diff.gsp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/blog/nvim-ts/get-cursor.diff.gsp b/src/blog/nvim-ts/get-cursor.diff.gsp
new file mode 100644
index 0000000..6e8f759
--- /dev/null
+++ b/src/blog/nvim-ts/get-cursor.diff.gsp
@@ -0,0 +1,12 @@
+@span .diff-ins {-+local ts_utils = require('nvim-treesitter.ts_utils')}
+@span .diff-ins {-+}
+ local function map(lhs, rhs)
+ vim.keymap.set('n', lhs, function()
+@span .diff-del {-- -- TODO}
+@span .diff-ins {-+ local node = ts_utils.get_node_at_cursor()}
+@span .diff-ins {-+ if node == nil then}
+@span .diff-ins {-+ error('No Tree-Sitter parser found.')}
+@span .diff-ins {-+ end}
+ end, {
+ buffer = true,
+ noremap = true,