feat(nvim): add nvim-treesitter-context

This commit is contained in:
Oliver Davies 2022-09-01 21:58:44 +01:00
parent cf0a317b23
commit 976045d1ca
2 changed files with 13 additions and 5 deletions

View file

@ -1,5 +1,5 @@
local status_ok, configs = pcall(require, "nvim-treesitter.configs") local has_configs, configs = pcall(require, "nvim-treesitter.configs")
if not status_ok then if not has_configs then
return return
end end
@ -53,7 +53,14 @@ configs.setup {
}, },
} }
local nmap = require "opdavies.keymap".nmap local nmap = require("opdavies.keymap").nmap
nmap({ "<leader>th", "<cmd>TSHighlightCapturesUnderCursor<CR>" }) nmap { "<leader>th", "<cmd>TSHighlightCapturesUnderCursor<CR>" }
nmap({ "<leader>tp", "<cmd>TSPlaygroundToggle<CR>" }) nmap { "<leader>tp", "<cmd>TSPlaygroundToggle<CR>" }
local has_context, context = pcall(require, "treesitter-context")
if not has_context then
return
end
context.setup { enable = true }

View file

@ -69,6 +69,7 @@ return packer.startup(function()
-- Treesitter -- Treesitter
use "nvim-treesitter/playground" use "nvim-treesitter/playground"
use 'nvim-treesitter/nvim-treesitter-context'
use { use {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
run = ":TSUpdate", run = ":TSUpdate",