1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00

Compare commits

...

5 Commits

Author SHA1 Message Date
Martin
c577779e6a
Merge 4d289d16b3f619e12b62b8971db6818c420e39eb into 6e137fe9a3ee215f82a46a05e77be51ac17151f7 2024-07-30 16:18:54 -07:00
jdhao
6e137fe9a3 make firenvim work again
1. fix build issue
2. fix PATH env issue
2024-07-31 07:09:50 +08:00
jdhao
719fbfc1ab update lua_ls settings 2024-07-31 05:42:33 +08:00
martin
4d289d16b3 update nvim-ufo 2024-01-24 22:50:18 +08:00
martin
90a0645d42 add nvim-ufo for folding 2024-01-19 15:44:08 +08:00
4 changed files with 46 additions and 17 deletions

View File

@ -1,6 +1,2 @@
" let the initial folding state be that all folds are closed. " let the initial folding state be that all folds are closed.
set foldlevel=0 setlocal foldlevel=0
" Use nvim-treesitter for folding
set foldmethod=expr
set foldexpr=nvim_treesitter#foldexpr()

View File

@ -231,11 +231,12 @@ if utils.executable("lua-language-server") then
}, },
workspace = { workspace = {
-- Make the server aware of Neovim runtime files, -- Make the server aware of Neovim runtime files,
-- see also https://github.com/LuaLS/lua-language-server/wiki/Libraries#link-to-workspace . -- see also https://luals.github.io/wiki/settings/#workspacelibrary
-- Lua-dev.nvim also has similar settings for lua ls, https://github.com/folke/neodev.nvim/blob/main/lua/neodev/luals.lua .
library = { library = {
vim.env.VIMRUNTIME, vim.env.VIMRUNTIME,
fn.stdpath("config"), fn.stdpath("config"),
-- make lua_ls aware of functions under vim.uv
"${3rd}/luv/library"
}, },
maxPreload = 2000, maxPreload = 2000,
preloadFileSize = 50000, preloadFileSize = 50000,

22
lua/config/ufo.lua Normal file
View File

@ -0,0 +1,22 @@
local keymap = vim.keymap
-- disable foldcolumn, see https://github.com/kevinhwang91/nvim-ufo/issues/4
vim.o.foldcolumn = '0'
vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
vim.o.foldlevelstart = 99
vim.o.foldenable = true -- Don't set nofoldenable in ftplugin
-- treesitter as a main provider instead
-- Only depend on `nvim-treesitter/queries/filetype/folds.scm`,
-- performance and stability are better than `foldmethod=nvim_treesitter#foldexpr()`
require('ufo').setup({
provider_selector = function(bufnr, filetype, buftype)
return {'treesitter', 'indent'}
end
})
local ufo = require('ufo')
keymap.set('n', 'zR', ufo.openAllFolds, { desc = 'Open all folds' })
keymap.set('n', 'zM', ufo.closeAllFolds, { desc = 'Close all folds' })
keymap.set('n', 'zr', ufo.openFoldsExceptKinds, { desc = 'Fold less' })
keymap.set('n', 'zm', ufo.closeFoldsWith, { desc = 'Fold more' })

View File

@ -15,6 +15,12 @@ end
vim.opt.rtp:prepend(lazypath) vim.opt.rtp:prepend(lazypath)
-- check if firenvim is active -- check if firenvim is active
-- macOS will reset the PATH when firenvim starts a nvim process, causing the PATH variable to change unexpectedly.
-- Here we are trying to get the correct PATH and use it for firenvim.
-- See also https://github.com/glacambre/firenvim/blob/master/TROUBLESHOOTING.md#make-sure-firenvims-path-is-the-same-as-neovims
local path_env = vim.env.PATH
local prologue = string.format('export PATH="%s"', path_env)
local firenvim_not_active = function() local firenvim_not_active = function()
return not vim.g.started_by_firenvim return not vim.g.started_by_firenvim
end end
@ -50,7 +56,7 @@ local plugin_specs = {
{ {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
enabled = function() enabled = function()
if vim.g.is_mac then if vim.g.is_mac or vim.g.is_linux then
return true return true
end end
return false return false
@ -419,17 +425,13 @@ local plugin_specs = {
{ {
"glacambre/firenvim", "glacambre/firenvim",
enabled = function() enabled = function()
if vim.g.is_win or vim.g.is_mac then local result = vim.g.is_win or vim.g.is_mac
return true return result
end
return false
end, end,
build = function() -- it seems that we can only call the firenvim function directly.
vim.fn["firenvim#install"](0) -- Using vim.fn or vim.cmd to call this function will fail.
end, build = string.format(":call firenvim#install(0, '%s')", prologue)
lazy = true,
}, },
-- Debugger plugin -- Debugger plugin
{ {
"sakhnik/nvim-gdb", "sakhnik/nvim-gdb",
@ -493,6 +495,14 @@ local plugin_specs = {
require("config.fidget-nvim") require("config.fidget-nvim")
end, end,
}, },
{
'kevinhwang91/nvim-ufo',
dependencies = {'kevinhwang91/promise-async'},
event = { "VeryLazy" },
config = function()
require("config.ufo")
end
}
} }
-- configuration for lazy itself. -- configuration for lazy itself.