From 9a176ec94190284e07e303c40d2908bfcff7bf0c Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Mon, 10 Jun 2024 20:27:41 +0800 Subject: Update --- vim/init/keymaps.vim | 11 ++++++++++- vim/lazy/lazy.lua | 26 +++++++++++++++++++------- vim/lazy/plugin/telescope.lua | 7 +++++-- vim/lazy/plugin/treesitter.lua | 11 ----------- 4 files changed, 34 insertions(+), 21 deletions(-) (limited to 'vim') 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 @@ " - COMMON_MAPPING " - LINKS " - MOVING_WITH_READLINE +" - INSERT_SURROUNDING " - JUMP_TO_TABS_WITH_ALT " - MANAGE_TABS " - MANAGE_BUFFERS @@ -166,6 +167,14 @@ noremap gk inoremap gj inoremap gk +"---------------------------------------------------------------------- +" INSERT_SURROUNDING +"---------------------------------------------------------------------- +inoremap ' '' +inoremap " "" +inoremap ( () +inoremap [ [] +inoremap { {} "---------------------------------------------------------------------- " JUMP_TO_TABS_WITH_ALT @@ -209,7 +218,7 @@ autocmd TabLeave * let g:lasttab = tabpagenr() " Opens a new tab with the current buffer's path " Super useful when editing files in the same directory -map te :tabedit =expand("%:p:h")/ +map te :tabedit =expand("%:p:h") " Tab move functions 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({ 'itchyny/lightline.vim', 'preservim/nerdtree', - -- Adds git related signs to the gutter, as well as utilities for managing changes + -- gitsigns.nvim: Adds git related signs to the gutter, as well as utilities for managing changes { 'lewis6991/gitsigns.nvim', opts = { @@ -84,7 +84,7 @@ require('lazy').setup({ }, }, - -- colorscheme + -- onedark: colorscheme { -- onedark.nvim: Theme inspired by Atom 'navarasu/onedark.nvim', @@ -95,7 +95,7 @@ require('lazy').setup({ end, }, - -- hop.nvim for quick jump + -- hop.nvim: For quick jump { 'smoka7/hop.nvim', version = "*", @@ -104,7 +104,7 @@ require('lazy').setup({ } }, - -- Useful plugin to show you pending keybinds. + -- which-key.nvim: Useful plugin to show you pending keybinds. { 'folke/which-key.nvim', opts = { @@ -117,7 +117,7 @@ require('lazy').setup({ } }, - -- For obsidian + -- obsidian.nvim: For obsidian { "epwalsh/obsidian.nvim", version = "*", -- recommended, use latest release instead of latest commit @@ -188,7 +188,7 @@ require('lazy').setup({ }, }, - -- install without yarn or npm + -- markdown-preview: Install without yarn or npm { "iamcco/markdown-preview.nvim", cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, @@ -196,7 +196,7 @@ require('lazy').setup({ build = function() vim.fn["mkdp#util#install"]() end, }, - -- For beancount + -- vim-beancount: For beancount { 'nathangrigg/vim-beancount', ft = { "beancount" }, @@ -309,6 +309,7 @@ require('lazy').setup({ return vim.fn.executable 'make' == 1 end, }, + 'cljoly/telescope-repo.nvim', }, }, @@ -408,5 +409,16 @@ vim.keymap.set('n', "os", ':ObsidianSearch') vim.keymap.set('n', "oq", ':ObsidianQuickSwitch') vim.keymap.set('v', "on", ':ObsidianLinkNew') +-- vim.cmd("let g:mkdp_browser = 'surf'") +vim.cmd("let g:mkdp_browser = 'firefox'") +vim.g.mkdp_preview_options = { + mkit = { breaks = true }, + toc= { + containerClass = "toc", + format = 'function format(x, htmlencode) { return `${htmlencode(x)}`; }', + callback = "console.log('foo')", + } +} + -- The line beneath this is called `modeline`. See `:help modeline` -- 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 { defaults = { mappings = { i = { - [""] = "move_selection_next", - [""] = "move_selection_previous", + -- [""] = "move_selection_next", + -- [""] = "move_selection_previous", [""] = require("telescope.actions.layout").toggle_preview, + [""] = false, }, }, layout_config = { @@ -46,8 +47,10 @@ require('telescope').setup { -- Enable telescope fzf native, if installed pcall(require('telescope').load_extension, 'fzf') +pcall(require('telescope').load_extension, 'repo') -- See `:help telescope.builtin` +vim.keymap.set('n', 'T', ':Telescope', { desc = '[T]elescope' }) vim.keymap.set('n', 'f', require('telescope.builtin').oldfiles, { desc = '[F] Find recently opened files' }) vim.keymap.set('n', 'b', require('telescope.builtin').buffers, { desc = '[B] Find existing buffers' }) vim.keymap.set('n', '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 @@ -69,17 +69,6 @@ vim.keymap.set('n', 'E', vim.diagnostic.open_float, { desc = 'Open float vim.keymap.set('n', 'Q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' }) --- [[ Configure Aerial ]] -require("aerial").setup({ - -- optionally use on_attach to set keymaps when aerial has attached to a buffer - on_attach = function(bufnr) - -- Jump forwards/backwards with '{' and '}' - vim.keymap.set("n", "{", "AerialPrev", { buffer = bufnr }) - vim.keymap.set("n", "}", "AerialNext", { buffer = bufnr }) - end, -}) -vim.keymap.set("n", "a", "Telescope aerial") -vim.keymap.set("n", "A", "AerialToggle!left") -- [[ Configure Aerial ]] require("aerial").setup({ -- optionally use on_attach to set keymaps when aerial has attached to a buffer -- cgit v1.2.3-70-g09d2