diff options
| author | Hsieh Chin Fan <pham@topo.tw> | 2024-07-04 16:39:23 +0800 |
|---|---|---|
| committer | Hsieh Chin Fan <pham@topo.tw> | 2024-07-04 16:39:23 +0800 |
| commit | 464d830c38d6c11258c60782ef9b4fb9de406957 (patch) | |
| tree | 9cd8e5783781b29a5085c1bc03525daab561e7bc | |
| parent | 1f0628b62d42d9a450157b0956b9df3cadff5177 (diff) | |
Update
| -rw-r--r-- | vim/init.vim | 5 | ||||
| -rw-r--r-- | vim/init/keymaps.vim | 2 | ||||
| -rw-r--r-- | vim/init/special_highlight.vim | 6 | ||||
| -rw-r--r-- | vim/lua/mappings.lua | 12 | ||||
| -rw-r--r-- | vim/lua/plugins/init.lua | 1 |
5 files changed, 16 insertions, 10 deletions
diff --git a/vim/init.vim b/vim/init.vim index 9145855..7c481b8 100644 --- a/vim/init.vim +++ b/vim/init.vim | |||
| @@ -29,6 +29,9 @@ source ~/helper/vim/init/keymaps.vim | |||
| 29 | " Extra config for different contexts | 29 | " Extra config for different contexts |
| 30 | source ~/helper/vim/init/config.vim | 30 | source ~/helper/vim/init/config.vim |
| 31 | 31 | ||
| 32 | " Highlight | ||
| 33 | source ~/helper/vim/init/special_highlight.vim | ||
| 34 | |||
| 32 | if has('nvim') | 35 | if has('nvim') |
| 33 | " For neovim | 36 | " For neovim |
| 34 | source ~/.config/nvim/lazy.lua | 37 | source ~/.config/nvim/lazy.lua |
| @@ -37,5 +40,3 @@ else | |||
| 37 | source ~/helper/vim/init/plugins.vim | 40 | source ~/helper/vim/init/plugins.vim |
| 38 | source ~/helper/vim/init/style.vim | 41 | source ~/helper/vim/init/style.vim |
| 39 | endif | 42 | endif |
| 40 | |||
| 41 | source ~/helper/vim/init/special_highlight.vim | ||
diff --git a/vim/init/keymaps.vim b/vim/init/keymaps.vim index aff5428..5441f32 100644 --- a/vim/init/keymaps.vim +++ b/vim/init/keymaps.vim | |||
| @@ -269,8 +269,10 @@ noremap <leader><leader>ft :set filetype= | |||
| 269 | noremap <leader><leader>fm :set foldmethod= | 269 | noremap <leader><leader>fm :set foldmethod= |
| 270 | 270 | ||
| 271 | " Let <leader>l toggle between this and the last accessed buffer | 271 | " Let <leader>l toggle between this and the last accessed buffer |
| 272 | augroup SaveLastBuffer | ||
| 272 | let g:lastbuffer = 1 | 273 | let g:lastbuffer = 1 |
| 273 | au BufLeave * let g:lastbuffer = bufnr() | 274 | au BufLeave * let g:lastbuffer = bufnr() |
| 275 | augroup END | ||
| 274 | 276 | ||
| 275 | 277 | ||
| 276 | "---------------------------------------------------------------------- | 278 | "---------------------------------------------------------------------- |
diff --git a/vim/init/special_highlight.vim b/vim/init/special_highlight.vim index 50e4dc3..9729183 100644 --- a/vim/init/special_highlight.vim +++ b/vim/init/special_highlight.vim | |||
| @@ -12,7 +12,7 @@ endfunction | |||
| 12 | 12 | ||
| 13 | " Defualt highlight for matched parenthesis is so weird in many colorscheme | 13 | " Defualt highlight for matched parenthesis is so weird in many colorscheme |
| 14 | " Why the background color is lighter than my caret !? | 14 | " Why the background color is lighter than my caret !? |
| 15 | highlight MatchParen ctermfg=NONE ctermbg=darkgrey cterm=NONE | 15 | " highlight MatchParen ctermfg=NONE ctermbg=darkgrey cterm=NONE |
| 16 | highlight LuaParen ctermfg=NONE ctermbg=darkgrey cterm=NONE | 16 | highlight LuaParen ctermfg=NONE ctermbg=darkgrey cterm=NONE |
| 17 | 17 | ||
| 18 | " Show trailing spaces | 18 | " Show trailing spaces |
| @@ -23,6 +23,6 @@ match ExtraWhitespace /\s\+$/ | |||
| 23 | " define line highlight color | 23 | " define line highlight color |
| 24 | highlight MultiLineHighlight ctermbg=LightYellow guibg=LightYellow ctermfg=Black guifg=Black | 24 | highlight MultiLineHighlight ctermbg=LightYellow guibg=LightYellow ctermfg=Black guifg=Black |
| 25 | " highlight the current line | 25 | " highlight the current line |
| 26 | nnoremap <silent> <leader><leader>h :call matchadd('MultiLineHighlight', '\%'.line('.').'l')<CR> | 26 | nnoremap <silent> <leader>gh :call matchadd('MultiLineHighlight', '\%'.line('.').'l')<CR> |
| 27 | " clear all the highlighted lines | 27 | " clear all the highlighted lines |
| 28 | nnoremap <silent> <leader><leader>H :call clearmatches()<CR> | 28 | nnoremap <silent> <leader>gH :call clearmatches()<CR> |
diff --git a/vim/lua/mappings.lua b/vim/lua/mappings.lua index e9a20f5..4ae28c1 100644 --- a/vim/lua/mappings.lua +++ b/vim/lua/mappings.lua | |||
| @@ -97,16 +97,15 @@ vim.keymap.set('n', '<leader>sd', function() | |||
| 97 | require('telescope.builtin').oldfiles { | 97 | require('telescope.builtin').oldfiles { |
| 98 | prompt_title = 'CD to', | 98 | prompt_title = 'CD to', |
| 99 | attach_mappings = function(prompt_bufnr, map) | 99 | attach_mappings = function(prompt_bufnr, map) |
| 100 | local cd_to_dir = function() | 100 | local cd_prompt = function() |
| 101 | local file = require('telescope.actions.state').get_selected_entry()[1] | 101 | local file = require('telescope.actions.state').get_selected_entry()[1] |
| 102 | local path = string.match(file, "(.*[/\\])") | 102 | local path = string.match(file, "(.*[/\\])") |
| 103 | require('telescope.actions').close(prompt_bufnr) | 103 | require('telescope.actions').close(prompt_bufnr) |
| 104 | vim.cmd("cd " .. path) | 104 | vim.api.nvim_feedkeys(":cd " .. path, 'n', true) |
| 105 | vim.cmd("pwd") | ||
| 106 | end | 105 | end |
| 107 | 106 | ||
| 108 | map('i', '<CR>', cd_to_dir) | 107 | map('i', '<CR>', cd_prompt) |
| 109 | map('n', '<CR>', cd_to_dir) | 108 | map('n', '<CR>', cd_prompt) |
| 110 | 109 | ||
| 111 | return true | 110 | return true |
| 112 | end, | 111 | end, |
| @@ -184,3 +183,6 @@ vim.cmd('vmap s S') | |||
| 184 | -- [ Aerial ]"" "<cmd>AerialNext<CR>", {}) | 183 | -- [ Aerial ]"" "<cmd>AerialNext<CR>", {}) |
| 185 | vim.keymap.set("n", "gL", "<cmd>Telescope aerial<CR>") | 184 | vim.keymap.set("n", "gL", "<cmd>Telescope aerial<CR>") |
| 186 | vim.keymap.set("n", "gl", function() require("aerial").toggle({ direction = "left" }) end) | 185 | vim.keymap.set("n", "gl", function() require("aerial").toggle({ direction = "left" }) end) |
| 186 | |||
| 187 | --[ TrunZen ] | ||
| 188 | vim.keymap.set('n', '<leader>z', ':TZAtaraxis<CR>') | ||
diff --git a/vim/lua/plugins/init.lua b/vim/lua/plugins/init.lua index 8c7a049..adcff9b 100644 --- a/vim/lua/plugins/init.lua +++ b/vim/lua/plugins/init.lua | |||
| @@ -12,6 +12,7 @@ return { | |||
| 12 | -- For focus mode | 12 | -- For focus mode |
| 13 | { | 13 | { |
| 14 | "Pocco81/true-zen.nvim", | 14 | "Pocco81/true-zen.nvim", |
| 15 | lazy = false, | ||
| 15 | cmd = { "TZAtaraxis", "TZMinimalist" }, | 16 | cmd = { "TZAtaraxis", "TZMinimalist" }, |
| 16 | }, | 17 | }, |
| 17 | 18 | ||