summaryrefslogtreecommitdiffhomepage
path: root/src/blog/nvim-ts/get-cursor.diff
blob: 3e34afcf3ea5bb4ef88b5addf53f3a139b4a8ea6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
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,