forked from ayamir/nvimdots
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ts-context-commentstring)!: setup as a plugin (ayamir#1067)
* feat(ts-context-commentstring)!: setup as a plugin Ref: JoosepAlviste/nvim-ts-context-commentstring@5b02387 * fixup! feat(ts-context-commentstring)!: setup as a plugin
- Loading branch information
Showing
3 changed files
with
78 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,62 @@ | ||
return vim.schedule_wrap(function() | ||
local use_ssh = require("core.settings").use_ssh | ||
local use_ssh = require("core.settings").use_ssh | ||
|
||
vim.api.nvim_set_option_value("foldmethod", "expr", {}) | ||
vim.api.nvim_set_option_value("foldexpr", "nvim_treesitter#foldexpr()", {}) | ||
|
||
require("modules.utils").load_plugin("nvim-treesitter", { | ||
ensure_installed = require("core.settings").treesitter_deps, | ||
highlight = { | ||
enable = true, | ||
disable = function(ft, bufnr) | ||
if vim.tbl_contains({ "vim" }, ft) then | ||
return true | ||
end | ||
require("modules.utils").load_plugin("nvim-treesitter", { | ||
ensure_installed = require("core.settings").treesitter_deps, | ||
highlight = { | ||
enable = true, | ||
disable = function(ft, bufnr) | ||
if vim.tbl_contains({ "vim" }, ft) then | ||
return true | ||
end | ||
|
||
local ok, is_large_file = pcall(vim.api.nvim_buf_get_var, bufnr, "bigfile_disable_treesitter") | ||
return ok and is_large_file | ||
end, | ||
additional_vim_regex_highlighting = false, | ||
}, | ||
textobjects = { | ||
select = { | ||
enable = true, | ||
keymaps = { | ||
["af"] = "@function.outer", | ||
["if"] = "@function.inner", | ||
["ac"] = "@class.outer", | ||
["ic"] = "@class.inner", | ||
}, | ||
}, | ||
move = { | ||
enable = true, | ||
set_jumps = true, -- whether to set jumps in the jumplist | ||
goto_next_start = { | ||
["]["] = "@function.outer", | ||
["]m"] = "@class.outer", | ||
}, | ||
goto_next_end = { | ||
["]]"] = "@function.outer", | ||
["]M"] = "@class.outer", | ||
}, | ||
goto_previous_start = { | ||
["[["] = "@function.outer", | ||
["[m"] = "@class.outer", | ||
}, | ||
goto_previous_end = { | ||
["[]"] = "@function.outer", | ||
["[M"] = "@class.outer", | ||
}, | ||
}, | ||
}, | ||
context_commentstring = { enable = true, enable_autocmd = false }, | ||
indent = { enable = true }, | ||
matchup = { enable = true }, | ||
}, false, require("nvim-treesitter.configs").setup) | ||
require("nvim-treesitter.install").prefer_git = true | ||
if use_ssh then | ||
local parsers = require("nvim-treesitter.parsers").get_parser_configs() | ||
for _, p in pairs(parsers) do | ||
p.install_info.url = p.install_info.url:gsub("https://github.com/", "git@github.com:") | ||
end | ||
end | ||
local ok, is_large_file = pcall(vim.api.nvim_buf_get_var, bufnr, "bigfile_disable_treesitter") | ||
return ok and is_large_file | ||
end, | ||
additional_vim_regex_highlighting = false, | ||
}, | ||
textobjects = { | ||
select = { | ||
enable = true, | ||
keymaps = { | ||
["af"] = "@function.outer", | ||
["if"] = "@function.inner", | ||
["ac"] = "@class.outer", | ||
["ic"] = "@class.inner", | ||
}, | ||
}, | ||
move = { | ||
enable = true, | ||
set_jumps = true, -- whether to set jumps in the jumplist | ||
goto_next_start = { | ||
["]["] = "@function.outer", | ||
["]m"] = "@class.outer", | ||
}, | ||
goto_next_end = { | ||
["]]"] = "@function.outer", | ||
["]M"] = "@class.outer", | ||
}, | ||
goto_previous_start = { | ||
["[["] = "@function.outer", | ||
["[m"] = "@class.outer", | ||
}, | ||
goto_previous_end = { | ||
["[]"] = "@function.outer", | ||
["[M"] = "@class.outer", | ||
}, | ||
}, | ||
}, | ||
indent = { enable = true }, | ||
matchup = { enable = true }, | ||
}, false, require("nvim-treesitter.configs").setup) | ||
require("nvim-treesitter.install").prefer_git = true | ||
if use_ssh then | ||
local parsers = require("nvim-treesitter.parsers").get_parser_configs() | ||
for _, p in pairs(parsers) do | ||
p.install_info.url = p.install_info.url:gsub("https://github.com/", "git@github.com:") | ||
end | ||
end | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
return function() | ||
vim.g.skip_ts_context_commentstring_module = true | ||
require("modules.utils").load_plugin("ts_context_commentstring", { | ||
-- Whether to update the `commentstring` on the `CursorHold` autocmd | ||
enable_autocmd = false, | ||
}) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters