Skip to content

Commit

Permalink
Unconditionally run treesitter configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
simonrw committed Dec 18, 2023
1 parent 57fda8a commit a8f6877
Showing 1 changed file with 25 additions and 31 deletions.
56 changes: 25 additions & 31 deletions home/nvim/lua/treesitterconfig.lua
Original file line number Diff line number Diff line change
@@ -1,35 +1,29 @@
local function setup()
local ts = require('nvim-treesitter.configs')
local ts = require('nvim-treesitter.configs')

ts.setup {
highlight = {
enable = true,
use_languagetree = true,
disable = {
"gitcommit",
},
},
indent = {
enable = false,
ts.setup {
highlight = {
enable = true,
use_languagetree = true,
disable = {
"gitcommit",
},
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
},
include_surrounding_whitespace = function(query_string, selection_mode)
return query_string == "@function.outer" or query_string == "@class.outer"
end,
},
indent = {
enable = false,
},
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
},
include_surrounding_whitespace = function(query_string, selection_mode)
return query_string == "@function.outer" or query_string == "@class.outer"
end,
},
}
end

if vim.fn.has('nvim-0.5') and vim.g.include_treesitter then
setup()
end
},
}

0 comments on commit a8f6877

Please sign in to comment.