From 4ee76734de1d426df88a2a4791391909cd1a8597 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Sat, 14 Sep 2024 00:07:12 +0800 Subject: Update --- vim/init.vim | 2 ++ vim/init/config.vim | 4 ++- vim/init/keymaps.vim | 8 +++++- vim/mini.lua | 70 +++++++++++++++++++++++++++------------------------- 4 files changed, 49 insertions(+), 35 deletions(-) (limited to 'vim') diff --git a/vim/init.vim b/vim/init.vim index c1dee81..59be77e 100644 --- a/vim/init.vim +++ b/vim/init.vim @@ -30,3 +30,5 @@ else endif LoadScript init/highlight.vim + +source ~/.projects.vim diff --git a/vim/init/config.vim b/vim/init/config.vim index 74cbd39..4676942 100644 --- a/vim/init/config.vim +++ b/vim/init/config.vim @@ -188,11 +188,13 @@ augroup InitFileTypes endif " Fold for heading and the following contents - let hash_num = matchstr(getline(v:lnum), '^#\+') + let hash_num = matchstr(getline(v:lnum), '^\zs#\+\ze\s') if !empty(hash_num) let foldlevel = g:markdown_apply_heading_level ? len(hash_num) - 1 : 1 " HEADING return len(hash_num) == 1 ? 0 : '>'.foldlevel + elseif match(getline(v:lnum), '^----') != -1 + return "<" else " Contents return "=" diff --git a/vim/init/keymaps.vim b/vim/init/keymaps.vim index c0af8c8..bf3d7ab 100644 --- a/vim/init/keymaps.vim +++ b/vim/init/keymaps.vim @@ -92,6 +92,11 @@ nnoremap gF :e xnoremap iq i" xnoremap aq a" +nnoremap ze zszH + +nnoremap 0 ^ +nnoremap ^ 0 + " READLINE {{{ @@ -495,8 +500,9 @@ function! CloseBufferSafely() tabclose else " Switch to proper buffer - let next_buf = get(t:bufs, bufnr('#')) ? bufnr('#') : filter(t:bufs, 'v:val != '..bufnr)[0] + let next_buf = get(t:bufs, bufnr('#')) ? bufnr('#') : filter(t:bufs, 'v:val != '..bufnr)[-1] exe "b "..next_buf + " exe "buffer ".g:lastbuffer call filter(t:bufs, 'v:val != '..bufnr) endif diff --git a/vim/mini.lua b/vim/mini.lua index 92f9efe..0658d4d 100644 --- a/vim/mini.lua +++ b/vim/mini.lua @@ -1412,39 +1412,43 @@ require("lazy").setup({ }, -- }}} - -- -- lspsaga {{{ - -- { - -- 'nvimdev/lspsaga.nvim', - -- dependencies = { - -- 'nvim-treesitter/nvim-treesitter', -- optional - -- 'nvim-tree/nvim-web-devicons', -- optional - -- }, - -- config = function() - -- require('lspsaga').setup({ - -- autochdir = true, - -- }) - -- vim.api.nvim_create_autocmd("LspAttach", { - -- group = custom_autocommands, - -- pattern = "*", - -- callback = function(args) - -- local map = vim.api.nvim_buf_set_keymap - -- map(0, "n", "gd", "Lspsaga goto_definition", { silent = true, noremap = true }) - -- map(0, "n", "gR", "Lspsaga rename", { silent = true, noremap = true }) - -- map(0, "n", "gx", "Lspsaga code_action", { silent = true, noremap = true }) - -- map(0, "x", "gx", ":Lspsaga range_code_action", { silent = true, noremap = true }) - -- map(0, "n", "K", "Lspsaga hover_doc", { silent = true, noremap = true }) - -- map(0, "n", "go", "Lspsaga show_line_diagnostics", { silent = true, noremap = true }) - -- map(0, "n", "gj", "Lspsaga diagnostic_jump_next", { silent = true, noremap = true }) - -- map(0, "n", "gk", "Lspsaga diagnostic_jump_prev", { silent = true, noremap = true }) - -- - -- -- Don't know why... Everytime when modeline is set and insert a single char - -- -- while inside a fold, the fold closes. - -- vim.opt_local.modeline = false - -- end, - -- }) - -- end - -- }, - -- -- }}} + -- lspsaga {{{ + { + 'nvimdev/lspsaga.nvim', + dependencies = { + 'nvim-treesitter/nvim-treesitter', -- optional + 'nvim-tree/nvim-web-devicons', -- optional + }, + config = function() + require('lspsaga').setup({ + autochdir = true, + lightbulb = { + sign = false, + virtual_text = true, + }, + }) + vim.api.nvim_create_autocmd("LspAttach", { + group = custom_autocommands, + pattern = "*", + callback = function(args) + local map = vim.api.nvim_buf_set_keymap + map(0, "n", "gd", "Lspsaga goto_definition", { silent = true, noremap = true }) + map(0, "n", "gR", "Lspsaga rename", { silent = true, noremap = true }) + map(0, "n", "gx", "Lspsaga code_action", { silent = true, noremap = true }) + map(0, "x", "gx", ":Lspsaga range_code_action", { silent = true, noremap = true }) + map(0, "n", "K", "Lspsaga hover_doc", { silent = true, noremap = true }) + map(0, "n", "go", "Lspsaga show_line_diagnostics", { silent = true, noremap = true }) + map(0, "n", "gj", "Lspsaga diagnostic_jump_next", { silent = true, noremap = true }) + map(0, "n", "gk", "Lspsaga diagnostic_jump_prev", { silent = true, noremap = true }) + + -- Don't know why... Everytime when modeline is set and insert a single char + -- while inside a fold, the fold closes. + vim.opt_local.modeline = false + end, + }) + end + }, + -- }}} -- -- conform {{{ -- { -- "stevearc/conform.nvim", -- cgit v1.2.3-70-g09d2