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

Compare commits

...

6 Commits

Author SHA1 Message Date
Martin
efae5c75ca
Merge 4d289d16b3f619e12b62b8971db6818c420e39eb into 69d8543495446040d03a5217aea4684889d3f64f 2024-05-20 16:50:42 -04:00
jdhao
69d8543495 remove emmylua since neovim has builtin annotation
Seee also this https://github.com/neovim/neovim/pull/24493
2024-05-20 22:09:07 +02:00
jdhao
be3d134c37 use vim.uv instead of vim.loop 2024-05-20 21:52:52 +02:00
jdhao
601396f700 upgrade neovim to latest stable
The way to compare versions are changed due to a bug in comparing
versions in the neovim core: https://github.com/neovim/neovim/issues/28782
2024-05-20 21:33:38 +02: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
6 changed files with 39 additions and 12 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

@ -14,11 +14,13 @@ vim.loader.enable()
local version = vim.version local version = vim.version
-- check if we have the latest stable version of nvim -- check if we have the latest stable version of nvim
local expected_ver = "0.9.5" local expected_ver = "0.10.0"
local ev = version.parse(expected_ver) local ev = version.parse(expected_ver)
local actual_ver = version() local actual_ver = version()
if version.cmp(ev, actual_ver) ~= 0 then local result = version.cmp(ev, {actual_ver.major, actual_ver.minor, actual_ver.patch})
if result ~= 0 then
local _ver = string.format("%s.%s.%s", actual_ver.major, actual_ver.minor, actual_ver.patch) local _ver = string.format("%s.%s.%s", actual_ver.major, actual_ver.minor, actual_ver.patch)
local msg = string.format("Expect nvim %s, but got %s instead. Use at your own risk!", expected_ver, _ver) local msg = string.format("Expect nvim %s, but got %s instead. Use at your own risk!", expected_ver, _ver)
vim.api.nvim_err_writeln(msg) vim.api.nvim_err_writeln(msg)

View File

@ -234,7 +234,7 @@ if utils.executable("lua-language-server") then
-- see also https://github.com/LuaLS/lua-language-server/wiki/Libraries#link-to-workspace . -- see also https://github.com/LuaLS/lua-language-server/wiki/Libraries#link-to-workspace .
-- Lua-dev.nvim also has similar settings for lua ls, https://github.com/folke/neodev.nvim/blob/main/lua/neodev/luals.lua . -- Lua-dev.nvim also has similar settings for lua ls, https://github.com/folke/neodev.nvim/blob/main/lua/neodev/luals.lua .
library = { library = {
fn.stdpath("data") .. "/lazy/emmylua-nvim", vim.env.VIMRUNTIME,
fn.stdpath("config"), fn.stdpath("config"),
}, },
maxPreload = 2000, maxPreload = 2000,

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

@ -1,6 +1,6 @@
local keymap = vim.keymap local keymap = vim.keymap
local api = vim.api local api = vim.api
local uv = vim.loop local uv = vim.uv
-- Save key strokes (now we do not need to press shift to enter command mode). -- Save key strokes (now we do not need to press shift to enter command mode).
keymap.set({ "n", "x" }, ";", ":") keymap.set({ "n", "x" }, ";", ":")

View File

@ -2,7 +2,7 @@ local utils = require("utils")
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then if not vim.uv.fs_stat(lazypath) then
vim.fn.system { vim.fn.system {
"git", "git",
"clone", "clone",
@ -50,7 +50,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
@ -480,7 +480,6 @@ local plugin_specs = {
end, end,
}, },
{ "ii14/emmylua-nvim", ft = "lua" },
{ {
"j-hui/fidget.nvim", "j-hui/fidget.nvim",
event = "VeryLazy", event = "VeryLazy",
@ -489,6 +488,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.