diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-02-23 15:19:26 +0100 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-02-23 15:19:26 +0100 |
commit | 208ddaa76019af05d1e0f352912dab38ceedad6b (patch) | |
tree | eafd9aefa77d7cf9581c2e4de87968d700d74aaf /src/blog/nvim-ts/get-cursor.diff | |
parent | ab6d91982264623ae626115349d2c8a7579f1b1e (diff) |
Add nvim-ts article
Diffstat (limited to 'src/blog/nvim-ts/get-cursor.diff')
-rw-r--r-- | src/blog/nvim-ts/get-cursor.diff | 12 |
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, |