diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 422b8b6..ece59b0 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -65,11 +65,18 @@ vim.o.undodir = vim.env.XDG_CACHE_HOME .. "/vim/undo" vim.g.python_host_prog = '/usr/bin/python2' vim.g.python3_host_prog = '/usr/bin/python3' --- append +-- display certain invisible chars vim.opt.list = true vim.opt.listchars:append "space:·" vim.opt.listchars:append "eol:" +-- folding +vim.o.foldcolumn = '0' +vim.o.foldlevel = 99 +vim.o.foldlevelstart = 99 +vim.o.foldenable = true + + -- set filetypes correctly by extension require('autocmd') diff --git a/.config/nvim/lua/loadplugins.lua b/.config/nvim/lua/loadplugins.lua index de5816d..139d8f0 100644 --- a/.config/nvim/lua/loadplugins.lua +++ b/.config/nvim/lua/loadplugins.lua @@ -104,6 +104,10 @@ return require("packer").startup(function(use) requires = { 'nvim-treesitter/nvim-treesitter' } } + -- folding improvements + use { 'kevinhwang91/nvim-ufo', + requires = 'kevinhwang91/promise-async' } + -- colorful brackets use { 'luochen1990/rainbow' } diff --git a/.config/nvim/plugin/colorscheme.lua b/.config/nvim/plugin/colorscheme.lua index fe97ec8..4497d03 100644 --- a/.config/nvim/plugin/colorscheme.lua +++ b/.config/nvim/plugin/colorscheme.lua @@ -1,4 +1,3 @@ -- tiyn/vim-tccs vim.cmd('colorscheme tccs') vim.api.nvim_set_hl(0, 'colorcolumn', { bg = '#772222' }) - diff --git a/.config/nvim/plugin/lualine.lua b/.config/nvim/plugin/lualine.lua index e7053f1..f243eec 100644 --- a/.config/nvim/plugin/lualine.lua +++ b/.config/nvim/plugin/lualine.lua @@ -2,6 +2,12 @@ require('lualine').setup { options = { icons_enabled = true, + symbols = { + error = '', + warn = '', + hint = '', + info = '', + }, theme = 'tccs', component_separators = { left = '', right = '' }, section_separators = { left = '', right = '' }, diff --git a/.config/nvim/plugin/nvim-cmp.lua b/.config/nvim/plugin/nvim-cmp.lua index 006d2e2..d652ae2 100644 --- a/.config/nvim/plugin/nvim-cmp.lua +++ b/.config/nvim/plugin/nvim-cmp.lua @@ -144,10 +144,16 @@ local attach_func = function(client, bufnr) navbuddy.attach(client, bufnr) end +local capabilities = cmp_nvim_lsp.default_capabilities() +capabilities.textDocument.foldingRange = { + dynamicRegistration = false, + lineFoldingOnly = true +} + for _, lsp in ipairs(servers) do nvim_lsp[lsp].setup { on_attach = attach_func, - capabilities = cmp_nvim_lsp.default_capabilities(), + capabilities = capabilities, flags = { debounce_text_changes = 150 } @@ -156,6 +162,7 @@ end require 'lspconfig'.jdtls.setup { on_attach = attach_func, + capabilities = capabilities, flags = { debounce_text_changes = 150 }, @@ -164,6 +171,7 @@ require 'lspconfig'.jdtls.setup { require 'lspconfig'.lua_ls.setup { on_attach = attach_func, + capabilities = capabilities, settings = { Lua = { runtime = { version = 'LuaJIT' }, @@ -173,3 +181,22 @@ require 'lspconfig'.lua_ls.setup { }, }, } + +require('ufo').setup() + +vim.fn.sign_define( + "DiagnosticSignError", + { texthl = "DiagnosticSignError", text = "", numhl = "DiagnosticSignError" } +) +vim.fn.sign_define( + "DiagnosticSignWarn", + { texthl = "DiagnosticSignWarn", text = "", numhl = "DiagnosticSignWarn" } +) +vim.fn.sign_define( + "DiagnosticSignInfo", + { texthl = "DiagnosticSignInfo", text = "", numhl = "DiagnosticSignInfo" } +) +vim.fn.sign_define( + "DiagnosticSignHint", + { texthl = "DiagnosticSignHint", text = "", numhl = "DiagnosticSignHint" } +) diff --git a/.config/nvim/plugin/todo-comments.lua b/.config/nvim/plugin/todo-comments.lua index fe06b51..4cddcc0 100644 --- a/.config/nvim/plugin/todo-comments.lua +++ b/.config/nvim/plugin/todo-comments.lua @@ -5,12 +5,13 @@ require 'todo-comments'.setup { sign_priority = 8, -- sign priority -- keywords recognized as todo comments keywords = { - ERRO = { icon = " ", color = "error" }, - TODO = { icon = " ", color = "info" }, - HACK = { icon = " ", color = "warning" }, + ERRO = { icon = " ", color = "error" }, + TODO = { icon = " ", color = "info" }, WARN = { icon = " ", color = "warning" }, - PERF = { icon = " ", color = "default" }, - NOTE = { icon = " ", color = "hint" }, + HACK = { icon = " ", color = "warning" }, + PERF = { icon = " ", color = "perfect" }, + HINT = { icon = " ", color = "hint" }, + INFO = { icon = " ", color = "hint", alt = { "NOTE" } }, TEST = { icon = " ", color = "test" }, }, gui_style = { @@ -37,11 +38,11 @@ require 'todo-comments'.setup { -- list of named colors where we try to extract the guifg from the -- list of highlight groups or use the hex color if hl not found as a fallback colors = { - error = { "DiagnosticError", "ErrorMsg", "#DC2626" }, - warning = { "WarningMsg", "DiagnosticWarn", "#FBBF24" }, - info = { "Constant", "#2563EB" }, - hint = { "Comment", "#10B981" }, - default = { "Operator", "#7C3AED" }, + error = { "DiagnosticSignError", "ErrorMsg", "#DC2626" }, + warning = { "DiagnosticSignWarn", "WarningMsg", "#FBBF24" }, + info = { "Comment", "#2563EB" }, + hint = { "Constant", "#10B981" }, + perfect = { "Operator", "#7C3AED" }, test = { "Function", "#FF00FF" } }, search = {