init
This commit is contained in:
33
polish.lua
Normal file
33
polish.lua
Normal file
@@ -0,0 +1,33 @@
|
||||
return function()
|
||||
--[[
|
||||
local function treesitter_is_parser_installed(filetype)
|
||||
if not filetype then return false end
|
||||
|
||||
local ok, parsers = pcall(require, "nvim-treesitter.parsers")
|
||||
if not ok then return false end
|
||||
local name = parsers.filetype_to_parsername[filetype]
|
||||
return name and #vim.api.nvim_get_runtime_file("parser/" .. name .. ".so", false) > 0
|
||||
end
|
||||
|
||||
-- Set foldmethod to treesitter only on BufEnter if we do have a parser and we're not in diffmode
|
||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWinEnter' }, {
|
||||
group = vim.api.nvim_create_augroup('TS_FOLD_WORKAROUND', {}),
|
||||
callback = function()
|
||||
if vim.wo.diff then return end
|
||||
if treesitter_is_parser_installed(vim.bo.filetype) then
|
||||
vim.wo.foldmethod = 'expr'
|
||||
vim.wo.foldexpr = 'nvim_treesitter#foldexpr()'
|
||||
end
|
||||
end
|
||||
})
|
||||
--]]
|
||||
|
||||
-- TODO Move to filetype plugin?
|
||||
vim.api.nvim_create_autocmd("TermOpen", {
|
||||
group = vim.api.nvim_create_augroup("term", { clear = true }),
|
||||
callback = function()
|
||||
vim.wo.number = false
|
||||
vim.wo.spell = false
|
||||
end
|
||||
})
|
||||
end
|
||||
Reference in New Issue
Block a user