diff options
author | Hsieh Chin Fan <pham@topo.tw> | 2024-06-10 20:27:41 +0800 |
---|---|---|
committer | Hsieh Chin Fan <pham@topo.tw> | 2024-06-10 20:27:41 +0800 |
commit | 9a176ec94190284e07e303c40d2908bfcff7bf0c (patch) | |
tree | fcef9cac2737c48c3c69a4c0fe41b4c56d009c11 | |
parent | e5dcd8e8bb0bcecc125515b5cbef7b366e04b1b8 (diff) |
Update
-rw-r--r-- | vim/init/keymaps.vim | 11 | ||||
-rw-r--r-- | vim/lazy/lazy.lua | 26 | ||||
-rw-r--r-- | vim/lazy/plugin/telescope.lua | 7 | ||||
-rw-r--r-- | vim/lazy/plugin/treesitter.lua | 11 |
4 files changed, 34 insertions, 21 deletions
diff --git a/vim/init/keymaps.vim b/vim/init/keymaps.vim index 5e472d2..540dd33 100644 --- a/vim/init/keymaps.vim +++ b/vim/init/keymaps.vim | |||
@@ -5,6 +5,7 @@ | |||
5 | " - COMMON_MAPPING | 5 | " - COMMON_MAPPING |
6 | " - LINKS | 6 | " - LINKS |
7 | " - MOVING_WITH_READLINE | 7 | " - MOVING_WITH_READLINE |
8 | " - INSERT_SURROUNDING | ||
8 | " - JUMP_TO_TABS_WITH_ALT | 9 | " - JUMP_TO_TABS_WITH_ALT |
9 | " - MANAGE_TABS | 10 | " - MANAGE_TABS |
10 | " - MANAGE_BUFFERS | 11 | " - MANAGE_BUFFERS |
@@ -166,6 +167,14 @@ noremap <m-k> gk | |||
166 | inoremap <m-j> <c-\><c-o>gj | 167 | inoremap <m-j> <c-\><c-o>gj |
167 | inoremap <m-k> <c-\><c-o>gk | 168 | inoremap <m-k> <c-\><c-o>gk |
168 | 169 | ||
170 | "---------------------------------------------------------------------- | ||
171 | " INSERT_SURROUNDING | ||
172 | "---------------------------------------------------------------------- | ||
173 | inoremap ' ''<Left> | ||
174 | inoremap " ""<Left> | ||
175 | inoremap ( ()<Left> | ||
176 | inoremap [ []<Left> | ||
177 | inoremap { {}<Left> | ||
169 | 178 | ||
170 | "---------------------------------------------------------------------- | 179 | "---------------------------------------------------------------------- |
171 | " JUMP_TO_TABS_WITH_ALT | 180 | " JUMP_TO_TABS_WITH_ALT |
@@ -209,7 +218,7 @@ autocmd TabLeave * let g:lasttab = tabpagenr() | |||
209 | 218 | ||
210 | " Opens a new tab with the current buffer's path | 219 | " Opens a new tab with the current buffer's path |
211 | " Super useful when editing files in the same directory | 220 | " Super useful when editing files in the same directory |
212 | map <leader>te :tabedit <C-r>=expand("%:p:h")<cr>/ | 221 | map <leader>te :tabedit <C-r>=expand("%:p:h")<cr> |
213 | 222 | ||
214 | " Tab move functions | 223 | " Tab move functions |
215 | function! Tab_MoveLeft() | 224 | function! Tab_MoveLeft() |
diff --git a/vim/lazy/lazy.lua b/vim/lazy/lazy.lua index 3142c9a..4aef220 100644 --- a/vim/lazy/lazy.lua +++ b/vim/lazy/lazy.lua | |||
@@ -59,7 +59,7 @@ require('lazy').setup({ | |||
59 | 'itchyny/lightline.vim', | 59 | 'itchyny/lightline.vim', |
60 | 'preservim/nerdtree', | 60 | 'preservim/nerdtree', |
61 | 61 | ||
62 | -- Adds git related signs to the gutter, as well as utilities for managing changes | 62 | -- gitsigns.nvim: Adds git related signs to the gutter, as well as utilities for managing changes |
63 | { | 63 | { |
64 | 'lewis6991/gitsigns.nvim', | 64 | 'lewis6991/gitsigns.nvim', |
65 | opts = { | 65 | opts = { |
@@ -84,7 +84,7 @@ require('lazy').setup({ | |||
84 | }, | 84 | }, |
85 | }, | 85 | }, |
86 | 86 | ||
87 | -- colorscheme | 87 | -- onedark: colorscheme |
88 | { | 88 | { |
89 | -- onedark.nvim: Theme inspired by Atom | 89 | -- onedark.nvim: Theme inspired by Atom |
90 | 'navarasu/onedark.nvim', | 90 | 'navarasu/onedark.nvim', |
@@ -95,7 +95,7 @@ require('lazy').setup({ | |||
95 | end, | 95 | end, |
96 | }, | 96 | }, |
97 | 97 | ||
98 | -- hop.nvim for quick jump | 98 | -- hop.nvim: For quick jump |
99 | { | 99 | { |
100 | 'smoka7/hop.nvim', | 100 | 'smoka7/hop.nvim', |
101 | version = "*", | 101 | version = "*", |
@@ -104,7 +104,7 @@ require('lazy').setup({ | |||
104 | } | 104 | } |
105 | }, | 105 | }, |
106 | 106 | ||
107 | -- Useful plugin to show you pending keybinds. | 107 | -- which-key.nvim: Useful plugin to show you pending keybinds. |
108 | { | 108 | { |
109 | 'folke/which-key.nvim', | 109 | 'folke/which-key.nvim', |
110 | opts = { | 110 | opts = { |
@@ -117,7 +117,7 @@ require('lazy').setup({ | |||
117 | } | 117 | } |
118 | }, | 118 | }, |
119 | 119 | ||
120 | -- For obsidian | 120 | -- obsidian.nvim: For obsidian |
121 | { | 121 | { |
122 | "epwalsh/obsidian.nvim", | 122 | "epwalsh/obsidian.nvim", |
123 | version = "*", -- recommended, use latest release instead of latest commit | 123 | version = "*", -- recommended, use latest release instead of latest commit |
@@ -188,7 +188,7 @@ require('lazy').setup({ | |||
188 | }, | 188 | }, |
189 | }, | 189 | }, |
190 | 190 | ||
191 | -- install without yarn or npm | 191 | -- markdown-preview: Install without yarn or npm |
192 | { | 192 | { |
193 | "iamcco/markdown-preview.nvim", | 193 | "iamcco/markdown-preview.nvim", |
194 | cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, | 194 | cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, |
@@ -196,7 +196,7 @@ require('lazy').setup({ | |||
196 | build = function() vim.fn["mkdp#util#install"]() end, | 196 | build = function() vim.fn["mkdp#util#install"]() end, |
197 | }, | 197 | }, |
198 | 198 | ||
199 | -- For beancount | 199 | -- vim-beancount: For beancount |
200 | { | 200 | { |
201 | 'nathangrigg/vim-beancount', | 201 | 'nathangrigg/vim-beancount', |
202 | ft = { "beancount" }, | 202 | ft = { "beancount" }, |
@@ -309,6 +309,7 @@ require('lazy').setup({ | |||
309 | return vim.fn.executable 'make' == 1 | 309 | return vim.fn.executable 'make' == 1 |
310 | end, | 310 | end, |
311 | }, | 311 | }, |
312 | 'cljoly/telescope-repo.nvim', | ||
312 | }, | 313 | }, |
313 | }, | 314 | }, |
314 | 315 | ||
@@ -408,5 +409,16 @@ vim.keymap.set('n', "<leader>os", ':ObsidianSearch<CR>') | |||
408 | vim.keymap.set('n', "<leader>oq", ':ObsidianQuickSwitch<CR>') | 409 | vim.keymap.set('n', "<leader>oq", ':ObsidianQuickSwitch<CR>') |
409 | vim.keymap.set('v', "<leader>on", ':ObsidianLinkNew<CR>') | 410 | vim.keymap.set('v', "<leader>on", ':ObsidianLinkNew<CR>') |
410 | 411 | ||
412 | -- vim.cmd("let g:mkdp_browser = 'surf'") | ||
413 | vim.cmd("let g:mkdp_browser = 'firefox'") | ||
414 | vim.g.mkdp_preview_options = { | ||
415 | mkit = { breaks = true }, | ||
416 | toc= { | ||
417 | containerClass = "toc", | ||
418 | format = 'function format(x, htmlencode) { return `<span>${htmlencode(x)}</span>`; }', | ||
419 | callback = "console.log('foo')", | ||
420 | } | ||
421 | } | ||
422 | |||
411 | -- The line beneath this is called `modeline`. See `:help modeline` | 423 | -- The line beneath this is called `modeline`. See `:help modeline` |
412 | -- vim: ts=2 sts=2 sw=2 et | 424 | -- vim: ts=2 sts=2 sw=2 et |
diff --git a/vim/lazy/plugin/telescope.lua b/vim/lazy/plugin/telescope.lua index 0b4bbfc..d6076b6 100644 --- a/vim/lazy/plugin/telescope.lua +++ b/vim/lazy/plugin/telescope.lua | |||
@@ -4,9 +4,10 @@ require('telescope').setup { | |||
4 | defaults = { | 4 | defaults = { |
5 | mappings = { | 5 | mappings = { |
6 | i = { | 6 | i = { |
7 | ["<c-j>"] = "move_selection_next", | 7 | -- ["<c-j>"] = "move_selection_next", |
8 | ["<c-k>"] = "move_selection_previous", | 8 | -- ["<c-k>"] = "move_selection_previous", |
9 | ["<C-w>"] = require("telescope.actions.layout").toggle_preview, | 9 | ["<C-w>"] = require("telescope.actions.layout").toggle_preview, |
10 | ["<C-u>"] = false, | ||
10 | }, | 11 | }, |
11 | }, | 12 | }, |
12 | layout_config = { | 13 | layout_config = { |
@@ -46,8 +47,10 @@ require('telescope').setup { | |||
46 | 47 | ||
47 | -- Enable telescope fzf native, if installed | 48 | -- Enable telescope fzf native, if installed |
48 | pcall(require('telescope').load_extension, 'fzf') | 49 | pcall(require('telescope').load_extension, 'fzf') |
50 | pcall(require('telescope').load_extension, 'repo') | ||
49 | 51 | ||
50 | -- See `:help telescope.builtin` | 52 | -- See `:help telescope.builtin` |
53 | vim.keymap.set('n', '<leader>T', ':Telescope<CR>', { desc = '[T]elescope' }) | ||
51 | vim.keymap.set('n', '<leader>f', require('telescope.builtin').oldfiles, { desc = '[F] Find recently opened files' }) | 54 | vim.keymap.set('n', '<leader>f', require('telescope.builtin').oldfiles, { desc = '[F] Find recently opened files' }) |
52 | vim.keymap.set('n', '<leader>b', require('telescope.builtin').buffers, { desc = '[B] Find existing buffers' }) | 55 | vim.keymap.set('n', '<leader>b', require('telescope.builtin').buffers, { desc = '[B] Find existing buffers' }) |
53 | vim.keymap.set('n', '<leader>st', require('telescope.builtin').builtin, { desc = '[S]earch [T]elescope for builtin' }) | 56 | vim.keymap.set('n', '<leader>st', require('telescope.builtin').builtin, { desc = '[S]earch [T]elescope for builtin' }) |
diff --git a/vim/lazy/plugin/treesitter.lua b/vim/lazy/plugin/treesitter.lua index 245ecb4..1ac6cd3 100644 --- a/vim/lazy/plugin/treesitter.lua +++ b/vim/lazy/plugin/treesitter.lua | |||
@@ -80,17 +80,6 @@ require("aerial").setup({ | |||
80 | }) | 80 | }) |
81 | vim.keymap.set("n", "<leader><leader>a", "<cmd>Telescope aerial<CR>") | 81 | vim.keymap.set("n", "<leader><leader>a", "<cmd>Telescope aerial<CR>") |
82 | vim.keymap.set("n", "<leader><leader>A", "<cmd>AerialToggle!left<CR>") | 82 | vim.keymap.set("n", "<leader><leader>A", "<cmd>AerialToggle!left<CR>") |
83 | -- [[ Configure Aerial ]] | ||
84 | require("aerial").setup({ | ||
85 | -- optionally use on_attach to set keymaps when aerial has attached to a buffer | ||
86 | on_attach = function(bufnr) | ||
87 | -- Jump forwards/backwards with '{' and '}' | ||
88 | vim.keymap.set("n", "{", "<cmd>AerialPrev<CR>", { buffer = bufnr }) | ||
89 | vim.keymap.set("n", "}", "<cmd>AerialNext<CR>", { buffer = bufnr }) | ||
90 | end, | ||
91 | }) | ||
92 | vim.keymap.set("n", "<leader><leader>a", "<cmd>Telescope aerial<CR>") | ||
93 | vim.keymap.set("n", "<leader><leader>A", "<cmd>AerialToggle!left<CR>") | ||
94 | 83 | ||
95 | 84 | ||
96 | -- [[ Configure LSP ]] | 85 | -- [[ Configure LSP ]] |