From 5c9059cc7c92e4ca82f807c8297fda87ca2a1502 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Fri, 28 Oct 2022 10:51:12 +0700 Subject: [PATCH 01/70] fix: neotree not display dir with "git" in name --- lua/doom/modules/features/explorer/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/modules/features/explorer/init.lua b/lua/doom/modules/features/explorer/init.lua index fdc00c9f..b8adf7a4 100644 --- a/lua/doom/modules/features/explorer/init.lua +++ b/lua/doom/modules/features/explorer/init.lua @@ -22,7 +22,7 @@ explorer.settings = { }, }, filters = { - custom = { ".git", "node_modules.editor", ".cache", "__pycache__" }, + custom = { "^\\.git", "node_modules.editor", "^\\.cache", "__pycache__" }, }, renderer = { indent_markers = { From e76b7e079fc6e4b66653f1e830923be86730fb98 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Fri, 28 Oct 2022 14:29:03 +0700 Subject: [PATCH 02/70] feat: add some user modules --- .../modules/features/charcounter/init.lua | 118 ++++++++++++++++++ lua/user/modules/features/git/init.lua | 49 ++++++++ lua/user/modules/features/navigation/init.lua | 92 ++++++++++++++ .../refactor}/init.lua | 2 +- lua/user/modules/features/template-init.lua | 62 +++++++++ lua/user/modules/features/views/init.lua | 38 ++++++ 6 files changed, 360 insertions(+), 1 deletion(-) create mode 100644 lua/user/modules/features/charcounter/init.lua create mode 100644 lua/user/modules/features/git/init.lua create mode 100644 lua/user/modules/features/navigation/init.lua rename lua/user/modules/{char_counter => features/refactor}/init.lua (98%) create mode 100644 lua/user/modules/features/template-init.lua create mode 100644 lua/user/modules/features/views/init.lua diff --git a/lua/user/modules/features/charcounter/init.lua b/lua/user/modules/features/charcounter/init.lua new file mode 100644 index 00000000..971c0da6 --- /dev/null +++ b/lua/user/modules/features/charcounter/init.lua @@ -0,0 +1,118 @@ +local char_counter = {} + +char_counter.settings = { + popup = { + position = "50%", + size = { + width = 80, + height = 40, + }, + border = { + padding = { + top = 2, + bottom = 2, + left = 3, + right = 3, + }, + }, style = "rounded", + enter = true, + buf_options = { + modifiable = true, + readonly = true, + }, + }, +} + +char_counter.packages = { + ["nui.nvim"] = { + "MunifTanjim/nui.nvim", + -- cmd = { "CountPrint" }, + }, +} + +char_counter.configs = { + ["nui.nvim"] = function() + vim.notify("char_counter: nui.nvim loaded", "info") + end, +} + +char_counter._insert_enter_char_count = nil +char_counter._accumulated_difference = 0 +char_counter._get_current_buffer_char_count = function() + local lines = vim.api.nvim_buf_line_count(0) + local chars = 0 + for _, line in ipairs(vim.api.nvim_buf_get_lines(0, 0, lines, false)) do + chars = chars + #line + end + return chars +end + +char_counter.autocmds = { + { + "InsertEnter", + "*", + function() + -- Only operate on normal file buffers + print(("buftype: %s"):format(vim.bo.buftype)) + if vim.bo.buftype == "" then + -- Store current char count + char_counter._insert_enter_char_count = char_counter._get_current_buffer_char_count() + end + end, + }, + { + "InsertLeave", + "*", + function() + -- Only operate on normal file buffers + if vim.bo.buftype == "" and char_counter._insert_enter_char_count then + -- Find the amount of chars added or removed + local new_count = char_counter._get_current_buffer_char_count() + local diff = new_count - char_counter._insert_enter_char_count + print(new_count, diff) + -- Add the difference to the accumulated total + char_counter._accumulated_difference = char_counter._accumulated_difference + diff + print(("Accumulated difference %s"):format(char_counter._accumulated_difference)) + end + end, + }, +} + +char_counter.cmds = { + { + "CountPrint", + function() + local Popup = require("nui.popup") + local popup = Popup(char_counter.settings.popup) + popup:mount() + popup:map("n", "", function() + popup:unmount() + end) + + local msg = ("char_counter: You have typed %s characters since I started counting."):format( + char_counter._accumulated_difference + ) + vim.api.nvim_buf_set_lines(popup.bufnr, 0, 1, false, { msg }) + end, + }, + { + "CountReset", + function() + char_counter._accumulated_difference = 0 + vim.notify("char_counter: Reset count!", "info") + end, + }, +} + +char_counter.binds = { + { + "i", + name = "+info", + { -- Adds a new `whichkey` folder called `+info` + { "c", ":CountPrint", name = "Print new chars" }, -- Binds `:CountPrint` to `ic` + { "r", ":CountReset", name = "Reset char count" }, -- Binds `:CountPrint` to `ic` + }, + }, +} + +return char_counter diff --git a/lua/user/modules/features/git/init.lua b/lua/user/modules/features/git/init.lua new file mode 100644 index 00000000..71d369b9 --- /dev/null +++ b/lua/user/modules/features/git/init.lua @@ -0,0 +1,49 @@ +local M = {} + +M.settings = { +} + +M.packages = { + ["neogit"] = { + "TimUntersberger/neogit", + }, + ["git-blame.nvim"] = { + "f-person/git-blame.nvim", + }, + -- TODO: apply diff view on git + ["diffview.nvim"] = { + "sindrets/diffview.nvim", + requires = 'nvim-lua/plenary.nvim' + }, + +} + +M.configs = { + ["neogit"] = function() + require("neogit").setup({ + integrations = { + diffview = true + }, + }) + end, + +} + +M.autocmds = { +} + +M.cmds = { +} + +-- TODO: fix bug doom-nvim, so it can load if 'M.bind= {}' +-- M.binds = +-- { +-- -- { +-- -- "ghw", +-- -- [[HopWord]], +-- -- name = "Go to word in the screen", +-- -- mode = "nv", +-- -- }, +-- } + +return M diff --git a/lua/user/modules/features/navigation/init.lua b/lua/user/modules/features/navigation/init.lua new file mode 100644 index 00000000..e5dc472c --- /dev/null +++ b/lua/user/modules/features/navigation/init.lua @@ -0,0 +1,92 @@ +local M = {} + +M.settings = { +} + +M.packages = { + -- ["noice.nvim"] = { + -- "folke/noice.nvim", + -- requires = "MunifTanjim/nui.nvim", + -- }, + ["vim-sandwich"] = { + "machakann/vim-sandwich", + }, + ["symbols-outline.nvim"] = { + "simrat39/symbols-outline.nvim" + }, + + ["cutlass.nvim"] = { + "tuanbass/cutlass.nvim", + }, + ["textobj1"] = { + "kana/vim-textobj-line", + }, + ["textobj2"] = { + "kana/vim-textobj-entire", + }, + ["vim-expand-region"] = { + "terryma/vim-expand-region", + }, + ["textobj3"] = { + "kana/vim-textobj-user", + }, + ["hop.nvim"] = { + "phaazon/hop.nvim", -- jum to anywhere in screen + }, + ["quick-scope"] = { -- highlight char to go left/righ + "unblevable/quick-scope", + }, + +} + +M.configs = { + -- ["noice.nvim"] = function() + -- require("noice").setup() + -- end, + + ["cutlass.nvim"] = function () + -- vim.notify("Setting up cutlass plugin", "info") + require("cutlass").setup({ + cut_key = "m" + }) + end, + + ["hop.nvim"] = function () + -- vim.notify("Setting up cutlass plugin", "info") + require("hop").setup() + end, + ["symbols-outline.nvim"] = function () + -- vim.notify("Setting up cutlass plugin", "info") + require("symbols-outline").setup() + end, +} + +M.autocmds = { +} + +M.cmds = { +} + +M.binds = +{ + { + "C-g", + [[HopChar1]], + name = "Go to anychar in the screen", + mode = "nv", + }, + { + "ghc", + [[HopChar1]], + name = "Go to anychar in the screen", + mode = "nv", + }, + { + "ghw", + [[HopWord]], + name = "Go to word in the screen", + mode = "nv", + }, +} + +return M diff --git a/lua/user/modules/char_counter/init.lua b/lua/user/modules/features/refactor/init.lua similarity index 98% rename from lua/user/modules/char_counter/init.lua rename to lua/user/modules/features/refactor/init.lua index 1b8634c1..daf84569 100644 --- a/lua/user/modules/char_counter/init.lua +++ b/lua/user/modules/features/refactor/init.lua @@ -27,7 +27,7 @@ char_counter.settings = { char_counter.packages = { ["nui.nvim"] = { "MunifTanjim/nui.nvim", - cmd = { "CountPrint" }, + -- cmd = { "CountPrint" }, }, } diff --git a/lua/user/modules/features/template-init.lua b/lua/user/modules/features/template-init.lua new file mode 100644 index 00000000..5855c0bc --- /dev/null +++ b/lua/user/modules/features/template-init.lua @@ -0,0 +1,62 @@ +-- Unintegrated packages +-- Spotify +-- goto-preview +-- NeoRoot +-- ThePrimeagen/refactoring.nvim +-- ray-x/lsp_signature.nvim +-- ray-x/lsp_signature.nvim +-- rcarriga/nvim-dap-ui +-- theHamsta/nvim-dap-virtual-text +-- nvim-telescope/telescope-dap.nvim +-- gcmt/taboo.vim +-- pretty-fold +-- fold-preview +-- preservim/vim-markdown +-- godlygeek/tabular +-- iamcco/markdown-preview.nvim +-- SidOfc/mkdx +-- nvim-orgmode/orgmode +-- ekickx/clipboard-image.nvim +local M = {} + +M.settings = { +} + +M.packages = { + -- ["zen-mode.nvim"] = { + -- "folke/zen-mode.nvim", + -- }, + -- ["vimade"] = { + -- "TaDaa/vimade", + -- }, + +} + +M.configs = { + -- ["zen-mode.nvim"] = function() + -- require("zen-mode").setup { + -- window = { + -- width = 180, + -- } + -- } + -- end, + +} + +M.autocmds = { +} + +M.cmds = { +} + +-- M.binds kk +-- { +-- -- { +-- -- "ghw", +-- -- [[HopWord]], +-- -- name = "Go to word in the screen", +-- -- mode = "nv", +-- -- }, +-- } + +return M diff --git a/lua/user/modules/features/views/init.lua b/lua/user/modules/features/views/init.lua new file mode 100644 index 00000000..fd2760c8 --- /dev/null +++ b/lua/user/modules/features/views/init.lua @@ -0,0 +1,38 @@ +local M = {} + +M.settings = {} + +M.packages = { + ["zen-mode.nvim"] = { + "folke/zen-mode.nvim", + }, + ["vimade"] = { + "TaDaa/vimade", + }, +} + +M.configs = { + ["zen-mode.nvim"] = function() + require("zen-mode").setup({ + window = { + width = 180, + }, + }) + end, +} + +M.autocmds = {} + +M.cmds = {} + +M.binds = { + { + "v", + name = "+views", + { -- Adds a new `whichkey` folder called `+info` + { "z", "ZenMode", name = "Zen mode" }, + }, + }, +} + +return M From fa9098a78a39883b10377e9c113f79c4974b1bc7 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Fri, 28 Oct 2022 14:31:32 +0700 Subject: [PATCH 03/70] feat: change user config --- config.lua | 39 ++++++++++++++++ modules.lua | 32 +++++++------ sessions/%Users%connormeehan%.config%nvim.vim | 46 ------------------- 3 files changed, 57 insertions(+), 60 deletions(-) delete mode 100644 sessions/%Users%connormeehan%.config%nvim.vim diff --git a/config.lua b/config.lua index d7618e60..47ad4098 100644 --- a/config.lua +++ b/config.lua @@ -45,4 +45,43 @@ doom.indent = 2 doom.core.treesitter.settings.show_compiler_warning_message = false doom.core.reloader.settings.reload_on_save = false +doom.langs.lua.settings.disable_lsp = true +doom.features.tabline.settings.options.enforce_regular_tabs = false -- vim: sw=2 sts=2 ts=2 expandtab +-- +-- custom keybindings for tabline +doom.features.tabline.binds = { + {"H", + name = "Left", + function() + require("bufferline").cycle(-1) + end + }, + {"L", + name = "Left", + function() + require("bufferline").cycle(1) + end + }, +} +-- custom keybindings for comments +-- +doom.features.comment.binds = { + { + "gc", + [[lua require("Comment.api").toggle.linewise(vim.fn.visualmode())]], + name = "Comment line", + mode = "v", + }, { + "gcc", + [[lua require("Comment.api").toggle.linewise.current()]], + name = "Comment line", + }, + { + "gcA", + [[lua require("Comment.api").insert.linewise.eol()]], + name = "Comment end of line", + mode = "ni", + }, +} +-- diff --git a/modules.lua b/modules.lua index e124db9a..6da20448 100644 --- a/modules.lua +++ b/modules.lua @@ -21,7 +21,7 @@ return { "auto_session", -- Remember sessions between loads "colorizer", -- Show colors in neovim "editorconfig", -- Support editorconfig files - "gitsigns", -- Show git changes in sidebar + -- "gitsigns", -- Show git changes in sidebar "illuminate", -- Highlight other copies of the word you're hovering on "indentlines", -- Show indent lines with special characters "range_highlight", -- Highlight selected range from commands @@ -32,10 +32,10 @@ return { "lsp_progress", -- Check status of LSP loading "tabline", -- Tab bar buffer switcher "dashboard", -- A pretty dashboard upon opening - -- "trouble", -- A pretty diagnostic viewer + "trouble", -- A pretty diagnostic viewer "statusline", -- A pretty status line at the bottom of the buffer - -- "minimap", -- Shows current position in document - -- "terminal", -- Integrated terminal in neovim + "minimap", -- Shows current position in document + "terminal", -- Integrated terminal in neovim -- "symbols", -- Navigate between code symbols using telescope -- "ranger", -- File explorer in neovim (TODO: Test) -- "restclient", -- Test HTTP requests from neovim (TODO: Test) @@ -54,12 +54,17 @@ return { -- "suda", -- Save using sudo when necessary "telescope", -- Fuzzy searcher to find files, grep code and more "whichkey", -- An interactive sheet + ------------------- user module + "navigation", + "git", + "views", + -- "charcounter", -- custom module test }, langs = { -- Scripts "lua", - "python", - -- "bash", + -- "python", + "bash", -- "fish", -- "gdscript", -- "gdscript", @@ -67,18 +72,17 @@ return { -- "ruby", -- Web - -- "javascript", - -- "typescript", - -- "css", + "javascript", + "typescript", + "css", -- "vue", -- "tailwindcss", -- "svelte", -- Compiled - -- "rust", + "rust", -- "cc", - -- "ocaml", - -- "haskell", + -- "ocaml", "haskell", -- JIT -- "c_sharp", @@ -88,9 +92,9 @@ return { -- "json", -- "yaml", -- "toml", - -- "markdown", + "markdown", -- "terraform", -- Terraform / hcl files support - -- "dockerfile", + "dockerfile", -- "nix", -- Nix declarations }, } diff --git a/sessions/%Users%connormeehan%.config%nvim.vim b/sessions/%Users%connormeehan%.config%nvim.vim deleted file mode 100644 index 0f1fe11b..00000000 --- a/sessions/%Users%connormeehan%.config%nvim.vim +++ /dev/null @@ -1,46 +0,0 @@ -let SessionLoad = 1 -let s:so_save = &g:so | let s:siso_save = &g:siso | setg so=0 siso=0 | setl so=-1 siso=-1 -let v:this_session=expand(":p") -silent only -silent tabonly -cd ~/.config/nvim -if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == '' - let s:wipebuf = bufnr('%') -endif -set shortmess=aoO -argglobal -%argdel -$argadd modules.lua -edit modules.lua -argglobal -setlocal fdm=indent -setlocal fde=0 -setlocal fmr={{{,}}} -setlocal fdi=# -setlocal fdl=0 -setlocal fml=1 -setlocal fdn=20 -setlocal fen -let s:l = 1 - ((0 * winheight(0) + 27) / 54) -if s:l < 1 | let s:l = 1 | endif -keepjumps exe s:l -normal! zt -keepjumps 1 -normal! 0 -tabnext 1 -badd +0 modules.lua -if exists('s:wipebuf') && len(win_findbuf(s:wipebuf)) == 0 && getbufvar(s:wipebuf, '&buftype') isnot# 'terminal' - silent exe 'bwipe ' . s:wipebuf -endif -unlet! s:wipebuf -set winheight=1 winwidth=20 shortmess=atscI -let s:sx = expand(":p:r")."x.vim" -if filereadable(s:sx) - exe "source " . fnameescape(s:sx) -endif -let &g:so = s:so_save | let &g:siso = s:siso_save -set hlsearch -nohlsearch -doautoall SessionLoadPost -unlet SessionLoad -" vim: set ft=vim : From e50649ef5726a6b64a2b33e9dcc05aa07d340c60 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Fri, 4 Nov 2022 09:47:12 +0700 Subject: [PATCH 04/70] feat: add some user modules --- lua/user/modules/features/git/init.lua | 15 ++++- lua/user/modules/features/navigation/init.lua | 59 ++++++++++++++----- lua/user/modules/features/views/init.lua | 10 +++- 3 files changed, 66 insertions(+), 18 deletions(-) diff --git a/lua/user/modules/features/git/init.lua b/lua/user/modules/features/git/init.lua index 71d369b9..1482bd26 100644 --- a/lua/user/modules/features/git/init.lua +++ b/lua/user/modules/features/git/init.lua @@ -10,12 +10,16 @@ M.packages = { ["git-blame.nvim"] = { "f-person/git-blame.nvim", }, - -- TODO: apply diff view on git ["diffview.nvim"] = { "sindrets/diffview.nvim", requires = 'nvim-lua/plenary.nvim' }, - + ["git-conflict.nvim"] = { + "akinsho/git-conflict.nvim", + }, + ["gitsigns.nvim"] = { + "lewis6991/gitsigns.nvim", + }, } M.configs = { @@ -27,8 +31,13 @@ M.configs = { }) end, + ["git-conflict.nvim"] = function() + require('git-conflict').setup() + end, + ["gitsigns.nvim"] = function() + require('gitsigns').setup() + end, } - M.autocmds = { } diff --git a/lua/user/modules/features/navigation/init.lua b/lua/user/modules/features/navigation/init.lua index e5dc472c..424e22b2 100644 --- a/lua/user/modules/features/navigation/init.lua +++ b/lua/user/modules/features/navigation/init.lua @@ -1,7 +1,6 @@ local M = {} -M.settings = { -} +M.settings = {} M.packages = { -- ["noice.nvim"] = { @@ -12,7 +11,7 @@ M.packages = { "machakann/vim-sandwich", }, ["symbols-outline.nvim"] = { - "simrat39/symbols-outline.nvim" + "simrat39/symbols-outline.nvim", }, ["cutlass.nvim"] = { @@ -36,7 +35,9 @@ M.packages = { ["quick-scope"] = { -- highlight char to go left/righ "unblevable/quick-scope", }, - + ["vim-matchup"] = { -- highlight char to go left/righ + "andymass/vim-matchup", + }, } M.configs = { @@ -44,32 +45,54 @@ M.configs = { -- require("noice").setup() -- end, - ["cutlass.nvim"] = function () + ["cutlass.nvim"] = function() -- vim.notify("Setting up cutlass plugin", "info") require("cutlass").setup({ - cut_key = "m" + cut_key = "m", }) end, - ["hop.nvim"] = function () + ["hop.nvim"] = function() -- vim.notify("Setting up cutlass plugin", "info") require("hop").setup() end, - ["symbols-outline.nvim"] = function () + ["vim-expand-region"] = function() + vim.g.expand_region_text_objects = { + ["i"] = 0, + ["iw"] = 0, + ["i]"] = 1, + ["i}"] = 1, + ["i)"] = 1, + ["it"] = 1, + ["ib"] = 1, + ["iB"] = 1, + ["il"] = 0, + ["ip"] = 0, + ["ie"] = 0, + } + + -- TODO: convert to use module binding mechanism + vim.cmd([[ + vmap v (expand_region_expand) + ]]) + end, + ["symbols-outline.nvim"] = function() -- vim.notify("Setting up cutlass plugin", "info") require("symbols-outline").setup() end, + ["vim-matchup"] = function() + vim.g.matchup_matchparen_offscreen = {} + end, } -M.autocmds = { -} +M.autocmds = {} -M.cmds = { -} +M.cmds = {} + +M.binds = { -M.binds = -{ { + -- Hop char "C-g", [[HopChar1]], name = "Go to anychar in the screen", @@ -87,6 +110,14 @@ M.binds = name = "Go to word in the screen", mode = "nv", }, + + -- -- Expand region + -- { + -- "v", + -- [[(expand_region_expand)]], + -- name = "Expand selection", + -- mode = "nv", + -- }, } return M diff --git a/lua/user/modules/features/views/init.lua b/lua/user/modules/features/views/init.lua index fd2760c8..69fa82c7 100644 --- a/lua/user/modules/features/views/init.lua +++ b/lua/user/modules/features/views/init.lua @@ -23,7 +23,15 @@ M.configs = { M.autocmds = {} -M.cmds = {} +M.cmds = { + -- command! BufferKillForce lua require('lvim.core.bufferline').buf_kill('bd', nil, true) + { + "BufferKillForce", + function() + require("lvim.core.bufferline").buf_kill("bd", nil, true) + end, + }, +} M.binds = { { From 155a4a1e2646510423ff9cf46de98f07e0734e93 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Fri, 4 Nov 2022 09:49:01 +0700 Subject: [PATCH 05/70] feat: add some todo notes --- Daniel_plugin.txt | 107 ++++++++++++++++++++++++++++++++++++++++++++++ todo.norg | 30 +++++++++++++ 2 files changed, 137 insertions(+) create mode 100644 Daniel_plugin.txt create mode 100644 todo.norg diff --git a/Daniel_plugin.txt b/Daniel_plugin.txt new file mode 100644 index 00000000..7c49b493 --- /dev/null +++ b/Daniel_plugin.txt @@ -0,0 +1,107 @@ + + • FixCursorHold.nvim + • LuaSnip • aurora (not loaded) + • barbar.nvim + • better-escape.nvim (not loaded) + • cmp-buffer + • cmp-cmdline + • cmp-nvim-lsp + • cmp-nvim-lsp-signature-help + • cmp-path + • cmp-spell + • cmp_luasnip + • codi.vim -- Python scratch pad + • commented.nvim (not loaded) + • copilot-cmp (not loaded) + • copilot.vim + • crates.nvim (not loaded) + • dap-buddy.nvim + • dashboard-nvim + • filetype.nvim + • friendly-snippets + • git-conflict.nvim + • github-ci.nvim (not loaded)-- plugin by daniel, not complete. require "hub" + • gitlinker.nvim (not loaded) -- share code as a gist + • gitsigns.nvim + • gruvqueen (not loaded) -- theme + • hlargs.nvim -- Highlight arguments' definitions and usages, asynchronously, using Treesitter + • impatient.nvim + • indent-blankline.nvim -- indent sign (|) + • iswap.nvim -- swap order of func param + • lazygit.nvim (not loaded) + • lightspeed.nvim -- like HOP plugin + • lsp-colors.nvim + • lsp-status.nvim + • lspkind-nvim (them Icon cho LSP suggestion) + • lua-dev.nvim (manually loaded) + • markdown-preview.nvim + • material.nvim + • mkdir.nvim + • neogen (not loaded) + • neogit + • neomake (not loaded) + • neotest + • noice.nvim + • nui.nvim + • nvim-autopairs -- Auto generate close bracket when type open brackt + • nvim-bqf (not loaded) -- better quick fix + • nvim-cmp + • nvim-colorizer.lua + • nvim-coverage + • nvim-dap (not loaded) + • nvim-dap-python (not loaded) + • nvim-dap-ui (not loaded) + • nvim-gps + • nvim-jdtls (not loaded) + • nvim-lspconfig + • nvim-navic + • nvim-notify + • nvim-tree.lua (not loaded) + • nvim-treesitter + • nvim-treesitter-textobjects + • nvim-treesitter-textsubjects + • nvim-ts-autotag -- Use treesitter to autoclose and autorename html tag + • nvim-ts-context-commentstring + • nvim-ufo + • nvim-web-devicons + • nvim-yati -- Indent plugin with treesitter + • nvimux (not loaded) + • one-small-step-for-vimkind + • orgmode.nvim (not loaded) + • package-info.nvim (not loaded) + • packer.nvim (manually loaded) + • playground (not loaded) + • plenary.nvim + • presence.nvim -- Discord Rich Presence plugin for Neovim + • preview-swagger.nvim (not loaded) -- Preview swager in real time + • promise-async + • refactoring.nvim + • rust.vim (not loaded) + • sniprun (not loaded) + • sonokai (not loaded) -- theme + • spellsitter.nvim + • stabilize.nvim -- Neovim plugin to stabilize buffer content on window open/close events. + • suda.vim (not loaded) + • surround.nvim + • tabout.nvim + • telescope-file-browser.nvim + • telescope-fzf-native.nvim + • telescope-project.nvim + • telescope-ui-select.nvim + • telescope.nvim + • todo-comments.nvim (not loaded) + • tokyonight.nvim (not loaded) + • trouble.nvim (not loaded) + • urlview.nvim + • vgit.nvim -- like neogit. TODO: try to check + • vim-dispatch (not loaded) + • vim-fugitive (not loaded) + • vim-grammarous (not loaded) + • vim-matchup + • vim-slash (not loaded) -- improve search in nvim (press '/') + • vim-test (not loaded) + • vimwiki (not loaded) + • vscode.nvim (not loaded) + • which-key.nvim + • windline.nvim + • window-picker.nvim diff --git a/todo.norg b/todo.norg new file mode 100644 index 00000000..d713f2ba --- /dev/null +++ b/todo.norg @@ -0,0 +1,30 @@ +@document.meta +title: todo +description: +authors: tuanba1 +categories: +created: 2022-11-04 +updated: 2022-11-04 +version: 0.0.15 +@end + +* +TODO: check why out put some line in open file (currently workaround by out put it into mini) + +* C-k not work randomly +* integrate git-sign into git feature +* Error msg when save +* mark down lsp (remark) not work +* Markdown preview +* integrate octo plugin (edit github PR in nvim) +* Telescope find file (leader-f-f) work not correct +* binding C-g for Hop , not 'ghw' +* resize windows hydra +* better folding (maybe use UFO insteadof default tree-sitter) +* copilot +* sometime current line is undeadable because of grey color +* Virtual whichkey hint +* Neorg should auto load when open norg file +* close (leader-b-d) buffer should go to the next buffer in bufferline +* refactoring +* Neogit confirm winfows when commiting code not correct (nothing display, not close ) From abd815797c6365f899ba6a2f1fa3d66b5226a88e Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Fri, 4 Nov 2022 10:42:19 +0700 Subject: [PATCH 06/70] feat: add some user config --- config.lua | 49 +++++++++++++++++++++++++++++++--- modules.lua | 75 ++++++++++++++++++++++++++++++----------------------- 2 files changed, 88 insertions(+), 36 deletions(-) diff --git a/config.lua b/config.lua index 47ad4098..76bc2cac 100644 --- a/config.lua +++ b/config.lua @@ -5,15 +5,14 @@ -- automatically). -- ADDING A PACKAGE --- --- doom.use_package("EdenEast/nightfox.nvim", "sainnhe/sonokai") --- doom.use_package({ +-- doom.use_package("EdenEast/nightfox.nvim", "sainnhe/sonokai") doom.use_package({ -- "ur4ltz/surround.nvim", -- config = function() -- require("surround").setup({mappings_style = "sandwich"}) -- end -- }) + -- ADDING A KEYBIND -- -- doom.use_keybind({ @@ -85,3 +84,47 @@ doom.features.comment.binds = { }, } -- +-- +-- some un categorized plugin here +-- TODO: Will move them into a module + +-- doom.use_package({ +-- "WhoIsSethDaniel/toggle-lsp-diagnostics.nvim", +-- config = function() +-- require'toggle_lsp_diagnostics'.init() +-- end +-- }) + + +-- Packer + +doom.use_package({ + "folke/noice.nvim", + config = function() + require("noice").setup({ + + notify = {enabled = false, view = "notify"}, + messages = {enabled = true, view = "mini"}, + lsp = { + -- progress = {enabled = false}, + hover = {enabled = false}, + signature = { enabled = false} + }, + }) + + end, + requires = { + -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries + "MunifTanjim/nui.nvim", + -- OPTIONAL: + -- `nvim-notify` is only needed, if you want to use the notification view. + -- If not available, we use `mini` as the fallback + "rcarriga/nvim-notify", + } +}) + +-- fold setting +local opt = vim.opt +opt.foldlevel = 1 +opt.foldmethod = "expr" +opt.foldexpr = "nvim_treesitter#foldexpr()" diff --git a/modules.lua b/modules.lua index 6da20448..7976abf0 100644 --- a/modules.lua +++ b/modules.lua @@ -1,7 +1,7 @@ --- modules.lua - Doom nvim module selection -- --- modules.lua controls what Doom nvim plugins modules are enabled and +-- modules.lua - Doom nvim module selection -- what features are being used. +-- modules.lua controls what Doom nvim plugins modules are enabled and -- -- Uncomment a plugin to enable it and comment out to disable and uninstall it. -- Once done, restart doom-nvim and run `:PackerInstall`. @@ -15,9 +15,14 @@ return { "comment", -- Adds keybinds to comment in any language "linter", -- Linting and formatting for languages "lsp", -- Code completion - "extra_snippets", -- Code snippets for all languages + "lsp_progress", -- Check status of LSP loading + + + "extra_snippets", -- Code snippets for all languages +-- -- Editor + "auto_session", -- Remember sessions between loads "colorizer", -- Show colors in neovim "editorconfig", -- Support editorconfig files @@ -29,8 +34,8 @@ return { -- "doom_themes", -- Extra themes for doom -- UI Components - "lsp_progress", -- Check status of LSP loading "tabline", -- Tab bar buffer switcher + "dashboard", -- A pretty dashboard upon opening "trouble", -- A pretty diagnostic viewer "statusline", -- A pretty status line at the bottom of the buffer @@ -60,43 +65,47 @@ return { "views", -- "charcounter", -- custom module test }, + langs = { - -- Scripts + -- -- Scripts "lua", - -- "python", - "bash", - -- "fish", - -- "gdscript", - -- "gdscript", - -- "php", - -- "ruby", - - -- Web + -- -- "python", + -- "bash", + -- -- "fish", + -- -- "gdscript", + -- -- "gdscript", + -- -- "php", + -- -- "ruby", + -- + -- -- Web "javascript", "typescript", - "css", - -- "vue", - -- "tailwindcss", - -- "svelte", - - -- Compiled - "rust", - -- "cc", - -- "ocaml", "haskell", - - -- JIT - -- "c_sharp", - -- "kotlin", - -- "java", - - -- "json", - -- "yaml", - -- "toml", + -- "css", + -- -- "vue", + -- -- "tailwindcss", + -- -- "svelte", + -- + -- -- Compiled + -- "rust", + -- -- "cc", + -- -- "ocaml", "haskell", + -- + -- -- JIT + -- -- "c_sharp", + -- -- "kotlin", + -- -- "java", + -- + "json", + "yaml", + -- -- "toml", "markdown", - -- "terraform", -- Terraform / hcl files support + -- -- "terraform", -- Terraform / hcl files support "dockerfile", -- "nix", -- Nix declarations + }, } + + -- vim: sw=2 sts=2 ts=2 fdm=indent expandtab From 7a40c10331b5fc60fd3ecd23d11bbaac2372f5b9 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Fri, 4 Nov 2022 10:44:42 +0700 Subject: [PATCH 07/70] feat: enable indentlines automatically, not when change colorscheme --- lua/doom/modules/features/indentlines/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/modules/features/indentlines/init.lua b/lua/doom/modules/features/indentlines/init.lua index 510a2ec3..b8e12a2e 100644 --- a/lua/doom/modules/features/indentlines/init.lua +++ b/lua/doom/modules/features/indentlines/init.lua @@ -12,7 +12,7 @@ indentlines.packages = { ["indent-blankline.nvim"] = { "lukas-reineke/indent-blankline.nvim", commit = "db7cbcb40cc00fc5d6074d7569fb37197705e7f6", - event = "ColorScheme", + -- event = "ColorScheme", -- No idea why the plugin should be activated when change colorscheme }, } From e4e6283e78d619d0c9cb4eabe06aa4e0d30f2659 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Fri, 4 Nov 2022 11:38:26 +0700 Subject: [PATCH 08/70] feat: add some git shortcut --- lua/user/modules/features/git/init.lua | 34 +++++++++++++++++--------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/lua/user/modules/features/git/init.lua b/lua/user/modules/features/git/init.lua index 1482bd26..f5a88e65 100644 --- a/lua/user/modules/features/git/init.lua +++ b/lua/user/modules/features/git/init.lua @@ -45,14 +45,26 @@ M.cmds = { } -- TODO: fix bug doom-nvim, so it can load if 'M.bind= {}' --- M.binds = --- { --- -- { --- -- "ghw", --- -- [[HopWord]], --- -- name = "Go to word in the screen", --- -- mode = "nv", --- -- }, --- } - -return M +M.binds = { + { + "]c", + [[Gitsigns next_hunk]], + name = "Next hunk", + mode = "n", + }, + { + "[c", + [[Gitsigns prev_hunk]], + name = "Prev hunk", + mode = "n", + }, + { + "g", + -- name = "+git", + { + { "g", "Neogit", name = "Neogit" }, + { "l", "Telescope git_bcommits", name = "Current buffer logs" }, + { "L", "Telescope git_commits", name = "Git Logs" }, + } + }, +} return M From fb5d3a0e63fea901c89fa7c0b2ec4339f02b8bb3 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Wed, 16 Nov 2022 16:31:42 +0700 Subject: [PATCH 09/70] fix: nvim-tree broken when lsp disabled --- lua/doom/modules/features/explorer/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/modules/features/explorer/init.lua b/lua/doom/modules/features/explorer/init.lua index b8adf7a4..bd5fb5b9 100644 --- a/lua/doom/modules/features/explorer/init.lua +++ b/lua/doom/modules/features/explorer/init.lua @@ -114,7 +114,7 @@ explorer.configs["nvim-tree.lua"] = function() local tree_cb = require("nvim-tree.config").nvim_tree_callback - local override_table + local override_table = {} if is_module_enabled("features", "lsp") then override_table = { diagnostics = { From 54a1c4d22b9279620bdc01144d746e034ebcb07f Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Wed, 16 Nov 2022 16:31:42 +0700 Subject: [PATCH 10/70] fix: nvim-tree broken when lsp disabled --- lua/doom/modules/features/explorer/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/modules/features/explorer/init.lua b/lua/doom/modules/features/explorer/init.lua index b8adf7a4..bd5fb5b9 100644 --- a/lua/doom/modules/features/explorer/init.lua +++ b/lua/doom/modules/features/explorer/init.lua @@ -114,7 +114,7 @@ explorer.configs["nvim-tree.lua"] = function() local tree_cb = require("nvim-tree.config").nvim_tree_callback - local override_table + local override_table = {} if is_module_enabled("features", "lsp") then override_table = { diagnostics = { From 0bd3c7c3120088f427842166bd8ed0675e53a912 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Fri, 18 Nov 2022 20:48:47 +0700 Subject: [PATCH 11/70] feat: add fold module --- lua/user/modules/features/fold/init.lua | 73 +++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 lua/user/modules/features/fold/init.lua diff --git a/lua/user/modules/features/fold/init.lua b/lua/user/modules/features/fold/init.lua new file mode 100644 index 00000000..8e73cefb --- /dev/null +++ b/lua/user/modules/features/fold/init.lua @@ -0,0 +1,73 @@ +local M = {} + +M.settings = { + foldcolumn = "1", -- '0' is not bad + foldlevel = 2, -- Using ufo provider need a large value, feel free to decrease the value + foldlevelstart = 2, + foldenable = true, +} + +M.packages = { + ["nvim-ufo"] = { + "kevinhwang91/nvim-ufo", + requires = "kevinhwang91/promise-async", + }, +} + +M.configs = { + ["nvim-ufo"] = function() + local settings = doom.features.fold.settings + + vim.o.foldcolumn = settings.foldcolumn + vim.o.foldlevel = settings.foldlevel + vim.o.foldlevelstart = settings.foldlevelstart + vim.o.foldenable = settings.foldenable + + -- use tree-sitter as the fold client TODO: try to use LSP + -- + require("ufo").setup({ + provider_selector = function(bufnr, filetype, buftype) + return { "treesitter", "indent" } + end, + + -- TODO: Need to check why preview doesnot work + preview = { + mappings = { + scrollB = "h", + scrollF = "l", + scrollU = "k", + scrollD = "j", + scrollE = "", + scrollY = "", + close = "q", + switch = "", + trace = "", + }, + win_config = { + maxheight = 60, + }, + }, + }) + + -- require("ufo").setup({ + -- provider_selector = function(bufnr, filetype, buftype) + -- return "" + -- end, + -- }) + end, +} + +M.autocmds = {} + +M.cmds = {} + +M.binds = { + { + "zv", + [[lua require('ufo.preview'):peekFoldedLinesUnderCursor(true, false) ]], + name = "Fold preview", + mode = "nv", + }, +} + +return M From b9009668d8972f12ab4ae63c9aba531f0bf2c1dc Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Fri, 18 Nov 2022 20:50:36 +0700 Subject: [PATCH 12/70] Minor (non important) changes --- lua/user/modules/features/navigation/init.lua | 2 +- lua/user/modules/features/template-init.lua | 1 + todo.norg | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/user/modules/features/navigation/init.lua b/lua/user/modules/features/navigation/init.lua index 424e22b2..ca446bea 100644 --- a/lua/user/modules/features/navigation/init.lua +++ b/lua/user/modules/features/navigation/init.lua @@ -35,7 +35,7 @@ M.packages = { ["quick-scope"] = { -- highlight char to go left/righ "unblevable/quick-scope", }, - ["vim-matchup"] = { -- highlight char to go left/righ + ["vim-matchup"] = { -- smart open/close match navigation "andymass/vim-matchup", }, } diff --git a/lua/user/modules/features/template-init.lua b/lua/user/modules/features/template-init.lua index 5855c0bc..7b10c214 100644 --- a/lua/user/modules/features/template-init.lua +++ b/lua/user/modules/features/template-init.lua @@ -48,6 +48,7 @@ M.autocmds = { M.cmds = { } +-- M.requires_modules = { "features.auto_install" } -- M.binds kk -- { diff --git a/todo.norg b/todo.norg index d713f2ba..999ea918 100644 --- a/todo.norg +++ b/todo.norg @@ -20,7 +20,8 @@ TODO: check why out put some line in open file (currently workaround by out put * Telescope find file (leader-f-f) work not correct * binding C-g for Hop , not 'ghw' * resize windows hydra -* better folding (maybe use UFO insteadof default tree-sitter) +* -------- better folding (maybe use UFO insteadof default tree-sitter) +* Luasnip work independly (for golang) * copilot * sometime current line is undeadable because of grey color * Virtual whichkey hint From bd8d30acface7f6dc6daada9148e430f2d5e02ef Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Fri, 18 Nov 2022 20:52:36 +0700 Subject: [PATCH 13/70] Change modules config --- config.lua | 185 +++++++++++++++++++++++++++++++++------------------- modules.lua | 141 ++++++++++++++++++++------------------- 2 files changed, 187 insertions(+), 139 deletions(-) diff --git a/config.lua b/config.lua index 76bc2cac..4726f75f 100644 --- a/config.lua +++ b/config.lua @@ -12,10 +12,7 @@ -- end -- }) - --- ADDING A KEYBIND --- --- doom.use_keybind({ +-- ADDING A KEYBIND doom.use_keybind({ -- -- The `name` field will add the keybind to whichkey -- {"s", name = '+search', { -- -- Bind to a vim command @@ -40,78 +37,107 @@ -- { "FileType", "javascript", function() print('This is a javascript file') end } -- }) -doom.indent = 2 -doom.core.treesitter.settings.show_compiler_warning_message = false -doom.core.reloader.settings.reload_on_save = false +-- doom.indent = 2 +-- doom.core.treesitter.settings.show_compiler_warning_message = false +-- doom.core.reloader.settings.reload_on_save = false +-- +if doom.langs.lua ~= nil then + doom.langs.lua.settings.disable_lsp = true +end -doom.langs.lua.settings.disable_lsp = true -doom.features.tabline.settings.options.enforce_regular_tabs = false --- vim: sw=2 sts=2 ts=2 expandtab +if doom.features.lsp ~= nil then + doom.features.lsp.requires_modules = { "features.auto_install" } +end +-- doom.features. +-- -- vim: sw=2 sts=2 ts=2 expandtab +-- -- +-- -- custom keybindings for tabline +if doom.features.tabline ~= nil then + doom.features.tabline.settings.options.enforce_regular_tabs = false + doom.features.tabline.binds = { + { + "H", + name = "Left", + function() + require("bufferline").cycle(-1) + end, + }, + { + "L", + name = "Left", + function() + require("bufferline").cycle(1) + end, + }, + } +end +-- -- custom keybindings for comments +-- -- +if doom.features.comment ~= nil then + doom.features.comment.binds = { + { + "gc", + [[lua require("Comment.api").toggle.linewise(vim.fn.visualmode())]], + name = "Comment line", + mode = "v", + }, + { + "gcc", + [[lua require("Comment.api").toggle.linewise.current()]], + name = "Comment line", + }, + { + "gcA", + [[lua require("Comment.api").insert.linewise.eol()]], + name = "Comment end of line", + mode = "ni", + }, + } +end +-- -- custom setting for markdown +-- -- doom.langs.markdown.settings.disable_lsp = true +-- -- custom setting for -- --- custom keybindings for tabline -doom.features.tabline.binds = { - {"H", - name = "Left", - function() - require("bufferline").cycle(-1) - end - }, - {"L", - name = "Left", - function() - require("bufferline").cycle(1) - end - }, -} --- custom keybindings for comments +-- -- +if doom.features.whichkey ~= nil then + doom.features.whichkey.settings.plugins.marks = true + doom.features.whichkey.settings.plugins.presets.operators = true + doom.features.whichkey.settings.plugins.registers = true +end + +if doom.features.fold ~= nil then + doom.features.fold.settings.foldlevelstart = 3 +end +-- -- +-- -- +-- -- +-- -- some un categorized plugin here +-- -- TODO: Will move them into a module -- -doom.features.comment.binds = { - { - "gc", - [[lua require("Comment.api").toggle.linewise(vim.fn.visualmode())]], - name = "Comment line", - mode = "v", - }, { - "gcc", - [[lua require("Comment.api").toggle.linewise.current()]], - name = "Comment line", - }, - { - "gcA", - [[lua require("Comment.api").insert.linewise.eol()]], - name = "Comment end of line", - mode = "ni", - }, -} +-- -- doom.use_package({ +-- -- "WhoIsSethDaniel/toggle-lsp-diagnostics.nvim", +-- -- config = function() +-- -- require'toggle_lsp_diagnostics'.init() +-- -- }) +-- -- end -- -- --- some un categorized plugin here --- TODO: Will move them into a module - --- doom.use_package({ --- "WhoIsSethDaniel/toggle-lsp-diagnostics.nvim", --- config = function() --- require'toggle_lsp_diagnostics'.init() --- end --- }) - - --- Packer - +-- -- Packer +-- doom.use_package({ "folke/noice.nvim", config = function() require("noice").setup({ - notify = {enabled = false, view = "notify"}, - messages = {enabled = true, view = "mini"}, + notify = { enabled = true, view = "notify" }, + messages = { enabled = true, view = "mini", view_error = "notify", view_warn = "notify" }, + -- messages = {enabled = true, view = "mini"}, lsp = { -- progress = {enabled = false}, - hover = {enabled = false}, - signature = { enabled = false} + hover = { enabled = false }, + signature = { enabled = false }, }, }) - end, requires = { -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries @@ -120,11 +146,34 @@ doom.use_package({ -- `nvim-notify` is only needed, if you want to use the notification view. -- If not available, we use `mini` as the fallback "rcarriga/nvim-notify", - } + }, }) +-- +-- doom.use_package { +-- 'iamcco/markdown-preview.nvim', +-- run = function() vim.fn['mkdp#util#install']() end, -- if it is not work, sometime you need to manual run this command to instal dependency +-- ft = {'markdown', 'md'} +-- } +-- doom.use_package {"SidOfc/mkdx", +-- ft = {'markdown', 'md'} +-- } +-- +-- doom.use_package {"rafcamlet/nvim-luapad"} +-- doom.use_package 'anuvyklack/hydra.nvim' +-- -- fold setting +-- local opt = vim.opt +-- opt.foldmethod = "expr" +-- opt.foldlevel = 1 +-- opt.foldlevelstart = 1 +-- opt.foldexpr = "nvim_treesitter#foldexpr()" +-- +-- +-- vim.cmd([[ +-- " hi CursorLine cterm=NONE ctermbg=green ctermfg=white guibg=green guifg=white +-- " hi CursorLine cterm=NONE ctermbg=green guibg=green +-- " hi CursorLine cterm=NONE ctermfg=white guibg=green guifg=white +-- hi CursorLine cterm=underline guibg=#21252a +-- +-- ]]) --- fold setting -local opt = vim.opt -opt.foldlevel = 1 -opt.foldmethod = "expr" -opt.foldexpr = "nvim_treesitter#foldexpr()" +vim.opt.shortmess = "F" diff --git a/modules.lua b/modules.lua index 7976abf0..46c51164 100644 --- a/modules.lua +++ b/modules.lua @@ -8,100 +8,99 @@ return { features = { - -- Language features - "annotations", -- Code annotation generator +-- -- Language features +-- "annotations", -- Code annotation generator "auto_install", -- Auto install LSP providers "autopairs", -- Automatically close character pairs - "comment", -- Adds keybinds to comment in any language + "comment", -- Adds keybinds to comment in any language "linter", -- Linting and formatting for languages - "lsp", -- Code completion - "lsp_progress", -- Check status of LSP loading - - - + "lsp", -- Code completion "lsp_progress", -- Check status of LSP loading +-- +-- "extra_snippets", -- Code snippets for all languages +-- -- +-- -- Editor -- - -- Editor - - "auto_session", -- Remember sessions between loads - "colorizer", -- Show colors in neovim +-- "auto_session", -- Remember sessions between loads + -- "colorizer", -- Show colors in neovim "editorconfig", -- Support editorconfig files - -- "gitsigns", -- Show git changes in sidebar +-- -- "gitsigns", -- Show git changes in sidebar "illuminate", -- Highlight other copies of the word you're hovering on - "indentlines", -- Show indent lines with special characters - "range_highlight", -- Highlight selected range from commands + "indentlines", -- Show indent lines with special characters "range_highlight", -- Highlight selected range from commands "todo_comments", -- Highlight TODO: comments - -- "doom_themes", -- Extra themes for doom - - -- UI Components +-- -- "doom_themes", -- Extra themes for doom +-- +-- -- UI Components "tabline", -- Tab bar buffer switcher - +-- "dashboard", -- A pretty dashboard upon opening "trouble", -- A pretty diagnostic viewer "statusline", -- A pretty status line at the bottom of the buffer - "minimap", -- Shows current position in document +-- "minimap", -- Shows current position in document "terminal", -- Integrated terminal in neovim - -- "symbols", -- Navigate between code symbols using telescope - -- "ranger", -- File explorer in neovim (TODO: Test) - -- "restclient", -- Test HTTP requests from neovim (TODO: Test) - -- "show_registers", -- Show and navigate between registers - - -- Tools - -- "dap", -- Debug code through neovim - "repl", -- Interactive REPL in neovim - "explorer", -- An enhanced filetree explorer - -- "firenvim", -- Embed neovim in your browser - -- "lazygit", -- Lazy git integration - -- "neogit", -- A git client for neovim - "neorg", -- Organise your life - "projects", -- Quickly switch between projects - -- "superman", -- Read unix man pages in neovim - -- "suda", -- Save using sudo when necessary +-- -- "symbols", -- Navigate between code symbols using telescope +-- -- "ranger", -- File explorer in neovim (TODO: Test) +-- -- "restclient", -- Test HTTP requests from neovim (TODO: Test) +-- -- "show_registers", -- Show and navigate between registers +-- +-- -- Tools +-- -- "dap", -- Debug code through neovim +-- "repl", -- Interactive REPL in neovim + "explorer", -- An enhanced filetree explorer +-- -- "firenvim", -- Embed neovim in your browser +-- -- "lazygit", -- Lazy git integration + -- "neogit", -- A git client for neovim +-- "neorg", -- Organise your life +-- "projects", -- Quickly switch between projects +-- -- "superman", -- Read unix man pages in neovim +-- -- "suda", -- Save using sudo when necessary "telescope", -- Fuzzy searcher to find files, grep code and more "whichkey", -- An interactive sheet - ------------------- user module +-- ------------------- user module "navigation", "git", "views", - -- "charcounter", -- custom module test + "fold", +-- -- "charcounter", -- custom module test }, langs = { - -- -- Scripts + -- -- -- Scripts "lua", - -- -- "python", - -- "bash", - -- -- "fish", - -- -- "gdscript", - -- -- "gdscript", - -- -- "php", - -- -- "ruby", - -- - -- -- Web - "javascript", - "typescript", - -- "css", - -- -- "vue", - -- -- "tailwindcss", - -- -- "svelte", - -- - -- -- Compiled - -- "rust", - -- -- "cc", - -- -- "ocaml", "haskell", - -- - -- -- JIT - -- -- "c_sharp", - -- -- "kotlin", - -- -- "java", - -- - "json", - "yaml", - -- -- "toml", + "go", + -- -- -- "python", + -- -- "bash", + -- -- -- "fish", + -- -- -- "gdscript", + -- -- -- "gdscript", + -- -- -- "php", + -- -- -- "ruby", + -- -- + -- -- -- Web + -- "javascript", + -- "typescript", + -- -- "css", + -- -- -- "vue", + -- -- -- "tailwindcss", + -- -- -- "svelte", + -- -- + -- -- -- Compiled + -- -- "rust", + -- -- -- "cc", + -- -- -- "ocaml", "haskell", + -- -- + -- -- -- JIT + -- -- -- "c_sharp", + -- -- -- "kotlin", + -- -- -- "java", + -- -- + -- "json", + -- "yaml", + -- -- -- "toml", "markdown", - -- -- "terraform", -- Terraform / hcl files support - "dockerfile", - -- "nix", -- Nix declarations + -- -- -- "terraform", -- Terraform / hcl files support + -- "dockerfile", + -- -- "nix", -- Nix declarations }, } From 9daabd76b43d279fa29ec8b2c168cafc2af708de Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Wed, 7 Dec 2022 13:13:08 +0700 Subject: [PATCH 14/70] feat(scope): Add Module for source code navigation --- lua/user/modules/features/navigation/init.lua | 47 ++++++++++++++----- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/lua/user/modules/features/navigation/init.lua b/lua/user/modules/features/navigation/init.lua index ca446bea..14086dd8 100644 --- a/lua/user/modules/features/navigation/init.lua +++ b/lua/user/modules/features/navigation/init.lua @@ -10,13 +10,10 @@ M.packages = { ["vim-sandwich"] = { "machakann/vim-sandwich", }, - ["symbols-outline.nvim"] = { - "simrat39/symbols-outline.nvim", - }, + ["symbols-outline.nvim"] = { "simrat39/symbols-outline.nvim", }, ["cutlass.nvim"] = { - "tuanbass/cutlass.nvim", - }, + "tuanbass/cutlass.nvim", }, ["textobj1"] = { "kana/vim-textobj-line", }, @@ -32,12 +29,15 @@ M.packages = { ["hop.nvim"] = { "phaazon/hop.nvim", -- jum to anywhere in screen }, - ["quick-scope"] = { -- highlight char to go left/righ - "unblevable/quick-scope", - }, - ["vim-matchup"] = { -- smart open/close match navigation + ["vim-matchup"] = { -- smart open/close match navigation "andymass/vim-matchup", }, + ["delaytrain.nvim"] = { -- penalty when repeat j/k for navigation + "ja-ford/delaytrain.nvim", + }, + ["better-escape.nvim"] = { -- penalty when repeat j/k for navigation + "max397574/better-escape.nvim", + }, } M.configs = { @@ -51,6 +51,13 @@ M.configs = { cut_key = "m", }) end, + ["better-escape.nvim"] = function() + require("better_escape").setup({ + mapping = {"jk", "jj", "kj", "kk"}, -- a table with mappings to use + keys = "", -- keys used for escaping, if it is a function will use the result everytime + }) + + end, ["hop.nvim"] = function() -- vim.notify("Setting up cutlass plugin", "info") @@ -83,6 +90,18 @@ M.configs = { ["vim-matchup"] = function() vim.g.matchup_matchparen_offscreen = {} end, + ["delaytrain.nvim"] = function() + require('delaytrain').setup { + delay_ms = 500, -- How long repeated usage of a key should be prevented + grace_period = 3, -- How many repeated keypresses are allowed + keys = { -- Which keys (in which modes) should be delayed + ['n'] = {'h', 'j', 'k', 'l'}, + -- ['nvi'] = {'', '', '', ''}, + }, + } + -- vim.notify("Setting up cutlass plugin", "info") + end, + } M.autocmds = {} @@ -93,10 +112,10 @@ M.binds = { { -- Hop char - "C-g", + "", [[HopChar1]], name = "Go to anychar in the screen", - mode = "nv", + mode = "inv", }, { "ghc", @@ -110,6 +129,12 @@ M.binds = { name = "Go to word in the screen", mode = "nv", }, + { + "w", + [[HopWord]], + name = "Go to word in the screen", + mode = "nv", + }, -- -- Expand region -- { From 37052753ca47ea79639843d195b04cc5b4ab5aa5 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Wed, 7 Dec 2022 13:13:51 +0700 Subject: [PATCH 15/70] Add module for windows and view --- lua/user/modules/features/views/init.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lua/user/modules/features/views/init.lua b/lua/user/modules/features/views/init.lua index 69fa82c7..21dfcbb1 100644 --- a/lua/user/modules/features/views/init.lua +++ b/lua/user/modules/features/views/init.lua @@ -9,6 +9,15 @@ M.packages = { ["vimade"] = { "TaDaa/vimade", }, + ["nvim-treesitter-context"] = { + "nvim-treesitter/nvim-treesitter-context", + }, + ["vim-scratchpad"] = { + "konfekt/vim-scratchpad", + }, + -- ["quick-scope"] = { -- highlight char to go left/righ + -- "unblevable/quick-scope", + -- }, } M.configs = { From eaeeca934c8628755d14f57e4c2c9546dd3132c5 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Wed, 7 Dec 2022 13:14:31 +0700 Subject: [PATCH 16/70] add module for reactoring features --- lua/user/modules/features/refactor/init.lua | 131 +++++--------------- 1 file changed, 30 insertions(+), 101 deletions(-) diff --git a/lua/user/modules/features/refactor/init.lua b/lua/user/modules/features/refactor/init.lua index daf84569..42f83cbc 100644 --- a/lua/user/modules/features/refactor/init.lua +++ b/lua/user/modules/features/refactor/init.lua @@ -1,119 +1,48 @@ -local char_counter = {} +local M = {} -char_counter.settings = { - popup = { - position = "50%", - size = { - width = 80, - height = 40, - }, - border = { - padding = { - top = 2, - bottom = 2, - left = 3, - right = 3, - }, - }, - style = "rounded", - enter = true, - buf_options = { - modifiable = true, - readonly = true, - }, - }, +M.settings = { } -char_counter.packages = { - ["nui.nvim"] = { - "MunifTanjim/nui.nvim", - -- cmd = { "CountPrint" }, +M.packages = { + ["refactoring.nvim"] = { + "ThePrimeagen/refactoring.nvim", }, -} + -- ["vimade"] = { + -- "TaDaa/vimade", + -- }, -char_counter.configs = { - ["nui.nvim"] = function() - vim.notify("char_counter: nui.nvim loaded", "info") - end, } -char_counter._insert_enter_char_count = nil -char_counter._accumulated_difference = 0 -char_counter._get_current_buffer_char_count = function() - local lines = vim.api.nvim_buf_line_count(0) - local chars = 0 - for _, line in ipairs(vim.api.nvim_buf_get_lines(0, 0, lines, false)) do - chars = chars + #line - end - return chars -end +M.configs = { + ["refactoring.nvim"] = function() + require("refactoring").setup {} + local has_telescope = pcall(require, "telescope") + if (has_telescope) then -- TODO: integrate with telescope. Dont know why cannot load telescope here + local res = require("telescope").load_extension("refactoring") + print (" load extension:", res) + end + end, -char_counter.autocmds = { - { - "InsertEnter", - "*", - function() - -- Only operate on normal file buffers - print(("buftype: %s"):format(vim.bo.buftype)) - if vim.bo.buftype == "" then - -- Store current char count - char_counter._insert_enter_char_count = char_counter._get_current_buffer_char_count() - end - end, - }, - { - "InsertLeave", - "*", - function() - -- Only operate on normal file buffers - if vim.bo.buftype == "" and char_counter._insert_enter_char_count then - -- Find the amount of chars added or removed - local new_count = char_counter._get_current_buffer_char_count() - local diff = new_count - char_counter._insert_enter_char_count - print(new_count, diff) - -- Add the difference to the accumulated total - char_counter._accumulated_difference = char_counter._accumulated_difference + diff - print(("Accumulated difference %s"):format(char_counter._accumulated_difference)) - end - end, - }, } -char_counter.cmds = { - { - "CountPrint", - function() - local Popup = require("nui.popup") - local popup = Popup(char_counter.settings.popup) - popup:mount() - popup:map("n", "", function() - popup:unmount() - end) +M.autocmds = { +} - local msg = ("char_counter: You have typed %s characters since I started counting."):format( - char_counter._accumulated_difference - ) - vim.api.nvim_buf_set_lines(popup.bufnr, 0, 1, false, { msg }) - end, - }, - { - "CountReset", - function() - char_counter._accumulated_difference = 0 - vim.notify("char_counter: Reset count!", "info") - end, - }, +M.cmds = { } +-- M.requires_modules = { "features.auto_install" } -char_counter.binds = { +M.binds = { { - "i", - name = "+info", - { -- Adds a new `whichkey` folder called `+info` - { "c", ":CountPrint", name = "Print new chars" }, -- Binds `:CountPrint` to `ic` - { "r", ":CountReset", name = "Reset char count" }, -- Binds `:CountPrint` to `ic` + "co", + name = "+Refactor", + mode = "n", + { + {"v", [[lua require('refactoring').debug.print_var({ normal = true })]], name = "Debug Printvar"}, + {"p", [[lua require('refactoring').debug.printf({below = false})]], name = "Debug Print " }, + {"c", [[lua require('refactoring').debug.cleanup({})]], name = "Clean Debug" } }, }, } -return char_counter +return M From 277916d157619f95f3e844b4b1fa0aa5acd74af0 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Wed, 7 Dec 2022 13:15:07 +0700 Subject: [PATCH 17/70] Add a template file to start a module --- lua/user/modules/features/template-init.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/user/modules/features/template-init.lua b/lua/user/modules/features/template-init.lua index 7b10c214..7091a0df 100644 --- a/lua/user/modules/features/template-init.lua +++ b/lua/user/modules/features/template-init.lua @@ -49,7 +49,6 @@ M.autocmds = { M.cmds = { } -- M.requires_modules = { "features.auto_install" } - -- M.binds kk -- { -- -- { @@ -60,4 +59,7 @@ M.cmds = { -- -- }, -- } +-- Notes: +-- code for load module located at doom.core.module.load_modules +-- code for binding: ddom.services.keymaps.applyKeymaps return M From 4a3978efeb7fff355ed50576312fcae8967f73c5 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Wed, 7 Dec 2022 13:16:01 +0700 Subject: [PATCH 18/70] Add custom config --- config.lua | 73 ++++++++++++++++++++++++++++++----------------------- modules.lua | 10 +++++--- 2 files changed, 48 insertions(+), 35 deletions(-) diff --git a/config.lua b/config.lua index 4726f75f..25615c5e 100644 --- a/config.lua +++ b/config.lua @@ -114,41 +114,44 @@ end -- -- some un categorized plugin here -- -- TODO: Will move them into a module -- --- -- doom.use_package({ --- -- "WhoIsSethDaniel/toggle-lsp-diagnostics.nvim", --- -- config = function() --- -- require'toggle_lsp_diagnostics'.init() --- -- }) --- -- end --- --- --- -- Packer --- + doom.use_package({ - "folke/noice.nvim", + "WhoIsSethDaniel/toggle-lsp-diagnostics.nvim", config = function() - require("noice").setup({ - - notify = { enabled = true, view = "notify" }, - messages = { enabled = true, view = "mini", view_error = "notify", view_warn = "notify" }, - -- messages = {enabled = true, view = "mini"}, - lsp = { - -- progress = {enabled = false}, - hover = { enabled = false }, - signature = { enabled = false }, - }, - }) + require("toggle_lsp_diagnostics").init() end, - requires = { - -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries - "MunifTanjim/nui.nvim", - -- OPTIONAL: - -- `nvim-notify` is only needed, if you want to use the notification view. - -- If not available, we use `mini` as the fallback - "rcarriga/nvim-notify", - }, }) -- +-- +-- -- Packer +-- +------------------------------------------------------ +-- doom.use_package({ +-- "folke/noice.nvim", +-- config = function() +-- require("noice").setup({ +-- +-- notify = { enabled = true, view = "notify" }, +-- messages = { enabled = true, view = "mini", view_error = "notify", view_warn = "notify" }, +-- -- messages = {enabled = true, view = "mini"}, +-- lsp = { +-- -- progress = {enabled = false}, +-- hover = { enabled = false }, +-- signature = { enabled = false }, +-- }, +-- }) +-- end, +-- requires = { +-- -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries +-- "MunifTanjim/nui.nvim", +-- -- OPTIONAL: +-- -- `nvim-notify` is only needed, if you want to use the notification view. +-- -- If not available, we use `mini` as the fallback +-- "rcarriga/nvim-notify", +-- }, +-- }) +------------------------------------------------------ +-- -- doom.use_package { -- 'iamcco/markdown-preview.nvim', -- run = function() vim.fn['mkdp#util#install']() end, -- if it is not work, sometime you need to manual run this command to instal dependency @@ -161,7 +164,15 @@ doom.use_package({ -- doom.use_package {"rafcamlet/nvim-luapad"} -- doom.use_package 'anuvyklack/hydra.nvim' -- -- fold setting --- local opt = vim.opt +local opt = vim.opt +opt.list = true +opt.listchars:append("eol:↴") + +-- tab options +opt.tabstop = 2 +opt.shiftwidth = 4 +opt.expandtab = true +-- -- opt.foldmethod = "expr" -- opt.foldlevel = 1 -- opt.foldlevelstart = 1 diff --git a/modules.lua b/modules.lua index 46c51164..a73ea1d4 100644 --- a/modules.lua +++ b/modules.lua @@ -61,6 +61,8 @@ return { "git", "views", "fold", + "refactor", + -- -- "charcounter", -- custom module test }, @@ -77,8 +79,8 @@ return { -- -- -- "ruby", -- -- -- -- -- Web - -- "javascript", - -- "typescript", + "javascript", + "typescript", -- -- "css", -- -- -- "vue", -- -- -- "tailwindcss", @@ -94,8 +96,8 @@ return { -- -- -- "kotlin", -- -- -- "java", -- -- - -- "json", - -- "yaml", + "json", + "yaml", -- -- -- "toml", "markdown", -- -- -- "terraform", -- Terraform / hcl files support From 0c1fff677e32a6250b53ce71a0ab28f2381d4965 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Wed, 14 Dec 2022 14:28:29 +0700 Subject: [PATCH 19/70] fix(explorer): wrong call back for gitignore --- lua/doom/modules/features/explorer/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/modules/features/explorer/init.lua b/lua/doom/modules/features/explorer/init.lua index bd5fb5b9..17f6a443 100644 --- a/lua/doom/modules/features/explorer/init.lua +++ b/lua/doom/modules/features/explorer/init.lua @@ -140,7 +140,7 @@ explorer.configs["nvim-tree.lua"] = function() { key = "", cb = tree_cb("close_node") }, { key = "", cb = tree_cb("close_node") }, { key = "", cb = tree_cb("preview") }, - { key = "I", cb = tree_cb("toggle_ignored") }, + { key = "I", cb = tree_cb("toggle_git_ignored") }, { key = "H", cb = tree_cb("toggle_dotfiles") }, { key = "R", cb = tree_cb("refresh") }, { key = "a", cb = tree_cb("create") }, From 344d1c6099f1b6126b4aeab7ccff091618bbb0c0 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Tue, 20 Dec 2022 12:29:15 +0700 Subject: [PATCH 20/70] feat(buf): Add behavior and command to close buffer - Go to next buffer when close buffer instead of go to NvimTree - Some commands : BDOther, BDAll, BDthis... --- config.lua | 3 + lua/user/modules/features/views/init.lua | 72 +++++++++++++++++++++--- 2 files changed, 67 insertions(+), 8 deletions(-) diff --git a/config.lua b/config.lua index 25615c5e..c124fcc8 100644 --- a/config.lua +++ b/config.lua @@ -173,6 +173,9 @@ opt.tabstop = 2 opt.shiftwidth = 4 opt.expandtab = true -- +-- confirm when delete +opt.confirm = true +-- -- opt.foldmethod = "expr" -- opt.foldlevel = 1 -- opt.foldlevelstart = 1 diff --git a/lua/user/modules/features/views/init.lua b/lua/user/modules/features/views/init.lua index 21dfcbb1..cba62f26 100644 --- a/lua/user/modules/features/views/init.lua +++ b/lua/user/modules/features/views/init.lua @@ -6,18 +6,21 @@ M.packages = { ["zen-mode.nvim"] = { "folke/zen-mode.nvim", }, - ["vimade"] = { + ["vimade"] = { -- fade unfocused buffer "TaDaa/vimade", }, - ["nvim-treesitter-context"] = { + ["nvim-treesitter-context"] = { -- stick current context (class/function when scroll) "nvim-treesitter/nvim-treesitter-context", }, - ["vim-scratchpad"] = { + ["vim-scratchpad"] = { -- type "dsp in edit buffer" to edit misc "konfekt/vim-scratchpad", }, - -- ["quick-scope"] = { -- highlight char to go left/righ - -- "unblevable/quick-scope", - -- }, + ["quick-scope"] = { -- highlight char to go left/righ + "unblevable/quick-scope", + }, + ["close-buffers.nvim"] = { -- highlight char to go left/righ + "kazhala/close-buffers.nvim", + }, } M.configs = { @@ -28,6 +31,20 @@ M.configs = { }, }) end, + ["close-buffers.nvim"] = function() + require("close_buffers").setup({ + preserve_window_layout = { "this", "other", "all" }, + next_buffer_cmd = function(windows) + require("bufferline").cycle(1) + local bufnr = vim.api.nvim_get_current_buf() + + print ("windows is ", windows) + for _, window in ipairs(windows) do + vim.api.nvim_win_set_buf(window, bufnr) + end + end, + }) + end, } M.autocmds = {} @@ -35,9 +52,41 @@ M.autocmds = {} M.cmds = { -- command! BufferKillForce lua require('lvim.core.bufferline').buf_kill('bd', nil, true) { - "BufferKillForce", + "BDthis", + function() + vim.cmd("BDelete this") -- BDelete this + -- vim.cmd(".,$-bdelete") + -- require('close_buffers').delete({ type = 'other' }) + end, + }, + { + "BDthisForce", + function() + vim.cmd("BDelete! this") + -- vim.cmd(".,$-bdelete") + -- require('close_buffers').delete({ type = 'other' }) + end, + }, + { + "BDOther", function() - require("lvim.core.bufferline").buf_kill("bd", nil, true) + -- vim.cmd("%bdelete") + vim.cmd("BDelete other") + end, + }, + { + "BDAll", + function() + -- vim.cmd("%bdelete") + vim.cmd("BDelete all") + end, + }, + + { + "ToggleScratchPad", + function() + -- vim.cmd("%bdelete") + vim.cmd("echo 'type dsp in normal mode to toggle Scratpad'") end, }, } @@ -50,6 +99,13 @@ M.binds = { { "z", "ZenMode", name = "Zen mode" }, }, }, + { + "w", + -- name = "+views", + { -- Adds a new `whichkey` folder called `+info` + { "x", "BDthis", name = "Close" }, + }, + }, } return M From c9b18b9c0f665d3669e789f1b5a4ec7a1ea267e5 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Wed, 14 Dec 2022 14:28:29 +0700 Subject: [PATCH 21/70] fix(explorer): wrong call back for gitignore --- lua/doom/modules/features/explorer/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/modules/features/explorer/init.lua b/lua/doom/modules/features/explorer/init.lua index bd5fb5b9..17f6a443 100644 --- a/lua/doom/modules/features/explorer/init.lua +++ b/lua/doom/modules/features/explorer/init.lua @@ -140,7 +140,7 @@ explorer.configs["nvim-tree.lua"] = function() { key = "", cb = tree_cb("close_node") }, { key = "", cb = tree_cb("close_node") }, { key = "", cb = tree_cb("preview") }, - { key = "I", cb = tree_cb("toggle_ignored") }, + { key = "I", cb = tree_cb("toggle_git_ignored") }, { key = "H", cb = tree_cb("toggle_dotfiles") }, { key = "R", cb = tree_cb("refresh") }, { key = "a", cb = tree_cb("create") }, From c3a3f91ce7f772bc5b8d6a9f9eb837f61b15680c Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Wed, 1 Feb 2023 11:31:48 +0700 Subject: [PATCH 22/70] Change settings for user modules --- lua/user/modules/features/navigation/init.lua | 40 ++++++++++--- lua/user/modules/features/views/init.lua | 60 ++++++++++++++++--- 2 files changed, 82 insertions(+), 18 deletions(-) diff --git a/lua/user/modules/features/navigation/init.lua b/lua/user/modules/features/navigation/init.lua index 14086dd8..820f6c5f 100644 --- a/lua/user/modules/features/navigation/init.lua +++ b/lua/user/modules/features/navigation/init.lua @@ -5,15 +5,15 @@ M.settings = {} M.packages = { -- ["noice.nvim"] = { -- "folke/noice.nvim", - -- requires = "MunifTanjim/nui.nvim", + -- requires = {"MunifTanjim/nui.nvim"}, -- }, ["vim-sandwich"] = { "machakann/vim-sandwich", }, ["symbols-outline.nvim"] = { "simrat39/symbols-outline.nvim", }, - ["cutlass.nvim"] = { - "tuanbass/cutlass.nvim", }, + -- ["cutlass.nvim"] = { + -- "tuanbass/cutlass.nvim", }, ["textobj1"] = { "kana/vim-textobj-line", }, @@ -27,7 +27,7 @@ M.packages = { "kana/vim-textobj-user", }, ["hop.nvim"] = { - "phaazon/hop.nvim", -- jum to anywhere in screen + "phaazon/hop.nvim", -- jum to anywhere in screenvim-telescope/telescope.nvimc:Pn }, ["vim-matchup"] = { -- smart open/close match navigation "andymass/vim-matchup", @@ -38,6 +38,14 @@ M.packages = { ["better-escape.nvim"] = { -- penalty when repeat j/k for navigation "max397574/better-escape.nvim", }, + -- ["telescope-fzf-native.nvim"] = { -- penalty when repeat j/k for navigation + -- "nvim-telescope/telescope-fzf-native.nvim", + -- -- requires = {'nvim-telescope/telescope.nvim'}, + -- + -- cmd = 'Telescope', + -- after = "telescope.nvim", + -- -- opt = true, + -- }, } M.configs = { @@ -45,13 +53,20 @@ M.configs = { -- require("noice").setup() -- end, - ["cutlass.nvim"] = function() - -- vim.notify("Setting up cutlass plugin", "info") - require("cutlass").setup({ - cut_key = "m", - }) + -- ["cutlass.nvim"] = function() + -- -- vim.notify("Setting up cutlass plugin", "info") + -- require("cutlass").setup({ + -- cut_key = "m", + -- }) + -- end, + ["telescope-fzf-native.nvim"] = function() + print ('loading fzf for telescope') + + -- require('telescope').load_extension('fzf') end, ["better-escape.nvim"] = function() + + require("better_escape").setup({ mapping = {"jk", "jj", "kj", "kk"}, -- a table with mappings to use keys = "", -- keys used for escaping, if it is a function will use the result everytime @@ -110,6 +125,13 @@ M.cmds = {} M.binds = { + { + -- Hop char + "s", + [[HopChar1]], + name = "Go to anychar in the screen", + mode = "nv", + }, { -- Hop char "", diff --git a/lua/user/modules/features/views/init.lua b/lua/user/modules/features/views/init.lua index cba62f26..88deb8d0 100644 --- a/lua/user/modules/features/views/init.lua +++ b/lua/user/modules/features/views/init.lua @@ -6,10 +6,10 @@ M.packages = { ["zen-mode.nvim"] = { "folke/zen-mode.nvim", }, - ["vimade"] = { -- fade unfocused buffer + ["vimade"] = { -- fade unfocused buffer "TaDaa/vimade", }, - ["nvim-treesitter-context"] = { -- stick current context (class/function when scroll) + ["nvim-treesitter-context"] = { -- stick current context (class/function when scroll) "nvim-treesitter/nvim-treesitter-context", }, ["vim-scratchpad"] = { -- type "dsp in edit buffer" to edit misc @@ -38,7 +38,6 @@ M.configs = { require("bufferline").cycle(1) local bufnr = vim.api.nvim_get_current_buf() - print ("windows is ", windows) for _, window in ipairs(windows) do vim.api.nvim_win_set_buf(window, bufnr) end @@ -52,13 +51,22 @@ M.autocmds = {} M.cmds = { -- command! BufferKillForce lua require('lvim.core.bufferline').buf_kill('bd', nil, true) { - "BDthis", + "BD1this", function() vim.cmd("BDelete this") -- BDelete this -- vim.cmd(".,$-bdelete") -- require('close_buffers').delete({ type = 'other' }) end, }, + { + "BDReopen", + function() + vim.cmd("BDelete this") -- BDelete this + vim.cmd("edit #") -- reopen last file + -- vim.cmd(".,$-bdelete") + -- require('close_buffers').delete({ type = 'other' }) + end, + }, { "BDthisForce", function() @@ -68,17 +76,19 @@ M.cmds = { end, }, { - "BDOther", + "BD2Other", function() -- vim.cmd("%bdelete") - vim.cmd("BDelete other") + vim.cmd("BufferLineCloseLeft") + vim.cmd("BufferLineCloseRight") end, }, { - "BDAll", + "BD3All", function() -- vim.cmd("%bdelete") - vim.cmd("BDelete all") + vim.cmd("BD2Other") + vim.cmd("BD1this") end, }, @@ -97,15 +107,47 @@ M.binds = { name = "+views", { -- Adds a new `whichkey` folder called `+info` { "z", "ZenMode", name = "Zen mode" }, + { "s", "SymbolsOutline", name = "SymbolsOutline" }, + + { + 't', + { + { "z", "Trouble document_diagnostics", name = "Troule this buf" }, + { "a", "Trouble workspace_diagnostics", name = "Troule all " }, + }, + name = "+Trouble", + + }, }, }, { "w", -- name = "+views", { -- Adds a new `whichkey` folder called `+info` - { "x", "BDthis", name = "Close" }, + { "x", "BD1this", name = "Close" }, }, }, } +-- selective highlight group to fix the issue: when open a new buffer, cursorline in old buf are faded and difficult to read +vim.g.vimade = { + basegroups = { + -- "Folded", + -- "Search", + -- "SignColumn", + -- -- "LineNr", + -- -- "CursorLine", + -- -- "CursorLineNr", + -- "DiffAdd", + -- "DiffChange", + -- "DiffDelete", + -- "DiffText", + -- "FoldColumn", + -- "Whitespace", + -- "NonText", + -- "SpecialKey", + -- "Conceal", + -- "EndOfBuffer", + }, +} return M From b347a9427e7637881e06b9094296a33ec5cf7a70 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Wed, 1 Feb 2023 11:32:25 +0700 Subject: [PATCH 23/70] change formater for typescript to prettierd --- lua/doom/modules/langs/typescript/init.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lua/doom/modules/langs/typescript/init.lua b/lua/doom/modules/langs/typescript/init.lua index 591015d7..26fa3527 100644 --- a/lua/doom/modules/langs/typescript/init.lua +++ b/lua/doom/modules/langs/typescript/init.lua @@ -23,17 +23,23 @@ typescript.settings = { disable_formatting = false, --- Mason.nvim package to auto install the formatter from --- @type string + -- formatting_package = "prettierd", + -- formatting_package = "prettier", formatting_package = "eslint_d", + -- formatting_package = "eslint-lsp", --- String to access the null_ls diagnositcs provider --- @type string + -- formatting_provider = "builtins.formatting.eslint", formatting_provider = "builtins.formatting.eslint_d", + -- formatting_provider = "builtins.formatting.prettier", + -- formatting_provider = "builtins.formatting.prettierd", --- Function to configure null-ls formatter --- @type function|nil formatting_config = nil, --- Disables null-ls diagnostic sources --- @type boolean - disable_diagnostics = false, + disable_diagnostics = true, --- Mason.nvim package to auto install the diagnostics provider from --- @type string diagnostics_package = "eslint_d", From 88e204d8313d5aa4fae3df1d9173de4dcab65061 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Wed, 1 Feb 2023 11:38:57 +0700 Subject: [PATCH 24/70] change docs: update todo notes --- todo.norg | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/todo.norg b/todo.norg index 999ea918..8820bcd5 100644 --- a/todo.norg +++ b/todo.norg @@ -11,21 +11,26 @@ version: 0.0.15 * TODO: check why out put some line in open file (currently workaround by out put it into mini) -* C-k not work randomly -* integrate git-sign into git feature -* Error msg when save -* mark down lsp (remark) not work -* Markdown preview -* integrate octo plugin (edit github PR in nvim) -* Telescope find file (leader-f-f) work not correct -* binding C-g for Hop , not 'ghw' -* resize windows hydra -* -------- better folding (maybe use UFO insteadof default tree-sitter) -* Luasnip work independly (for golang) -* copilot -* sometime current line is undeadable because of grey color -* Virtual whichkey hint -* Neorg should auto load when open norg file -* close (leader-b-d) buffer should go to the next buffer in bufferline -* refactoring -* Neogit confirm winfows when commiting code not correct (nothing display, not close ) +* [ ]C-k not work randomly +* [x] integrate git-sign into git feature => done +* [x] Error msg when save => done +* [ ] mark down lsp (remark) not work +* [ ] Markdown preview +* [ ] integrate octo plugin (edit github PR in nvim) +* [ ] Telescope find file (leader-f-f) work not correct (actually ) +* [x] binding C-g for Hop , not 'ghw' +* [ ] resize windows hydra +* [x]-------- better folding (maybe use UFO insteadof default tree-sitter) +* [ ] Luasnip work independly (for golang) +* [ ] copilot +* [x] sometime current line is undeadable because of grey color = +* [ ] Virtual whichkey hint +* [ ] Neorg should auto load when open norg file +* [ ] close (leader-b-d) buffer should go to the next buffer in bufferline +* [ ] refactoring +* [ ] Neogit confirm winfows when commiting code not correct (nothing display, not close ) +* [ ] Incorrect indent with golang +* [ ] code format not work with golang -> not reducible animore +* [ ] code action input for Noice +* [ ] Space menu in visual mode +* [ ] evaluate and integrate vim wilder/improvedft extension From c102c61cdbf575879ab10629ebdaac55171e6aa5 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Wed, 1 Feb 2023 11:39:34 +0700 Subject: [PATCH 25/70] use fzf-native for fuzzy for telescope faster, support advance search syntax --- lua/doom/modules/features/telescope/init.lua | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lua/doom/modules/features/telescope/init.lua b/lua/doom/modules/features/telescope/init.lua index 8c529256..0804638a 100644 --- a/lua/doom/modules/features/telescope/init.lua +++ b/lua/doom/modules/features/telescope/init.lua @@ -50,16 +50,25 @@ telescope.packages = { ["telescope.nvim"] = { "nvim-telescope/telescope.nvim", commit = "f174a0367b4fc7cb17710d867e25ea792311c418", - cmd = "Telescope", - opt = true, + -- cmd = "Telescope", + opt = false, }, ["telescope-file-browser.nvim"] = { "nvim-telescope/telescope-file-browser.nvim", commit = "6b4e22777bfa6a31787a4ac8e086b062ef241ede", - cmd = "Telescope browse_files", + -- cmd = "Telescope browse_files", key = ".", after = "telescope.nvim", - opt = true, + opt = false, + }, + ["telescope-fzf-native.nvim"] = { + "nvim-telescope/telescope-fzf-native.nvim", + -- cmd = "Telescope ", + after = "telescope.nvim", + config = function () + require('telescope').load_extension('fzf') + end , + opt = false, }, } From 668f0c8ca687ef7afaf857c0496c016b6aaaa199 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Thu, 2 Feb 2023 11:37:39 +0700 Subject: [PATCH 26/70] Change formater and lsp for markdown --- lua/doom/modules/langs/markdown/init.lua | 66 +++++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/lua/doom/modules/langs/markdown/init.lua b/lua/doom/modules/langs/markdown/init.lua index a7c95afe..7a1573ef 100644 --- a/lua/doom/modules/langs/markdown/init.lua +++ b/lua/doom/modules/langs/markdown/init.lua @@ -13,7 +13,8 @@ markdown.settings = { disable_lsp = false, --- Name of the language server --- @type string - lsp_name = "remark_ls", + -- lsp_name = "remark_ls", + lsp_name = "marksman", --- Custom config to pass to nvim-lspconfig --- @type table|nil lsp_config = nil, @@ -30,6 +31,25 @@ markdown.settings = { --- Function to configure null-ls diagnostics --- @type function|nil diagnostics_config = nil, + + --- Disables null-ls formatting sources + --- @type boolean + disable_formatting = false, + --- Mason.nvim package to auto install the formatter from + --- @type string + formatting_package = "prettierd", + -- formatting_package = "prettier", + -- formatting_package = "eslint_d", + -- formatting_package = "eslint-lsp", + --- String to access the null_ls diagnositcs provider + --- @type string + -- formatting_provider = "builtins.formatting.eslint", + -- formatting_provider = "builtins.formatting.eslint_d", + -- formatting_provider = "builtins.formatting.prettier", + formatting_provider = "builtins.formatting.prettierd", + --- Function to configure null-ls formatter + --- @type function|nil + formatting_config = nil, } local langs_utils = require("doom.modules.langs.utils") @@ -55,9 +75,53 @@ markdown.autocmds = { markdown.settings.diagnostics_config ) end + + if not markdown.settings.disable_formatting then + langs_utils.use_null_ls( + markdown.settings.formatting_package, + markdown.settings.formatting_provider, + markdown.settings.formatting_config + ) + end end), once = true, }, } +markdown.packages = { + ["markdown-preview.nvim"] = { + "iamcco/markdown-preview.nvim", + }, + ["clipboard-image.nvim"] = { + "ekickx/clipboard-image.nvim", + }, +} + + +markdown.configs = { + ["markdown-preview.nvim"] = function() + vim.fn['mkdp#util#install']() + end, + ["clipboard-image.nvim"] = function() + require'clipboard-image'.setup { + default = { + img_name = function () -- ask for the image name + vim.fn.inputsave() + local name = vim.fn.input('Img Name: ') + vim.fn.inputrestore() + + if name == nil or name == '' then + return os.date('%y-%m-%d-%H-%M-%S') + end + return name + end, + img_dir = {"%:p:h", "img"} -- the directory to save the image which is relative to the current file + } + } + + end, + +} + + return markdown From 4ab841d517cde0ffecab406001c1c853b09af2cd Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Thu, 2 Feb 2023 11:38:19 +0700 Subject: [PATCH 27/70] fix: remove print command --- lua/user/modules/features/refactor/init.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/user/modules/features/refactor/init.lua b/lua/user/modules/features/refactor/init.lua index 42f83cbc..06b04006 100644 --- a/lua/user/modules/features/refactor/init.lua +++ b/lua/user/modules/features/refactor/init.lua @@ -19,7 +19,6 @@ M.configs = { local has_telescope = pcall(require, "telescope") if (has_telescope) then -- TODO: integrate with telescope. Dont know why cannot load telescope here local res = require("telescope").load_extension("refactoring") - print (" load extension:", res) end end, From 363e17aef3117846da37f3f9f1c77c2d2e13edbe Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Thu, 2 Feb 2023 11:39:21 +0700 Subject: [PATCH 28/70] fix: typescript formatter --- lua/doom/modules/langs/typescript/init.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/doom/modules/langs/typescript/init.lua b/lua/doom/modules/langs/typescript/init.lua index 26fa3527..6719871f 100644 --- a/lua/doom/modules/langs/typescript/init.lua +++ b/lua/doom/modules/langs/typescript/init.lua @@ -23,16 +23,16 @@ typescript.settings = { disable_formatting = false, --- Mason.nvim package to auto install the formatter from --- @type string - -- formatting_package = "prettierd", + formatting_package = "prettierd", -- formatting_package = "prettier", - formatting_package = "eslint_d", + -- formatting_package = "eslint_d", -- formatting_package = "eslint-lsp", --- String to access the null_ls diagnositcs provider --- @type string -- formatting_provider = "builtins.formatting.eslint", - formatting_provider = "builtins.formatting.eslint_d", + -- formatting_provider = "builtins.formatting.eslint_d", -- formatting_provider = "builtins.formatting.prettier", - -- formatting_provider = "builtins.formatting.prettierd", + formatting_provider = "builtins.formatting.prettierd", --- Function to configure null-ls formatter --- @type function|nil formatting_config = nil, From 67430f639651fa83db79e1167c8f7396ec4d3647 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Thu, 2 Feb 2023 11:39:58 +0700 Subject: [PATCH 29/70] add scratch module --- lua/user/modules/features/scratch/init.lua | 49 ++++++++++++++++++++++ modules.lua | 2 +- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 lua/user/modules/features/scratch/init.lua diff --git a/lua/user/modules/features/scratch/init.lua b/lua/user/modules/features/scratch/init.lua new file mode 100644 index 00000000..167d04f6 --- /dev/null +++ b/lua/user/modules/features/scratch/init.lua @@ -0,0 +1,49 @@ +local M = {} + +M.settings = {} + +M.packages = { + ["attempt.nvim"] = { + "m-demare/attempt.nvim", + requires = "nvim-lua/plenary.nvim", + }, + -- ["vimade"] = { + -- "TaDaa/vimade", + -- }, +} + +M.configs = { + ["attempt.nvim"] = function() + require("attempt").setup({ + dir = vim.fn.stdpath("data") .. "/attempt.nvim/", + }) + local telescope = require("telescope") + telescope.load_extension("attempt") + end, +} + +-- M.autocmds = {} +-- +-- M.cmds = {} +-- M.requires_modules = { "features.auto_install" } + +M.binds = +{ + { + "S", + name = "+Scratch pad", + { + { "n", function() require ("attempt").new_select() end, name = "New..." }, + { "N", function() require ("attempt").new_input_ext() end, name = "New(input)..." }, + { "!", function() require ("attempt").run() end, name = "Run..." }, + { "d", function() require ("attempt").delete_buf() end, name = "Delete..." }, + { "r", function() require ("attempt").rename_buf() end, name = "Rename..." }, + { "l", " Telescope attempt ", name = "List..." }, + } + }, +} + +-- Notes: +-- code for load module located at doom.core.module.load_modules +-- code for binding: ddom.services.keymaps.applyKeymaps +return M diff --git a/modules.lua b/modules.lua index a73ea1d4..89f1f728 100644 --- a/modules.lua +++ b/modules.lua @@ -62,7 +62,7 @@ return { "views", "fold", "refactor", - + "scratch" -- -- "charcounter", -- custom module test }, From c12aa0a32f2a9a0230abebc563a39a9d35f5bad5 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Thu, 2 Feb 2023 16:08:41 +0700 Subject: [PATCH 30/70] Add configuration for completion on searc and cmdline --- lua/doom/modules/features/lsp/init.lua | 47 ++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 7 deletions(-) diff --git a/lua/doom/modules/features/lsp/init.lua b/lua/doom/modules/features/lsp/init.lua index e2a27771..2a1d5fea 100644 --- a/lua/doom/modules/features/lsp/init.lua +++ b/lua/doom/modules/features/lsp/init.lua @@ -142,6 +142,11 @@ lsp.packages = { commit = "e65a63858771db3f086c8d904ff5f80705fd962b", after = "nvim-lspconfig", }, + ["cmp-cmdline"] = { + "hrsh7th/cmp-cmdline", + commit = "23c51b2a3c00f6abc4e922dbd7c3b9aca6992063", + after = "nvim-cmp", + }, } lsp.configs = {} @@ -211,13 +216,13 @@ lsp.configs["nvim-cmp"] = function() local replace_termcodes = utils.replace_termcodes - local source_map = { - nvim_lsp = "[LSP]", - luasnip = "[Snp]", - buffer = "[Buf]", - nvim_lua = "[Lua]", - path = "[Path]", - } + -- local source_map = { + -- nvim_lsp = "[LSP]", + -- luasnip = "[Snp]", + -- buffer = "[Buf]", + -- nvim_lua = "[Lua]", + -- path = "[Path]", + -- } --- Helper function to check what behaviour to use --- @return boolean @@ -298,6 +303,34 @@ lsp.configs["nvim-cmp"] = function() end, })) end +lsp.configs["cmp-cmdline"] = function() + local cmp = require("cmp") + + -- autocomplete for search + cmp.setup.cmdline('/', { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = 'buffer' } + } + }) + + -- autocomplete for search + cmp.setup.cmdline(':', { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = 'path' } + }, + { + { + name = 'cmdline', + option = { + ignore_cmds = { 'Man', '!' } + } + } + }) + }) + +end lsp.configs["lsp_signature.nvim"] = function() -- Signature help require("lsp_signature").setup( From 990a818528869ad0dc2288c0f1ca809fb5c9f785 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Thu, 2 Feb 2023 16:08:41 +0700 Subject: [PATCH 31/70] Add configuration for completion on searc and cmdline --- lua/doom/modules/features/lsp/init.lua | 33 ++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/lua/doom/modules/features/lsp/init.lua b/lua/doom/modules/features/lsp/init.lua index 112f2b5a..1ffc9db5 100644 --- a/lua/doom/modules/features/lsp/init.lua +++ b/lua/doom/modules/features/lsp/init.lua @@ -158,6 +158,11 @@ lsp.packages = { }, event = "VeryLazy", }, + ["cmp-cmdline"] = { + "hrsh7th/cmp-cmdline", + commit = "23c51b2a3c00f6abc4e922dbd7c3b9aca6992063", + after = "nvim-cmp", + }, } lsp.configs = {} @@ -306,6 +311,34 @@ lsp.configs["nvim-cmp"] = function() end, })) end +lsp.configs["cmp-cmdline"] = function() + local cmp = require("cmp") + + -- autocomplete for search + cmp.setup.cmdline('/', { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = 'buffer' } + } + }) + + -- autocomplete for search + cmp.setup.cmdline(':', { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = 'path' } + }, + { + { + name = 'cmdline', + option = { + ignore_cmds = { 'Man', '!' } + } + } + }) + }) + +end lsp.configs["lsp_signature.nvim"] = function() -- Signature help require("lsp_signature").setup( From b3f95239e517aa373f991ec32d48cc2fb75969bf Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Fri, 3 Feb 2023 13:54:22 +0700 Subject: [PATCH 32/70] update status of Daniel plugin --- Daniel_plugin.txt | 188 +++++++++++++++++++++++----------------------- 1 file changed, 94 insertions(+), 94 deletions(-) diff --git a/Daniel_plugin.txt b/Daniel_plugin.txt index 7c49b493..6a0e426f 100644 --- a/Daniel_plugin.txt +++ b/Daniel_plugin.txt @@ -1,107 +1,107 @@ - • FixCursorHold.nvim - • LuaSnip • aurora (not loaded) - • barbar.nvim - • better-escape.nvim (not loaded) - • cmp-buffer - • cmp-cmdline - • cmp-nvim-lsp - • cmp-nvim-lsp-signature-help - • cmp-path - • cmp-spell - • cmp_luasnip - • codi.vim -- Python scratch pad - • commented.nvim (not loaded) - • copilot-cmp (not loaded) - • copilot.vim + -- • FixCursorHold.nvim (nvim fixed bug) + -- • LuaSnip • aurora (not loaded) + -- • barbar.nvim tabline + ++ • better-escape.nvim (not loaded) + ++ • cmp-buffer + ++ • cmp-cmdline + ++ • cmp-nvim-lsp + ++ • cmp-nvim-lsp-signature-help + ++ • cmp-path + -- • cmp-spell + ++ • cmp_luasnip + -- • codi.vim -- Python scratch pad + ++ • commented.nvim (not loaded) + ***• copilot-cmp (not loaded) + ***• copilot.vim • crates.nvim (not loaded) - • dap-buddy.nvim - • dashboard-nvim - • filetype.nvim - • friendly-snippets - • git-conflict.nvim - • github-ci.nvim (not loaded)-- plugin by daniel, not complete. require "hub" + ***• dap-buddy.nvim + •++ dashboard-nvim + ---• filetype.nvim + ++• friendly-snippets + ++• git-conflict.nvim + ***• github-ci.nvim (not loaded)-- plugin by daniel, not complete. require "hub" • gitlinker.nvim (not loaded) -- share code as a gist - • gitsigns.nvim - • gruvqueen (not loaded) -- theme + ++• gitsigns.nvim + ---• gruvqueen (not loaded) -- theme • hlargs.nvim -- Highlight arguments' definitions and usages, asynchronously, using Treesitter - • impatient.nvim - • indent-blankline.nvim -- indent sign (|) - • iswap.nvim -- swap order of func param - • lazygit.nvim (not loaded) - • lightspeed.nvim -- like HOP plugin - • lsp-colors.nvim - • lsp-status.nvim - • lspkind-nvim (them Icon cho LSP suggestion) + ++• impatient.nvim (enhance performance loading lua module ) + ++• indent-blankline.nvim -- indent sign (|) + ***• iswap.nvim -- swap order of func param + +++• lazygit.nvim (not loaded) + +++• lightspeed.nvim -- like HOP plugin + +++• lsp-colors.nvim + ---• lsp-status.nvim + ---• lspkind-nvim (them Icon cho LSP suggestion) • lua-dev.nvim (manually loaded) - • markdown-preview.nvim - • material.nvim - • mkdir.nvim + +++• markdown-preview.nvim + ---• material.nvim theme + ---• mkdir.nvim • neogen (not loaded) - • neogit - • neomake (not loaded) - • neotest - • noice.nvim - • nui.nvim - • nvim-autopairs -- Auto generate close bracket when type open brackt - • nvim-bqf (not loaded) -- better quick fix - • nvim-cmp - • nvim-colorizer.lua - • nvim-coverage - • nvim-dap (not loaded) - • nvim-dap-python (not loaded) - • nvim-dap-ui (not loaded) - • nvim-gps - • nvim-jdtls (not loaded) - • nvim-lspconfig - • nvim-navic - • nvim-notify - • nvim-tree.lua (not loaded) - • nvim-treesitter - • nvim-treesitter-textobjects - • nvim-treesitter-textsubjects - • nvim-ts-autotag -- Use treesitter to autoclose and autorename html tag - • nvim-ts-context-commentstring - • nvim-ufo - • nvim-web-devicons - • nvim-yati -- Indent plugin with treesitter - • nvimux (not loaded) - • one-small-step-for-vimkind + +++• neogit + ---• neomake (not loaded) + ***• neotest + ***• noice.nvim + ***• nui.nvim + +++• nvim-autopairs -- Auto generate close bracket when type open brackt + ---• nvim-bqf (not loaded) -- better quick fix + +++• nvim-cmp + ---• nvim-colorizer.lua Highlight color code (#AABBCC) by exactly color + ***• nvim-coverage + ***• nvim-dap (not loaded) + ***• nvim-dap-python (not loaded) + ***• nvim-dap-ui (not loaded) + ---• nvim-gps (deprecated, use nvim-navic). Show breadccum for code context. + • nvim-jdtls (not loaded) -- lsp adapter for eclipse jdt + ***• nvim-lspconfig + ---• nvim-navic + ***• nvim-notify + +++• nvim-tree.lua (not loaded) + +++• nvim-treesitter + ***• nvim-treesitter-textobjects allow define moving object (like iw, if..). similar to vim-textobj-xxx + ***• nvim-treesitter-textsubjects similar tor expand-region (maybe smarter) + +++• nvim-ts-autotag -- Use treesitter to autoclose and autorename html tag + +++• nvim-ts-context-commentstring determine commentstring symbol (//, --...) by the context + +++ • nvim-ufo -- folding + +++ • nvim-web-devicons default icon for filetype(in tree for example) +-- • nvim-yati -- Indent plugin with treesitter deprecated + --- • nvimux (not loaded) tmux with nvim + -- • one-small-step-for-vimkind DAP adapter for neovim lua • orgmode.nvim (not loaded) - • package-info.nvim (not loaded) - • packer.nvim (manually loaded) - • playground (not loaded) - • plenary.nvim - • presence.nvim -- Discord Rich Presence plugin for Neovim - • preview-swagger.nvim (not loaded) -- Preview swager in real time - • promise-async - • refactoring.nvim - • rust.vim (not loaded) - • sniprun (not loaded) - • sonokai (not loaded) -- theme + *** • package-info.nvim (not loaded) check and version manager for package.json (js, ts) + +++ • packer.nvim (manually loaded) + ---• playground (not loaded) show Treesitter infomation in nvim + +++ • plenary.nvim async call + ---• presence.nvim -- Discord Rich Presence plugin for Neovim + --- • preview-swagger.nvim (not loaded) -- Preview swager in real time + --- • promise-async support Promise/async in lua + +++• refactoring.nvim (refactoring pattern) + --- • rust.vim (not loaded) syntax Highlight, syntax check, format for rust. (Think: should use lsp instead) + ***• sniprun (not loaded) run code for lua, rust. Support different type of output (virtual text, floating win, notification, term...) + -- • sonokai (not loaded) -- theme • spellsitter.nvim - • stabilize.nvim -- Neovim plugin to stabilize buffer content on window open/close events. + -- • stabilize.nvim -- Neovim plugin to stabilize buffer content on window open/close events. • suda.vim (not loaded) - • surround.nvim + -- • surround.nvim • tabout.nvim - • telescope-file-browser.nvim - • telescope-fzf-native.nvim + ++ • telescope-file-browser.nvim + ++ • telescope-fzf-native.nvim • telescope-project.nvim • telescope-ui-select.nvim • telescope.nvim - • todo-comments.nvim (not loaded) - • tokyonight.nvim (not loaded) - • trouble.nvim (not loaded) - • urlview.nvim - • vgit.nvim -- like neogit. TODO: try to check - • vim-dispatch (not loaded) - • vim-fugitive (not loaded) - • vim-grammarous (not loaded) - • vim-matchup - • vim-slash (not loaded) -- improve search in nvim (press '/') - • vim-test (not loaded) - • vimwiki (not loaded) - • vscode.nvim (not loaded) - • which-key.nvim - • windline.nvim - • window-picker.nvim + +++ • todo-comments.nvim (not loaded) + --- • tokyonight.nvim (not loaded) theme + +++ • trouble.nvim (not loaded) + ---• urlview.nvim (list of all url in buffer like telescope) + *** • vgit.nvim -- like neogit. TODO: try to check + *** • vim-dispatch (not loaded) async for make and test + --- • vim-fugitive (not loaded) git manipulate (like neogit) + --- • vim-grammarous (not loaded) Grammar check on demand (depend on LanguageTool) + +++ • vim-matchup advance match open/close pair (bracket, function, treesitter...) + --- • vim-slash (not loaded) -- improve search in nvim (press '/') (auto clear Highlight, starsearch) + ***• vim-test (not loaded) + ---• vimwiki (not loaded) organize (like orgmode) in wiki format + ---• vscode.nvim (not loaded) Vscoe theme + +++• which-key.nvim + ---• windline.nvim (look/feel of statusline) + ***• window-picker.nvim quick navigate, swap and close window by shortcut From 3be7135aabf84909fd9bc45c9753765aa16f2565 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Fri, 3 Feb 2023 14:19:22 +0700 Subject: [PATCH 33/70] Add telescope ui select So native nvim action(select... can use telescope ) --- lua/doom/modules/features/telescope/init.lua | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lua/doom/modules/features/telescope/init.lua b/lua/doom/modules/features/telescope/init.lua index 0804638a..b1049190 100644 --- a/lua/doom/modules/features/telescope/init.lua +++ b/lua/doom/modules/features/telescope/init.lua @@ -43,7 +43,11 @@ telescope.settings = { use_less = true, set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil, }, - extensions = { "mapper" }, + extensions = { "mapper", + ["ui-select"] = { + -- require("telescope.themes").get_dropdown { } + }, + } } telescope.packages = { @@ -70,6 +74,16 @@ telescope.packages = { end , opt = false, }, + ["telescope-ui-select.nvim"] = { + "nvim-telescope/telescope-ui-select.nvim", + -- cmd = "Telescope ", + after = "telescope.nvim", + config = function () + require('telescope').load_extension('ui-select') + end , + opt = false, + }, + } telescope.configs = {} From 69e212d4b17776fbc206b7a674a386f07bc00c06 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Fri, 3 Feb 2023 14:29:16 +0700 Subject: [PATCH 34/70] change modules config: - add annotation modules (used for generate function comment with neogen) - disable autoreload DoomNvim when changing config files --- config.lua | 2 +- modules.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config.lua b/config.lua index c124fcc8..ec3b6a62 100644 --- a/config.lua +++ b/config.lua @@ -39,7 +39,7 @@ -- doom.indent = 2 -- doom.core.treesitter.settings.show_compiler_warning_message = false --- doom.core.reloader.settings.reload_on_save = false +doom.core.reloader.settings.reload_on_save = false -- if doom.langs.lua ~= nil then doom.langs.lua.settings.disable_lsp = true diff --git a/modules.lua b/modules.lua index 89f1f728..743244fd 100644 --- a/modules.lua +++ b/modules.lua @@ -9,7 +9,7 @@ return { features = { -- -- Language features --- "annotations", -- Code annotation generator + "annotations", -- Code annotation generator "auto_install", -- Auto install LSP providers "autopairs", -- Automatically close character pairs "comment", -- Adds keybinds to comment in any language From b36e8868e24d204ec2f85514ca31b28c9ac62861 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Fri, 3 Feb 2023 15:44:50 +0700 Subject: [PATCH 35/70] fix: Telescope projects not work (randomly) --- lua/doom/modules/features/projects/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/doom/modules/features/projects/init.lua b/lua/doom/modules/features/projects/init.lua index 21181ccf..ca9576c6 100644 --- a/lua/doom/modules/features/projects/init.lua +++ b/lua/doom/modules/features/projects/init.lua @@ -48,8 +48,8 @@ projects.requires_modules = { "features.telescope" } projects.configs = {} projects.configs["project.nvim"] = function() require("project_nvim").setup(doom.features.projects.settings) - - table.insert(doom.features.telescope.settings.extensions, "projects") + require('telescope').load_extension('projects') + -- table.insert(doom.features.telescope.settings.extensions, "projects") end projects.binds = { From 05080e7afad7a7664044ed5d68d00e9b57ffde63 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Fri, 3 Feb 2023 15:45:40 +0700 Subject: [PATCH 36/70] feat: enable projects --- modules.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules.lua b/modules.lua index 743244fd..6b42daf8 100644 --- a/modules.lua +++ b/modules.lua @@ -51,7 +51,7 @@ return { -- -- "lazygit", -- Lazy git integration -- "neogit", -- A git client for neovim -- "neorg", -- Organise your life --- "projects", -- Quickly switch between projects + "projects", -- Quickly switch between projects -- -- "superman", -- Read unix man pages in neovim -- -- "suda", -- Save using sudo when necessary "telescope", -- Fuzzy searcher to find files, grep code and more From 244e5c32afaaeda5e0ecc3008a7cca114539573e Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Tue, 7 Feb 2023 09:45:29 +0700 Subject: [PATCH 37/70] Update status daniel --- Daniel_plugin.txt | 83 +++++++++++++++++++++++++---------------------- 1 file changed, 44 insertions(+), 39 deletions(-) diff --git a/Daniel_plugin.txt b/Daniel_plugin.txt index 6a0e426f..9d60fc6d 100644 --- a/Daniel_plugin.txt +++ b/Daniel_plugin.txt @@ -1,43 +1,47 @@ +Notation: ++++: Already install +---: Not interest, will not install +***: Interest, but not install yet -- • FixCursorHold.nvim (nvim fixed bug) -- • LuaSnip • aurora (not loaded) -- • barbar.nvim tabline - ++ • better-escape.nvim (not loaded) - ++ • cmp-buffer - ++ • cmp-cmdline - ++ • cmp-nvim-lsp - ++ • cmp-nvim-lsp-signature-help - ++ • cmp-path - -- • cmp-spell - ++ • cmp_luasnip + • better-escape.nvim (not loaded) + +++• cmp-buffer + +++• cmp-cmdline + +++• cmp-nvim-lsp + ---• cmp-nvim-lsp-signature-help: function signature for lsp. already have with lsp_signature.nvim + +++• cmp-path + --- • cmp-spell: spell check + +++• cmp_luasnip -- • codi.vim -- Python scratch pad - ++ • commented.nvim (not loaded) + +++• commented.nvim (not loaded) ***• copilot-cmp (not loaded) ***• copilot.vim - • crates.nvim (not loaded) + ---• crates.nvim (not loaded): Package managemment for rust. Similar to package-info for javascript ***• dap-buddy.nvim - •++ dashboard-nvim + •+++dashboard-nvim ---• filetype.nvim - ++• friendly-snippets - ++• git-conflict.nvim + +++• friendly-snippets + ***• git-conflict.nvim ***• github-ci.nvim (not loaded)-- plugin by daniel, not complete. require "hub" - • gitlinker.nvim (not loaded) -- share code as a gist - ++• gitsigns.nvim + ***• gitlinker.nvim (not loaded) -- Generate code link + +++• gitsigns.nvim ---• gruvqueen (not loaded) -- theme - • hlargs.nvim -- Highlight arguments' definitions and usages, asynchronously, using Treesitter - ++• impatient.nvim (enhance performance loading lua module ) - ++• indent-blankline.nvim -- indent sign (|) + ***• hlargs.nvim -- Highlight arguments' definitions and usages, asynchronously, using Treesitter, already have ability from unknown source + +++• impatient.nvim (enhance performance loading lua module ) + +++• indent-blankline.nvim -- indent sign (|) ***• iswap.nvim -- swap order of func param +++• lazygit.nvim (not loaded) +++• lightspeed.nvim -- like HOP plugin +++• lsp-colors.nvim ---• lsp-status.nvim ---• lspkind-nvim (them Icon cho LSP suggestion) - • lua-dev.nvim (manually loaded) + ---• lua-dev.nvim (manually loaded) : Now : neodev: Support dev in lua (signature, completion, docs). Use LSP instead +++• markdown-preview.nvim ---• material.nvim theme ---• mkdir.nvim - • neogen (not loaded) + +++• neogen (not loaded) Function doc/comment +++• neogit ---• neomake (not loaded) ***• neotest @@ -52,7 +56,7 @@ ***• nvim-dap-python (not loaded) ***• nvim-dap-ui (not loaded) ---• nvim-gps (deprecated, use nvim-navic). Show breadccum for code context. - • nvim-jdtls (not loaded) -- lsp adapter for eclipse jdt + ---• nvim-jdtls (not loaded) -- lsp adapter for eclipse jdt ***• nvim-lspconfig ---• nvim-navic ***• nvim-notify @@ -62,16 +66,16 @@ ***• nvim-treesitter-textsubjects similar tor expand-region (maybe smarter) +++• nvim-ts-autotag -- Use treesitter to autoclose and autorename html tag +++• nvim-ts-context-commentstring determine commentstring symbol (//, --...) by the context - +++ • nvim-ufo -- folding - +++ • nvim-web-devicons default icon for filetype(in tree for example) --- • nvim-yati -- Indent plugin with treesitter deprecated + +++• nvim-ufo -- folding + +++• nvim-web-devicons default icon for filetype(in tree for example) + --- • nvim-yati -- Indent plugin with treesitter deprecated --- • nvimux (not loaded) tmux with nvim - -- • one-small-step-for-vimkind DAP adapter for neovim lua - • orgmode.nvim (not loaded) + --- • one-small-step-for-vimkind DAP adapter for neovim lua + ***• orgmode.nvim (not loaded) *** • package-info.nvim (not loaded) check and version manager for package.json (js, ts) - +++ • packer.nvim (manually loaded) + +++• packer.nvim (manually loaded) ---• playground (not loaded) show Treesitter infomation in nvim - +++ • plenary.nvim async call + +++• plenary.nvim async call ---• presence.nvim -- Discord Rich Presence plugin for Neovim --- • preview-swagger.nvim (not loaded) -- Preview swager in real time --- • promise-async support Promise/async in lua @@ -79,25 +83,25 @@ --- • rust.vim (not loaded) syntax Highlight, syntax check, format for rust. (Think: should use lsp instead) ***• sniprun (not loaded) run code for lua, rust. Support different type of output (virtual text, floating win, notification, term...) -- • sonokai (not loaded) -- theme - • spellsitter.nvim + ---• spellsitter.nvim: Already merged into neovim core -- • stabilize.nvim -- Neovim plugin to stabilize buffer content on window open/close events. - • suda.vim (not loaded) + ---• suda.vim (not loaded): No need, as with "w!", neovim auto chown for the file -- • surround.nvim - • tabout.nvim - ++ • telescope-file-browser.nvim - ++ • telescope-fzf-native.nvim - • telescope-project.nvim - • telescope-ui-select.nvim - • telescope.nvim - +++ • todo-comments.nvim (not loaded) + ***• tabout.nvim smart jump between parenthese, quotes ... by press Tab + +++• telescope-file-browser.nvim + +++• telescope-fzf-native.nvim + +++• telescope-project.nvim Project manipulate + +++• telescope-ui-select.nvim + +++• telescope.nvim + +++• todo-comments.nvim (not loaded) --- • tokyonight.nvim (not loaded) theme - +++ • trouble.nvim (not loaded) + +++• trouble.nvim (not loaded) ---• urlview.nvim (list of all url in buffer like telescope) *** • vgit.nvim -- like neogit. TODO: try to check *** • vim-dispatch (not loaded) async for make and test --- • vim-fugitive (not loaded) git manipulate (like neogit) --- • vim-grammarous (not loaded) Grammar check on demand (depend on LanguageTool) - +++ • vim-matchup advance match open/close pair (bracket, function, treesitter...) + +++• vim-matchup advance match open/close pair (bracket, function, treesitter...) --- • vim-slash (not loaded) -- improve search in nvim (press '/') (auto clear Highlight, starsearch) ***• vim-test (not loaded) ---• vimwiki (not loaded) organize (like orgmode) in wiki format @@ -105,3 +109,4 @@ +++• which-key.nvim ---• windline.nvim (look/feel of statusline) ***• window-picker.nvim quick navigate, swap and close window by shortcut + *** dense-analysis/ale From 685b86c85a4338aaff426430d32f1b7f5541c5e0 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Tue, 7 Feb 2023 09:59:00 +0700 Subject: [PATCH 38/70] enable autosession --- modules.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules.lua b/modules.lua index 6b42daf8..25237670 100644 --- a/modules.lua +++ b/modules.lua @@ -21,7 +21,7 @@ return { -- -- -- -- Editor -- --- "auto_session", -- Remember sessions between loads + "auto_session", -- Remember sessions between loads -- "colorizer", -- Show colors in neovim "editorconfig", -- Support editorconfig files -- -- "gitsigns", -- Show git changes in sidebar From cc4657dd212a1184b92ca1e788e6c357dfb3a09f Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Tue, 7 Feb 2023 09:52:28 +0700 Subject: [PATCH 39/70] initialize entertainment feature - add spotify Add spotify plugin --- .../modules/features/entertainments/init.lua | 56 +++++++++++++++++++ modules.lua | 3 +- 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 lua/user/modules/features/entertainments/init.lua diff --git a/lua/user/modules/features/entertainments/init.lua b/lua/user/modules/features/entertainments/init.lua new file mode 100644 index 00000000..454ba56b --- /dev/null +++ b/lua/user/modules/features/entertainments/init.lua @@ -0,0 +1,56 @@ +-- Module to put some entertainment facilitate +-- - Spotify control +-- evaluated: +-- - KadoBOT/nvim-spotify(require spotify-tui) => not satisfy +-- - "stsewd/spotify.nvim" requires wmctl and pydbus, + +-- +local M = {} + +M.settings = {} + +M.packages = { + ["spotify"] = { + "stsewd/spotify.nvim", + }, +} + +M.configs = { + -- ["nvim-spotifi"] = function() + -- local spotify = require("nvim-spotify") + -- + -- spotify.setup({ + -- -- default opts + -- status = { + -- update_interval = 10000, -- the interval (ms) to check for what's currently playing + -- format = "%s %t by %a", -- spotify-tui --format argument + -- }, + -- }) + -- end, +} + +M.autocmds = {} + +M.cmds = {} +-- M.requires_modules = { "features.auto_install" } +M.binds = +{ + { + "E", + name = "Entertainment", + mode = "nv", + { + {'n' , ":Spotify next", "SpotNext" }, + {'p' , ":Spotify prev", "SpotPrev" }, + {'s' , ":Spotify play/pause", "SpotPlay/Stop" }, + {'S' , ":Spotify show", "SpotShow" }, + {'u' , ":Spotify status", "SpotStatus" }, + + } + }, +} + +-- Notes: +-- code for load module located at doom.core.module.load_modules +-- code for binding: ddom.services.keymaps.applyKeymaps +return M diff --git a/modules.lua b/modules.lua index 25237670..dc22d4f6 100644 --- a/modules.lua +++ b/modules.lua @@ -62,7 +62,8 @@ return { "views", "fold", "refactor", - "scratch" + "entertainments", + "scratch", -- -- "charcounter", -- custom module test }, From ba63dc4312ce4d0e2314bae4ecb1149402040307 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Wed, 8 Feb 2023 14:39:18 +0700 Subject: [PATCH 40/70] Remove sample charcounter --- .../modules/features/charcounter/init.lua | 118 ------------------ 1 file changed, 118 deletions(-) delete mode 100644 lua/user/modules/features/charcounter/init.lua diff --git a/lua/user/modules/features/charcounter/init.lua b/lua/user/modules/features/charcounter/init.lua deleted file mode 100644 index 971c0da6..00000000 --- a/lua/user/modules/features/charcounter/init.lua +++ /dev/null @@ -1,118 +0,0 @@ -local char_counter = {} - -char_counter.settings = { - popup = { - position = "50%", - size = { - width = 80, - height = 40, - }, - border = { - padding = { - top = 2, - bottom = 2, - left = 3, - right = 3, - }, - }, style = "rounded", - enter = true, - buf_options = { - modifiable = true, - readonly = true, - }, - }, -} - -char_counter.packages = { - ["nui.nvim"] = { - "MunifTanjim/nui.nvim", - -- cmd = { "CountPrint" }, - }, -} - -char_counter.configs = { - ["nui.nvim"] = function() - vim.notify("char_counter: nui.nvim loaded", "info") - end, -} - -char_counter._insert_enter_char_count = nil -char_counter._accumulated_difference = 0 -char_counter._get_current_buffer_char_count = function() - local lines = vim.api.nvim_buf_line_count(0) - local chars = 0 - for _, line in ipairs(vim.api.nvim_buf_get_lines(0, 0, lines, false)) do - chars = chars + #line - end - return chars -end - -char_counter.autocmds = { - { - "InsertEnter", - "*", - function() - -- Only operate on normal file buffers - print(("buftype: %s"):format(vim.bo.buftype)) - if vim.bo.buftype == "" then - -- Store current char count - char_counter._insert_enter_char_count = char_counter._get_current_buffer_char_count() - end - end, - }, - { - "InsertLeave", - "*", - function() - -- Only operate on normal file buffers - if vim.bo.buftype == "" and char_counter._insert_enter_char_count then - -- Find the amount of chars added or removed - local new_count = char_counter._get_current_buffer_char_count() - local diff = new_count - char_counter._insert_enter_char_count - print(new_count, diff) - -- Add the difference to the accumulated total - char_counter._accumulated_difference = char_counter._accumulated_difference + diff - print(("Accumulated difference %s"):format(char_counter._accumulated_difference)) - end - end, - }, -} - -char_counter.cmds = { - { - "CountPrint", - function() - local Popup = require("nui.popup") - local popup = Popup(char_counter.settings.popup) - popup:mount() - popup:map("n", "", function() - popup:unmount() - end) - - local msg = ("char_counter: You have typed %s characters since I started counting."):format( - char_counter._accumulated_difference - ) - vim.api.nvim_buf_set_lines(popup.bufnr, 0, 1, false, { msg }) - end, - }, - { - "CountReset", - function() - char_counter._accumulated_difference = 0 - vim.notify("char_counter: Reset count!", "info") - end, - }, -} - -char_counter.binds = { - { - "i", - name = "+info", - { -- Adds a new `whichkey` folder called `+info` - { "c", ":CountPrint", name = "Print new chars" }, -- Binds `:CountPrint` to `ic` - { "r", ":CountReset", name = "Reset char count" }, -- Binds `:CountPrint` to `ic` - }, - }, -} - -return char_counter From 06f2c60c566fd879f298c4f237235a62878103f7 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Thu, 9 Feb 2023 13:56:50 +0700 Subject: [PATCH 41/70] Show all file in nvimtree (do not auto hide .git** file ) --- config.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config.lua b/config.lua index ec3b6a62..e91d0145 100644 --- a/config.lua +++ b/config.lua @@ -48,6 +48,9 @@ end if doom.features.lsp ~= nil then doom.features.lsp.requires_modules = { "features.auto_install" } end + +-- not hide file with any prifix +doom.features.explorer.settings.filters.custom={} -- doom.features. -- -- vim: sw=2 sts=2 ts=2 expandtab -- -- From 4fc78d16c88c706f8cd75a551b54e099e041a286 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Fri, 10 Mar 2023 02:17:37 +0700 Subject: [PATCH 42/70] avoid open telescope find_files in some buffer like term, neotree --- config.lua | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/config.lua b/config.lua index e91d0145..c989cf21 100644 --- a/config.lua +++ b/config.lua @@ -194,3 +194,33 @@ opt.confirm = true -- ]]) vim.opt.shortmess = "F" + +-- special for telescope find_files: in some windows we should not allow it to open +-- TODO: move this snippet into a moduel +local prohitbitedBuf = { + "term:", + "NvimTree_", +} + +function telescope_find_files_custom() + local title = vim.fn.bufname("%") + if (#vim.api.nvim_list_wins() > 1 )then -- 2 windows or more open, we should no allow open telescope in Neotree, term... + + + for i, x in pairs(prohitbitedBuf) do + if title:find(x) == 1 then + -- this window title is prohibited + print("could not open find_files in this window") + return + end + end + end + + require("telescope.builtin").find_files() +end +-- +doom.use_keybind({ + -- The `name` field will add the keybind to whichkey + { "ff", name = "find_file_adv", ':lua telescope_find_files_custom()', + } , +}) From 761acd22487b47ecc2b72d96b2aabe393947ecb8 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Thu, 16 Mar 2023 10:45:58 +0700 Subject: [PATCH 43/70] Add shortcut for increase / decrease folding --- lua/user/modules/features/fold/init.lua | 45 ++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/lua/user/modules/features/fold/init.lua b/lua/user/modules/features/fold/init.lua index 8e73cefb..e10d6dab 100644 --- a/lua/user/modules/features/fold/init.lua +++ b/lua/user/modules/features/fold/init.lua @@ -59,7 +59,30 @@ M.configs = { M.autocmds = {} -M.cmds = {} +M.cmds = { + { + "FoldL", + function(opts) + local foldlvel = opts.args + -- vim.cmd("set foldlevelstart="..foldlvel) -- BDelete this + vim.cmd("set foldlevel="..foldlvel) -- BDelete this + -- vim.cmd(".,$-bdelete") + -- require('close_buffers').delete({ type = 'other' }) + end, + { nargs = "*" }, + }, + { + "Fold", + function(opts) + local foldlvel = opts.args + vim.cmd("set foldlevelstart="..foldlvel) -- BDelete this + vim.cmd("set foldlevel="..foldlvel) -- BDelete this + -- vim.cmd(".,$-bdelete") + -- require('close_buffers').delete({ type = 'other' }) + end, + { nargs = "*" }, + }, +} M.binds = { { @@ -68,6 +91,26 @@ M.binds = { name = "Fold preview", mode = "nv", }, + { + "z1", + [[set foldlevel=1]], + name = "Fold level 1", + mode = "nv", + }, + { "z2", [[set foldlevel=2]], name = "Fold level 2", mode = "nv" }, + { "z9", [[set foldlevel=9]], name = "Fold level 9", mode = "nv" }, + { + "z+", + [[let &foldlevel=&foldlevel + 1]], + name = "Increase fold level", + mode = "nv", + }, + { + "z-", + [[let &foldlevel=&foldlevel - 1]], + name = "Increase fold level", + mode = "nv", + }, } return M From ff60fcaa795ddae18cc527b4d5f6cbbd523050d2 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Tue, 21 Mar 2023 14:23:52 +0700 Subject: [PATCH 44/70] feat(explorer): migrate to use on_attach for key key_mapping the old method is expired --- lua/doom/modules/features/explorer/init.lua | 67 +++++----- .../modules/features/explorer/key_mapping.lua | 119 ++++++++++++++++++ 2 files changed, 155 insertions(+), 31 deletions(-) create mode 100644 lua/doom/modules/features/explorer/key_mapping.lua diff --git a/lua/doom/modules/features/explorer/init.lua b/lua/doom/modules/features/explorer/init.lua index 17f6a443..35f7f53a 100644 --- a/lua/doom/modules/features/explorer/init.lua +++ b/lua/doom/modules/features/explorer/init.lua @@ -94,7 +94,9 @@ explorer.settings = { explorer.packages = { ["nvim-tree.lua"] = { "kyazdani42/nvim-tree.lua", - commit = "7282f7de8aedf861fe0162a559fc2b214383c51c", + -- commit = "7282f7de8aedf861fe0162a559fc2b214383c51c", + commit = "aa99717", + module = "nvim-tree.api", cmd = { "NvimTreeClipboard", @@ -112,7 +114,7 @@ explorer.configs["nvim-tree.lua"] = function() local utils = require("doom.utils") local is_module_enabled = utils.is_module_enabled - local tree_cb = require("nvim-tree.config").nvim_tree_callback + -- local tree_cb = require("nvim-tree.config").nvim_tree_callback local override_table = {} if is_module_enabled("features", "lsp") then @@ -128,36 +130,39 @@ explorer.configs["nvim-tree.lua"] = function() }, } end + local keymap=require ("doom.modules.features.explorer.key_mapping") local config = vim.tbl_deep_extend("force", { - view = { - mappings = { - list = { - { key = { "o", "<2-LeftMouse>" }, cb = tree_cb("edit") }, - { key = { "", "<2-RightMouse>", "" }, cb = tree_cb("cd") }, - { key = "", cb = tree_cb("vsplit") }, - { key = "", cb = tree_cb("split") }, - { key = "", cb = tree_cb("tabnew") }, - { key = "", cb = tree_cb("close_node") }, - { key = "", cb = tree_cb("close_node") }, - { key = "", cb = tree_cb("preview") }, - { key = "I", cb = tree_cb("toggle_git_ignored") }, - { key = "H", cb = tree_cb("toggle_dotfiles") }, - { key = "R", cb = tree_cb("refresh") }, - { key = "a", cb = tree_cb("create") }, - { key = "d", cb = tree_cb("remove") }, - { key = "r", cb = tree_cb("rename") }, - { key = "", cb = tree_cb("full_rename") }, - { key = "x", cb = tree_cb("cut") }, - { key = "c", cb = tree_cb("copy") }, - { key = "p", cb = tree_cb("paste") }, - { key = "[c", cb = tree_cb("prev_git_item") }, - { key = "]c", cb = tree_cb("next_git_item") }, - { key = "-", cb = tree_cb("dir_up") }, - { key = "q", cb = tree_cb("close") }, - { key = "g?", cb = tree_cb("toggle_help") }, - }, - }, - }, + on_attach = keymap.on_attach, + + -- view = { + -- mappings = { + -- list = { + -- { key = { "o", "<2-LeftMouse>" }, cb = tree_cb("edit") }, + -- { key = { "", "<2-RightMouse>", "" }, cb = tree_cb("cd") }, + -- { key = "", cb = tree_cb("vsplit") }, + -- { key = "", cb = tree_cb("split") }, + -- { key = "", cb = tree_cb("tabnew") }, + -- { key = "", cb = tree_cb("close_node") }, + -- { key = "", cb = tree_cb("close_node") }, + -- { key = "", cb = tree_cb("preview") }, + -- { key = "I", cb = tree_cb("toggle_git_ignored") }, + -- { key = "H", cb = tree_cb("toggle_dotfiles") }, + -- { key = "R", cb = tree_cb("refresh") }, + -- { key = "a", cb = tree_cb("create") }, + -- { key = "d", cb = tree_cb("remove") }, + -- { key = "r", cb = tree_cb("rename") }, + -- { key = "", cb = tree_cb("full_rename") }, + -- { key = "x", cb = tree_cb("cut") }, + -- { key = "c", cb = tree_cb("copy") }, + -- { key = "p", cb = tree_cb("paste") }, + -- { key = "[c", cb = tree_cb("prev_git_item") }, + -- { key = "]c", cb = tree_cb("next_git_item") }, + -- { key = "-", cb = tree_cb("dir_up") }, + -- { key = "q", cb = tree_cb("close") }, + -- { key = "g?", cb = tree_cb("toggle_help") }, + -- }, + -- }, + -- }, filters = { dotfiles = not doom.show_hidden, }, diff --git a/lua/doom/modules/features/explorer/key_mapping.lua b/lua/doom/modules/features/explorer/key_mapping.lua new file mode 100644 index 00000000..95a5b50e --- /dev/null +++ b/lua/doom/modules/features/explorer/key_mapping.lua @@ -0,0 +1,119 @@ +-- +-- This function has been generated from your +-- view.mappings.list +-- view.mappings.custom_only +-- remove_keymaps +-- +-- You should add this function to your configuration and set on_attach = on_attach in the nvim-tree setup call. +-- +-- Although care was taken to ensure correctness and completeness, your review is required. +-- +-- Please check for the following issues in auto generated content: +-- "Mappings removed" is as you expect +-- "Mappings migrated" are correct +-- +-- Please see https://github.com/nvim-tree/nvim-tree.lua/wiki/Migrating-To-on_attach for assistance in migrating. +-- +local M = {} +function M.on_attach(bufnr) + local api = require("nvim-tree.api") + + local function opts(desc) + return { + desc = "nvim-tree: " .. desc, + buffer = bufnr, + noremap = true, + silent = true, + nowait = true, + } + end + + -- Default mappings. Feel free to modify or remove as you wish. + -- + -- BEGIN_DEFAULT_ON_ATTACH + vim.keymap.set("n", "", api.tree.change_root_to_node, opts("CD")) + vim.keymap.set("n", "", api.node.open.replace_tree_buffer, opts("Open: In Place")) + vim.keymap.set("n", "", api.node.show_info_popup, opts("Info")) + vim.keymap.set("n", "", api.fs.rename_sub, opts("Rename: Omit Filename")) + vim.keymap.set("n", "", api.node.open.tab, opts("Open: New Tab")) + vim.keymap.set("n", "", api.node.open.vertical, opts("Open: Vertical Split")) + vim.keymap.set("n", "", api.node.open.horizontal, opts("Open: Horizontal Split")) + vim.keymap.set("n", "", api.node.navigate.parent_close, opts("Close Directory")) + vim.keymap.set("n", "", api.node.open.edit, opts("Open")) + vim.keymap.set("n", "", api.node.open.preview, opts("Open Preview")) + vim.keymap.set("n", ">", api.node.navigate.sibling.next, opts("Next Sibling")) + vim.keymap.set("n", "<", api.node.navigate.sibling.prev, opts("Previous Sibling")) + vim.keymap.set("n", ".", api.node.run.cmd, opts("Run Command")) + vim.keymap.set("n", "-", api.tree.change_root_to_parent, opts("Up")) + vim.keymap.set("n", "a", api.fs.create, opts("Create")) + vim.keymap.set("n", "bmv", api.marks.bulk.move, opts("Move Bookmarked")) + vim.keymap.set("n", "B", api.tree.toggle_no_buffer_filter, opts("Toggle No Buffer")) + vim.keymap.set("n", "c", api.fs.copy.node, opts("Copy")) + vim.keymap.set("n", "C", api.tree.toggle_git_clean_filter, opts("Toggle Git Clean")) + vim.keymap.set("n", "[c", api.node.navigate.git.prev, opts("Prev Git")) + vim.keymap.set("n", "]c", api.node.navigate.git.next, opts("Next Git")) + vim.keymap.set("n", "d", api.fs.remove, opts("Delete")) + vim.keymap.set("n", "D", api.fs.trash, opts("Trash")) + vim.keymap.set("n", "E", api.tree.expand_all, opts("Expand All")) + vim.keymap.set("n", "e", api.fs.rename_basename, opts("Rename: Basename")) + vim.keymap.set("n", "]e", api.node.navigate.diagnostics.next, opts("Next Diagnostic")) + vim.keymap.set("n", "[e", api.node.navigate.diagnostics.prev, opts("Prev Diagnostic")) + vim.keymap.set("n", "F", api.live_filter.clear, opts("Clean Filter")) + vim.keymap.set("n", "f", api.live_filter.start, opts("Filter")) + vim.keymap.set("n", "g?", api.tree.toggle_help, opts("Help")) + vim.keymap.set("n", "gy", api.fs.copy.absolute_path, opts("Copy Absolute Path")) + vim.keymap.set("n", "H", api.tree.toggle_hidden_filter, opts("Toggle Dotfiles")) + vim.keymap.set("n", "I", api.tree.toggle_gitignore_filter, opts("Toggle Git Ignore")) + vim.keymap.set("n", "J", api.node.navigate.sibling.last, opts("Last Sibling")) + vim.keymap.set("n", "K", api.node.navigate.sibling.first, opts("First Sibling")) + vim.keymap.set("n", "m", api.marks.toggle, opts("Toggle Bookmark")) + vim.keymap.set("n", "o", api.node.open.edit, opts("Open")) + vim.keymap.set("n", "O", api.node.open.no_window_picker, opts("Open: No Window Picker")) + vim.keymap.set("n", "p", api.fs.paste, opts("Paste")) + vim.keymap.set("n", "P", api.node.navigate.parent, opts("Parent Directory")) + vim.keymap.set("n", "q", api.tree.close, opts("Close")) + vim.keymap.set("n", "r", api.fs.rename, opts("Rename")) + vim.keymap.set("n", "R", api.tree.reload, opts("Refresh")) + -- vim.keymap.set("n", "s", api.node.run.system, opts("Run System")) -- disable as conflict with my HopChar mappings + vim.keymap.set("n", "S", api.tree.search_node, opts("Search")) + vim.keymap.set("n", "U", api.tree.toggle_custom_filter, opts("Toggle Hidden")) + vim.keymap.set("n", "W", api.tree.collapse_all, opts("Collapse")) + vim.keymap.set("n", "x", api.fs.cut, opts("Cut")) + vim.keymap.set("n", "y", api.fs.copy.filename, opts("Copy Name")) + vim.keymap.set("n", "Y", api.fs.copy.relative_path, opts("Copy Relative Path")) + vim.keymap.set("n", "<2-LeftMouse>", api.node.open.edit, opts("Open")) + vim.keymap.set("n", "<2-RightMouse>", api.tree.change_root_to_node, opts("CD")) + -- END_DEFAULT_ON_ATTACH + + -- Mappings migrated from view.mappings.list + -- + -- You will need to insert "your code goes here" for any mappings with a custom action_cb + vim.keymap.set("n", "o", api.node.open.edit, opts("Open")) + vim.keymap.set("n", "<2-LeftMouse>", api.node.open.edit, opts("Open")) + vim.keymap.set("n", "", api.tree.change_root_to_node, opts("CD")) + vim.keymap.set("n", "<2-RightMouse>", api.tree.change_root_to_node, opts("CD")) + vim.keymap.set("n", "", api.tree.change_root_to_node, opts("CD")) + vim.keymap.set("n", "", api.node.open.vertical, opts("Open: Vertical Split")) + vim.keymap.set("n", "", api.node.open.horizontal, opts("Open: Horizontal Split")) + vim.keymap.set("n", "", api.node.open.tab, opts("Open: New Tab")) + vim.keymap.set("n", "", api.node.navigate.parent_close, opts("Close Directory")) + vim.keymap.set("n", "", api.node.navigate.parent_close, opts("Close Directory")) + vim.keymap.set("n", "", api.node.open.preview, opts("Open Preview")) + vim.keymap.set("n", "I", api.tree.toggle_gitignore_filter, opts("Toggle Git Ignore")) + vim.keymap.set("n", "H", api.tree.toggle_hidden_filter, opts("Toggle Dotfiles")) + vim.keymap.set("n", "R", api.tree.reload, opts("Refresh")) + vim.keymap.set("n", "a", api.fs.create, opts("Create")) + vim.keymap.set("n", "d", api.fs.remove, opts("Delete")) + vim.keymap.set("n", "r", api.fs.rename, opts("Rename")) + vim.keymap.set("n", "", api.fs.rename_sub, opts("Rename: Omit Filename")) + vim.keymap.set("n", "x", api.fs.cut, opts("Cut")) + vim.keymap.set("n", "c", api.fs.copy.node, opts("Copy")) + vim.keymap.set("n", "p", api.fs.paste, opts("Paste")) + vim.keymap.set("n", "[c", api.node.navigate.git.prev, opts("Prev Git")) + vim.keymap.set("n", "]c", api.node.navigate.git.next, opts("Next Git")) + vim.keymap.set("n", "-", api.tree.change_root_to_parent, opts("Up")) + vim.keymap.set("n", "q", api.tree.close, opts("Close")) + vim.keymap.set("n", "g?", api.tree.toggle_help, opts("Help")) +end + +return M From 609f4fdbab1de5a4de7f8945866ec105c40cb31f Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Tue, 21 Mar 2023 14:24:47 +0700 Subject: [PATCH 45/70] enable git sign (required for Gitblock info in statusline) --- modules.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules.lua b/modules.lua index dc22d4f6..b59fc2ed 100644 --- a/modules.lua +++ b/modules.lua @@ -24,7 +24,7 @@ return { "auto_session", -- Remember sessions between loads -- "colorizer", -- Show colors in neovim "editorconfig", -- Support editorconfig files --- -- "gitsigns", -- Show git changes in sidebar + "gitsigns", -- Show git changes in sidebar. Also required for shoing branch in statusline "illuminate", -- Highlight other copies of the word you're hovering on "indentlines", -- Show indent lines with special characters "range_highlight", -- Highlight selected range from commands "todo_comments", -- Highlight TODO: comments From bc7eec5e8f923b9790537d3af9718b31ffec2e4f Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Tue, 21 Mar 2023 14:25:16 +0700 Subject: [PATCH 46/70] some todo status changes --- todo.norg | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/todo.norg b/todo.norg index 8820bcd5..35032904 100644 --- a/todo.norg +++ b/todo.norg @@ -14,10 +14,10 @@ TODO: check why out put some line in open file (currently workaround by out put * [ ]C-k not work randomly * [x] integrate git-sign into git feature => done * [x] Error msg when save => done -* [ ] mark down lsp (remark) not work -* [ ] Markdown preview +* [x] mark down lsp (remark) not work +* [x] Markdown preview * [ ] integrate octo plugin (edit github PR in nvim) -* [ ] Telescope find file (leader-f-f) work not correct (actually ) +* [x] Telescope find file (leader-f-f) work not correct (actually ) * [x] binding C-g for Hop , not 'ghw' * [ ] resize windows hydra * [x]-------- better folding (maybe use UFO insteadof default tree-sitter) @@ -25,8 +25,8 @@ TODO: check why out put some line in open file (currently workaround by out put * [ ] copilot * [x] sometime current line is undeadable because of grey color = * [ ] Virtual whichkey hint -* [ ] Neorg should auto load when open norg file -* [ ] close (leader-b-d) buffer should go to the next buffer in bufferline +* [x] Neorg should auto load when open norg file +* [x] close (leader-b-d) buffer should go to the next buffer in bufferline * [ ] refactoring * [ ] Neogit confirm winfows when commiting code not correct (nothing display, not close ) * [ ] Incorrect indent with golang From 3571525b5260becdf1f5b478cab88f4aea44c334 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Tue, 21 Mar 2023 14:23:52 +0700 Subject: [PATCH 47/70] feat(explorer): migrate to use on_attach for key key_mapping the old method is expired --- lua/doom/modules/features/explorer/init.lua | 66 +++++----- .../modules/features/explorer/key_mapping.lua | 119 ++++++++++++++++++ 2 files changed, 154 insertions(+), 31 deletions(-) create mode 100644 lua/doom/modules/features/explorer/key_mapping.lua diff --git a/lua/doom/modules/features/explorer/init.lua b/lua/doom/modules/features/explorer/init.lua index 7283cd3a..171f1508 100644 --- a/lua/doom/modules/features/explorer/init.lua +++ b/lua/doom/modules/features/explorer/init.lua @@ -94,7 +94,8 @@ explorer.settings = { explorer.packages = { ["nvim-tree.lua"] = { "nvim-tree/nvim-tree.lua", - commit = "3ce0a8e770f70a135ef969e0a640bd8d05baf42c", + commit = "aa99717", + module = "nvim-tree.api", cmd = { "NvimTreeClipboard", "NvimTreeClose", @@ -111,7 +112,7 @@ explorer.configs["nvim-tree.lua"] = function() local utils = require("doom.utils") local is_module_enabled = utils.is_module_enabled - local tree_cb = require("nvim-tree.config").nvim_tree_callback + -- local tree_cb = require("nvim-tree.config").nvim_tree_callback local override_table = {} if is_module_enabled("features", "lsp") then @@ -127,36 +128,39 @@ explorer.configs["nvim-tree.lua"] = function() }, } end + local keymap=require ("doom.modules.features.explorer.key_mapping") local config = vim.tbl_deep_extend("force", { - view = { - mappings = { - list = { - { key = { "o", "<2-LeftMouse>" }, cb = tree_cb("edit") }, - { key = { "", "<2-RightMouse>", "" }, cb = tree_cb("cd") }, - { key = "", cb = tree_cb("vsplit") }, - { key = "", cb = tree_cb("split") }, - { key = "", cb = tree_cb("tabnew") }, - { key = "", cb = tree_cb("close_node") }, - { key = "", cb = tree_cb("close_node") }, - { key = "", cb = tree_cb("preview") }, - { key = "I", cb = tree_cb("toggle_git_ignored") }, - { key = "H", cb = tree_cb("toggle_dotfiles") }, - { key = "R", cb = tree_cb("refresh") }, - { key = "a", cb = tree_cb("create") }, - { key = "d", cb = tree_cb("remove") }, - { key = "r", cb = tree_cb("rename") }, - { key = "", cb = tree_cb("full_rename") }, - { key = "x", cb = tree_cb("cut") }, - { key = "c", cb = tree_cb("copy") }, - { key = "p", cb = tree_cb("paste") }, - { key = "[c", cb = tree_cb("prev_git_item") }, - { key = "]c", cb = tree_cb("next_git_item") }, - { key = "-", cb = tree_cb("dir_up") }, - { key = "q", cb = tree_cb("close") }, - { key = "g?", cb = tree_cb("toggle_help") }, - }, - }, - }, + on_attach = keymap.on_attach, + + -- view = { + -- mappings = { + -- list = { + -- { key = { "o", "<2-LeftMouse>" }, cb = tree_cb("edit") }, + -- { key = { "", "<2-RightMouse>", "" }, cb = tree_cb("cd") }, + -- { key = "", cb = tree_cb("vsplit") }, + -- { key = "", cb = tree_cb("split") }, + -- { key = "", cb = tree_cb("tabnew") }, + -- { key = "", cb = tree_cb("close_node") }, + -- { key = "", cb = tree_cb("close_node") }, + -- { key = "", cb = tree_cb("preview") }, + -- { key = "I", cb = tree_cb("toggle_git_ignored") }, + -- { key = "H", cb = tree_cb("toggle_dotfiles") }, + -- { key = "R", cb = tree_cb("refresh") }, + -- { key = "a", cb = tree_cb("create") }, + -- { key = "d", cb = tree_cb("remove") }, + -- { key = "r", cb = tree_cb("rename") }, + -- { key = "", cb = tree_cb("full_rename") }, + -- { key = "x", cb = tree_cb("cut") }, + -- { key = "c", cb = tree_cb("copy") }, + -- { key = "p", cb = tree_cb("paste") }, + -- { key = "[c", cb = tree_cb("prev_git_item") }, + -- { key = "]c", cb = tree_cb("next_git_item") }, + -- { key = "-", cb = tree_cb("dir_up") }, + -- { key = "q", cb = tree_cb("close") }, + -- { key = "g?", cb = tree_cb("toggle_help") }, + -- }, + -- }, + -- }, filters = { dotfiles = not doom.show_hidden, }, diff --git a/lua/doom/modules/features/explorer/key_mapping.lua b/lua/doom/modules/features/explorer/key_mapping.lua new file mode 100644 index 00000000..95a5b50e --- /dev/null +++ b/lua/doom/modules/features/explorer/key_mapping.lua @@ -0,0 +1,119 @@ +-- +-- This function has been generated from your +-- view.mappings.list +-- view.mappings.custom_only +-- remove_keymaps +-- +-- You should add this function to your configuration and set on_attach = on_attach in the nvim-tree setup call. +-- +-- Although care was taken to ensure correctness and completeness, your review is required. +-- +-- Please check for the following issues in auto generated content: +-- "Mappings removed" is as you expect +-- "Mappings migrated" are correct +-- +-- Please see https://github.com/nvim-tree/nvim-tree.lua/wiki/Migrating-To-on_attach for assistance in migrating. +-- +local M = {} +function M.on_attach(bufnr) + local api = require("nvim-tree.api") + + local function opts(desc) + return { + desc = "nvim-tree: " .. desc, + buffer = bufnr, + noremap = true, + silent = true, + nowait = true, + } + end + + -- Default mappings. Feel free to modify or remove as you wish. + -- + -- BEGIN_DEFAULT_ON_ATTACH + vim.keymap.set("n", "", api.tree.change_root_to_node, opts("CD")) + vim.keymap.set("n", "", api.node.open.replace_tree_buffer, opts("Open: In Place")) + vim.keymap.set("n", "", api.node.show_info_popup, opts("Info")) + vim.keymap.set("n", "", api.fs.rename_sub, opts("Rename: Omit Filename")) + vim.keymap.set("n", "", api.node.open.tab, opts("Open: New Tab")) + vim.keymap.set("n", "", api.node.open.vertical, opts("Open: Vertical Split")) + vim.keymap.set("n", "", api.node.open.horizontal, opts("Open: Horizontal Split")) + vim.keymap.set("n", "", api.node.navigate.parent_close, opts("Close Directory")) + vim.keymap.set("n", "", api.node.open.edit, opts("Open")) + vim.keymap.set("n", "", api.node.open.preview, opts("Open Preview")) + vim.keymap.set("n", ">", api.node.navigate.sibling.next, opts("Next Sibling")) + vim.keymap.set("n", "<", api.node.navigate.sibling.prev, opts("Previous Sibling")) + vim.keymap.set("n", ".", api.node.run.cmd, opts("Run Command")) + vim.keymap.set("n", "-", api.tree.change_root_to_parent, opts("Up")) + vim.keymap.set("n", "a", api.fs.create, opts("Create")) + vim.keymap.set("n", "bmv", api.marks.bulk.move, opts("Move Bookmarked")) + vim.keymap.set("n", "B", api.tree.toggle_no_buffer_filter, opts("Toggle No Buffer")) + vim.keymap.set("n", "c", api.fs.copy.node, opts("Copy")) + vim.keymap.set("n", "C", api.tree.toggle_git_clean_filter, opts("Toggle Git Clean")) + vim.keymap.set("n", "[c", api.node.navigate.git.prev, opts("Prev Git")) + vim.keymap.set("n", "]c", api.node.navigate.git.next, opts("Next Git")) + vim.keymap.set("n", "d", api.fs.remove, opts("Delete")) + vim.keymap.set("n", "D", api.fs.trash, opts("Trash")) + vim.keymap.set("n", "E", api.tree.expand_all, opts("Expand All")) + vim.keymap.set("n", "e", api.fs.rename_basename, opts("Rename: Basename")) + vim.keymap.set("n", "]e", api.node.navigate.diagnostics.next, opts("Next Diagnostic")) + vim.keymap.set("n", "[e", api.node.navigate.diagnostics.prev, opts("Prev Diagnostic")) + vim.keymap.set("n", "F", api.live_filter.clear, opts("Clean Filter")) + vim.keymap.set("n", "f", api.live_filter.start, opts("Filter")) + vim.keymap.set("n", "g?", api.tree.toggle_help, opts("Help")) + vim.keymap.set("n", "gy", api.fs.copy.absolute_path, opts("Copy Absolute Path")) + vim.keymap.set("n", "H", api.tree.toggle_hidden_filter, opts("Toggle Dotfiles")) + vim.keymap.set("n", "I", api.tree.toggle_gitignore_filter, opts("Toggle Git Ignore")) + vim.keymap.set("n", "J", api.node.navigate.sibling.last, opts("Last Sibling")) + vim.keymap.set("n", "K", api.node.navigate.sibling.first, opts("First Sibling")) + vim.keymap.set("n", "m", api.marks.toggle, opts("Toggle Bookmark")) + vim.keymap.set("n", "o", api.node.open.edit, opts("Open")) + vim.keymap.set("n", "O", api.node.open.no_window_picker, opts("Open: No Window Picker")) + vim.keymap.set("n", "p", api.fs.paste, opts("Paste")) + vim.keymap.set("n", "P", api.node.navigate.parent, opts("Parent Directory")) + vim.keymap.set("n", "q", api.tree.close, opts("Close")) + vim.keymap.set("n", "r", api.fs.rename, opts("Rename")) + vim.keymap.set("n", "R", api.tree.reload, opts("Refresh")) + -- vim.keymap.set("n", "s", api.node.run.system, opts("Run System")) -- disable as conflict with my HopChar mappings + vim.keymap.set("n", "S", api.tree.search_node, opts("Search")) + vim.keymap.set("n", "U", api.tree.toggle_custom_filter, opts("Toggle Hidden")) + vim.keymap.set("n", "W", api.tree.collapse_all, opts("Collapse")) + vim.keymap.set("n", "x", api.fs.cut, opts("Cut")) + vim.keymap.set("n", "y", api.fs.copy.filename, opts("Copy Name")) + vim.keymap.set("n", "Y", api.fs.copy.relative_path, opts("Copy Relative Path")) + vim.keymap.set("n", "<2-LeftMouse>", api.node.open.edit, opts("Open")) + vim.keymap.set("n", "<2-RightMouse>", api.tree.change_root_to_node, opts("CD")) + -- END_DEFAULT_ON_ATTACH + + -- Mappings migrated from view.mappings.list + -- + -- You will need to insert "your code goes here" for any mappings with a custom action_cb + vim.keymap.set("n", "o", api.node.open.edit, opts("Open")) + vim.keymap.set("n", "<2-LeftMouse>", api.node.open.edit, opts("Open")) + vim.keymap.set("n", "", api.tree.change_root_to_node, opts("CD")) + vim.keymap.set("n", "<2-RightMouse>", api.tree.change_root_to_node, opts("CD")) + vim.keymap.set("n", "", api.tree.change_root_to_node, opts("CD")) + vim.keymap.set("n", "", api.node.open.vertical, opts("Open: Vertical Split")) + vim.keymap.set("n", "", api.node.open.horizontal, opts("Open: Horizontal Split")) + vim.keymap.set("n", "", api.node.open.tab, opts("Open: New Tab")) + vim.keymap.set("n", "", api.node.navigate.parent_close, opts("Close Directory")) + vim.keymap.set("n", "", api.node.navigate.parent_close, opts("Close Directory")) + vim.keymap.set("n", "", api.node.open.preview, opts("Open Preview")) + vim.keymap.set("n", "I", api.tree.toggle_gitignore_filter, opts("Toggle Git Ignore")) + vim.keymap.set("n", "H", api.tree.toggle_hidden_filter, opts("Toggle Dotfiles")) + vim.keymap.set("n", "R", api.tree.reload, opts("Refresh")) + vim.keymap.set("n", "a", api.fs.create, opts("Create")) + vim.keymap.set("n", "d", api.fs.remove, opts("Delete")) + vim.keymap.set("n", "r", api.fs.rename, opts("Rename")) + vim.keymap.set("n", "", api.fs.rename_sub, opts("Rename: Omit Filename")) + vim.keymap.set("n", "x", api.fs.cut, opts("Cut")) + vim.keymap.set("n", "c", api.fs.copy.node, opts("Copy")) + vim.keymap.set("n", "p", api.fs.paste, opts("Paste")) + vim.keymap.set("n", "[c", api.node.navigate.git.prev, opts("Prev Git")) + vim.keymap.set("n", "]c", api.node.navigate.git.next, opts("Next Git")) + vim.keymap.set("n", "-", api.tree.change_root_to_parent, opts("Up")) + vim.keymap.set("n", "q", api.tree.close, opts("Close")) + vim.keymap.set("n", "g?", api.tree.toggle_help, opts("Help")) +end + +return M From 26ac77bb2e3174b53c5a6b6e4a3460fb88f2e259 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Wed, 22 Mar 2023 15:01:55 +0700 Subject: [PATCH 48/70] enable Diag for typescript --- lua/doom/modules/langs/typescript/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/modules/langs/typescript/init.lua b/lua/doom/modules/langs/typescript/init.lua index 6719871f..f7fa7e08 100644 --- a/lua/doom/modules/langs/typescript/init.lua +++ b/lua/doom/modules/langs/typescript/init.lua @@ -39,7 +39,7 @@ typescript.settings = { --- Disables null-ls diagnostic sources --- @type boolean - disable_diagnostics = true, + disable_diagnostics = false, --- Mason.nvim package to auto install the diagnostics provider from --- @type string diagnostics_package = "eslint_d", From 413bf3d1bd0896166b1d74912958f7671053a1d3 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Wed, 29 Mar 2023 01:43:27 +0700 Subject: [PATCH 49/70] Add user module to interact with githubi using Otto --- lua/user/modules/features/github/init.lua | 178 ++++++++++++++++++++++ modules.lua | 1 + 2 files changed, 179 insertions(+) create mode 100644 lua/user/modules/features/github/init.lua diff --git a/lua/user/modules/features/github/init.lua b/lua/user/modules/features/github/init.lua new file mode 100644 index 00000000..39335e2c --- /dev/null +++ b/lua/user/modules/features/github/init.lua @@ -0,0 +1,178 @@ +-- NeoRoot +-- ThePrimeagen/refactoring.nvim +-- ray-x/lsp_signature.nvim +-- ray-x/lsp_signature.nvim +-- rcarriga/nvim-dap-ui +-- theHamsta/nvim-dap-virtual-text +-- nvim-telescope/telescope-dap.nvim +-- gcmt/taboo.vim +-- pretty-fold +-- fold-preview +-- preservim/vim-markdown +-- godlygeek/tabular +-- iamcco/markdown-preview.nvim +-- SidOfc/mkdx +-- nvim-orgmode/orgmode +-- -- ekickx/clipboard-image.nvim +-- local key_mappings = { +-- issue = { +-- close_issue = { lhs = "ic", desc = "close issue" }, +-- reopen_issue = { lhs = "io", desc = "reopen issue" }, +-- list_issues = { lhs = "il", desc = "list open issues on same repo" }, +-- -- list_issues = { lhs = "iL", desc = "list open issues on same repo" }, +-- reload = { lhs = "", desc = "reload issue" }, +-- open_in_browser = { lhs = "", desc = "open issue in browser" }, +-- copy_url = { lhs = "", desc = "copy url to system clipboard" }, +-- add_assignee = { lhs = "aa", desc = "add assignee" }, +-- remove_assignee = { lhs = "ad", desc = "remove assignee" }, +-- create_label = { lhs = "lc", desc = "create label" }, +-- add_label = { lhs = "la", desc = "add label" }, +-- remove_label = { lhs = "ld", desc = "remove label" }, +-- goto_issue = { lhs = "gi", desc = "navigate to a local repo issue" }, +-- add_comment = { lhs = "ca", desc = "add comment" }, +-- delete_comment = { lhs = "cd", desc = "delete comment" }, +-- next_comment = { lhs = "]c", desc = "go to next comment" }, +-- prev_comment = { lhs = "[c", desc = "go to previous comment" }, +-- react_hooray = { lhs = "rp", desc = "add/remove 🎉 reaction" }, +-- react_heart = { lhs = "rh", desc = "add/remove ❤️ reaction" }, +-- react_eyes = { lhs = "re", desc = "add/remove 👀 reaction" }, +-- react_thumbs_up = { lhs = "r+", desc = "add/remove 👍 reaction" }, +-- react_thumbs_down = { lhs = "r-", desc = "add/remove 👎 reaction" }, +-- react_rocket = { lhs = "rr", desc = "add/remove 🚀 reaction" }, +-- react_laugh = { lhs = "rl", desc = "add/remove 😄 reaction" }, +-- react_confused = { lhs = "rc", desc = "add/remove 😕 reaction" }, +-- }, +-- pull_request = { +-- checkout_pr = { lhs = "po", desc = "checkout PR" }, +-- merge_pr = { lhs = "pm", desc = "merge commit PR" }, +-- squash_and_merge_pr = { lhs = "psm", desc = "squash and merge PR" }, +-- list_commits = { lhs = "pc", desc = "list PR commits" }, +-- list_changed_files = { lhs = "pf", desc = "list PR changed files" }, +-- show_pr_diff = { lhs = "pd", desc = "show PR diff" }, +-- add_reviewer = { lhs = "va", desc = "add reviewer" }, +-- remove_reviewer = { lhs = "vd", desc = "remove reviewer request" }, +-- close_issue = { lhs = "ic", desc = "close PR" }, +-- reopen_issue = { lhs = "io", desc = "reopen PR" }, +-- list_issues = { lhs = "il", desc = "list open issues on same repo" }, +-- reload = { lhs = "", desc = "reload PR" }, +-- open_in_browser = { lhs = "", desc = "open PR in browser" }, +-- copy_url = { lhs = "", desc = "copy url to system clipboard" }, +-- goto_file = { lhs = "gf", desc = "go to file" }, +-- add_assignee = { lhs = "aa", desc = "add assignee" }, +-- remove_assignee = { lhs = "ad", desc = "remove assignee" }, +-- create_label = { lhs = "lc", desc = "create label" }, +-- add_label = { lhs = "la", desc = "add label" }, +-- remove_label = { lhs = "ld", desc = "remove label" }, +-- goto_issue = { lhs = "gi", desc = "navigate to a local repo issue" }, +-- add_comment = { lhs = "ca", desc = "add comment" }, +-- delete_comment = { lhs = "cd", desc = "delete comment" }, +-- next_comment = { lhs = "]c", desc = "go to next comment" }, +-- prev_comment = { lhs = "[c", desc = "go to previous comment" }, +-- react_hooray = { lhs = "rp", desc = "add/remove 🎉 reaction" }, +-- react_heart = { lhs = "rh", desc = "add/remove ❤️ reaction" }, +-- react_eyes = { lhs = "re", desc = "add/remove 👀 reaction" }, +-- react_thumbs_up = { lhs = "r+", desc = "add/remove 👍 reaction" }, +-- react_thumbs_down = { lhs = "r-", desc = "add/remove 👎 reaction" }, +-- react_rocket = { lhs = "rr", desc = "add/remove 🚀 reaction" }, +-- react_laugh = { lhs = "rl", desc = "add/remove 😄 reaction" }, +-- react_confused = { lhs = "rc", desc = "add/remove 😕 reaction" }, +-- }, +-- review_thread = { +-- goto_issue = { lhs = "gi", desc = "navigate to a local repo issue" }, +-- add_comment = { lhs = "ca", desc = "add comment" }, +-- add_suggestion = { lhs = "sa", desc = "add suggestion" }, +-- delete_comment = { lhs = "cd", desc = "delete comment" }, +-- next_comment = { lhs = "]c", desc = "go to next comment" }, +-- prev_comment = { lhs = "[c", desc = "go to previous comment" }, +-- select_next_entry = { lhs = "]q", desc = "move to previous changed file" }, +-- select_prev_entry = { lhs = "[q", desc = "move to next changed file" }, +-- close_review_tab = { lhs = "", desc = "close review tab" }, +-- react_hooray = { lhs = "rp", desc = "add/remove 🎉 reaction" }, +-- react_heart = { lhs = "rh", desc = "add/remove ❤️ reaction" }, +-- react_eyes = { lhs = "re", desc = "add/remove 👀 reaction" }, +-- react_thumbs_up = { lhs = "r+", desc = "add/remove 👍 reaction" }, +-- react_thumbs_down = { lhs = "r-", desc = "add/remove 👎 reaction" }, +-- react_rocket = { lhs = "rr", desc = "add/remove 🚀 reaction" }, +-- react_laugh = { lhs = "rl", desc = "add/remove 😄 reaction" }, +-- react_confused = { lhs = "rc", desc = "add/remove 😕 reaction" }, +-- }, +-- submit_win = { +-- approve_review = { lhs = "", desc = "approve review" }, +-- comment_review = { lhs = "", desc = "comment review" }, +-- request_changes = { lhs = "", desc = "request changes review" }, +-- close_review_tab = { lhs = "", desc = "close review tab" }, +-- }, +-- review_diff = { +-- add_review_comment = { lhs = "ca", desc = "add a new review comment" }, +-- add_review_suggestion = { lhs = "sa", desc = "add a new review suggestion" }, +-- focus_files = { lhs = "e", desc = "move focus to changed file panel" }, +-- toggle_files = { lhs = "b", desc = "hide/show changed files panel" }, +-- next_thread = { lhs = "]t", desc = "move to next thread" }, +-- prev_thread = { lhs = "[t", desc = "move to previous thread" }, +-- select_next_entry = { lhs = "]q", desc = "move to previous changed file" }, +-- select_prev_entry = { lhs = "[q", desc = "move to next changed file" }, +-- close_review_tab = { lhs = "", desc = "close review tab" }, +-- toggle_viewed = { lhs = "", desc = "toggle viewer viewed state" }, +-- }, +-- file_panel = { +-- next_entry = { lhs = "j", desc = "move to next changed file" }, +-- prev_entry = { lhs = "k", desc = "move to previous changed file" }, +-- select_entry = { lhs = "", desc = "show selected changed file diffs" }, +-- refresh_files = { lhs = "R", desc = "refresh changed files panel" }, +-- focus_files = { lhs = "e", desc = "move focus to changed file panel" }, +-- toggle_files = { lhs = "b", desc = "hide/show changed files panel" }, +-- select_next_entry = { lhs = "]q", desc = "move to previous changed file" }, +-- select_prev_entry = { lhs = "[q", desc = "move to next changed file" }, +-- close_review_tab = { lhs = "", desc = "close review tab" }, +-- toggle_viewed = { lhs = "", desc = "toggle viewer viewed state" }, +-- } +-- } +local M = {} + +M.settings = {} + +M.packages = { + + ["octo.nvim"] = { + "pwntester/octo.nvim", + requires = { + "nvim-lua/plenary.nvim", + "nvim-telescope/telescope.nvim", + "kyazdani42/nvim-web-devicons", + }, + }, + -- ["vimade"] = { + -- "TaDaa/vimade", + -- }, +} +-- local function getMappings1() +-- return key_mappings; +-- end + +M.configs = { + ["octo.nvim"] = function() + require("octo").setup({ + default_remote = { "origin", "upstream" }, + -- mappings = getMappings1() + }) + end, +} + +M.autocmds = {} + +M.cmds = {} +-- M.requires_modules = { "features.auto_install" } +M.binds = { + { + "go", + [[Octo actions]], + name = "Octo menu", + mode = "nv", + }, +} + +-- Notes: +-- code for load module located at doom.core.module.load_modules +-- code for binding: ddom.services.keymaps.applyKeymaps + +return M diff --git a/modules.lua b/modules.lua index b59fc2ed..288d9537 100644 --- a/modules.lua +++ b/modules.lua @@ -64,6 +64,7 @@ return { "refactor", "entertainments", "scratch", + "github", -- -- "charcounter", -- custom module test }, From c5c2ccee7b40077cc443d678494202f33ed49160 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Wed, 29 Mar 2023 15:57:28 +0700 Subject: [PATCH 50/70] feat: add module copilot use official plugin --- lua/user/modules/features/copilot/init.lua | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 lua/user/modules/features/copilot/init.lua diff --git a/lua/user/modules/features/copilot/init.lua b/lua/user/modules/features/copilot/init.lua new file mode 100644 index 00000000..9670a74d --- /dev/null +++ b/lua/user/modules/features/copilot/init.lua @@ -0,0 +1,38 @@ +local M = {} + +M.settings = {} + +M.packages = { + + ["copilot.vim"] = { + "github/copilot.vim", + }, +} +-- local function getMappings1() +-- return key_mappings; +-- end + +M.configs = { + -- ["copilot-cmp"] = function() + -- require("copilot_cmp").setup() + -- end, +} + +M.autocmds = {} + +M.cmds = {} +-- M.requires_modules = { "features.auto_install" } +-- M.binds = { +-- { +-- "go", +-- [[Octo actions]], +-- name = "Octo menu", +-- mode = "nv", +-- }, +-- } + +-- Notes: +-- code for load module located at doom.core.module.load_modules +-- code for binding: ddom.services.keymaps.applyKeymaps + +return M From 485c43a5b2a56ad0e416e2081cae38ec7ee16e99 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Wed, 29 Mar 2023 15:58:17 +0700 Subject: [PATCH 51/70] feat: add module copilot using copilot.lua --- config.lua | 9 +++ lua/user/modules/features/copilot2/init.lua | 68 +++++++++++++++++++++ modules.lua | 2 + 3 files changed, 79 insertions(+) create mode 100644 lua/user/modules/features/copilot2/init.lua diff --git a/config.lua b/config.lua index c989cf21..d9cb5f67 100644 --- a/config.lua +++ b/config.lua @@ -47,8 +47,17 @@ end if doom.features.lsp ~= nil then doom.features.lsp.requires_modules = { "features.auto_install" } + doom.features.lsp.settings.completion.sources = { + { name = "copilot" }, + { name = "nvim_lua" }, + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "path" }, + { name = "buffer" }, + } end + -- not hide file with any prifix doom.features.explorer.settings.filters.custom={} -- doom.features. diff --git a/lua/user/modules/features/copilot2/init.lua b/lua/user/modules/features/copilot2/init.lua new file mode 100644 index 00000000..6e814558 --- /dev/null +++ b/lua/user/modules/features/copilot2/init.lua @@ -0,0 +1,68 @@ +local M = {} + +M.settings = {} + +M.packages = { + + ["copilot.lua"] = { + "zbirenbaum/copilot.lua", + -- cmd = "Copilot", + -- event = "InsertEnter", + }, + ["copilot-cmp"] = { + "zbirenbaum/copilot-cmp", + after = { "copilot.lua" }, + }, + -- ["vimade"] = { + -- "TaDaa/vimade", + -- }, +} +-- local function getMappings1() +-- return key_mappings; +-- end + +M.configs = { + ["copilot-cmp"] = function() + require("copilot_cmp").setup() + end, + ["copilot.lua"] = function() + -- require("copilot").setup({ + -- suggestion = { + -- auto_trigger = true, + -- keymap = { + -- accept = "", + -- }, + -- }, + -- }) + vim.defer_fn(function() + require("copilot").setup({ + suggestion = { enabled = false }, + panel = { enabled = false }, + }) + end, 100) + + -- require("copilot").setup({ + -- suggestion = { enabled = false }, + -- panel = { enabled = false }, + -- }) + end, +} + +M.autocmds = {} + +M.cmds = {} +-- M.requires_modules = { "features.auto_install" } +-- M.binds = { +-- { +-- "go", +-- [[Octo actions]], +-- name = "Octo menu", +-- mode = "nv", +-- }, +-- } + +-- Notes: +-- code for load module located at doom.core.module.load_modules +-- code for binding: ddom.services.keymaps.applyKeymaps + +return M diff --git a/modules.lua b/modules.lua index 288d9537..aaf8ccde 100644 --- a/modules.lua +++ b/modules.lua @@ -65,6 +65,8 @@ return { "entertainments", "scratch", "github", + -- "copilot", -- Copilot using standard Copilot from github/tpope + "copilot2", -- Copilot using Copilot lua plugin from zbirenbaum -- -- "charcounter", -- custom module test }, From 35aae28bfddc2ae1fe26f1118e9ebda0a75ab2af Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Thu, 30 Mar 2023 12:28:55 +0700 Subject: [PATCH 52/70] Update reference --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5cc2ab65..45ef1642 100644 --- a/README.md +++ b/README.md @@ -132,6 +132,7 @@ You can find a full list of modules [here](./docs/modules.md#all-modules) Doom nvim provides a number of config options, including wrapping some of vim's own options. See all available config options [in the API Reference](./docs/api.md). + ```lua -- config.lua @@ -327,7 +328,8 @@ You will also need to delete `packer_compiled.lua` from `$XDG_DATA_HOME/nvim/plu ## Contributing -For for information please see our [contributing docs](./docs/contributing.md). +For for information please see our [contributing docs](./docs/contributing.md).
+Also try to refer to [excelent guide to develop in nvim lua](https://github.com/nanotee/nvim-lua-guide) ## Contributors From 2686a567b31521fdb4cee703312bb9aa11d5d4e3 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Thu, 30 Mar 2023 17:01:20 +0700 Subject: [PATCH 53/70] feat: change order for vim-expand-region --- lua/user/modules/features/navigation/init.lua | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lua/user/modules/features/navigation/init.lua b/lua/user/modules/features/navigation/init.lua index 820f6c5f..1b191a1f 100644 --- a/lua/user/modules/features/navigation/init.lua +++ b/lua/user/modules/features/navigation/init.lua @@ -81,16 +81,22 @@ M.configs = { ["vim-expand-region"] = function() vim.g.expand_region_text_objects = { ["i"] = 0, + ["i'"] = 0, + ['i"'] = 0, ["iw"] = 0, ["i]"] = 1, + ["a]"] = 1, ["i}"] = 1, + ["a}"] = 1, ["i)"] = 1, + ["a)"] = 1, + ["iW"] = 0, ["it"] = 1, - ["ib"] = 1, - ["iB"] = 1, + -- ["ib"] = 1, + -- ["iB"] = 1, ["il"] = 0, - ["ip"] = 0, - ["ie"] = 0, + -- ["ip"] = 0, + -- ["ie"] = 0, } -- TODO: convert to use module binding mechanism From 480706514e23c5ff1dc7f665ef75b264441d758b Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Fri, 31 Mar 2023 10:09:54 +0700 Subject: [PATCH 54/70] Prevent cmp from auto select the first suggestion --- config.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config.lua b/config.lua index d9cb5f67..b25d7e46 100644 --- a/config.lua +++ b/config.lua @@ -55,6 +55,8 @@ if doom.features.lsp ~= nil then { name = "path" }, { name = "buffer" }, } + -- doom.features.lsp.settings.completion.completeopt="menu,menuone,preview,noinsert,noselect" -- force user choose an item to complete + doom.features.lsp.settings.completion.completeopt="menu,menuone,preview,noinsert,noselect" -- force user choose an item to complete end From 567444bd951d3dfec8e88164355df9e6a0034d6f Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Fri, 31 Mar 2023 10:10:42 +0700 Subject: [PATCH 55/70] Rename template --- .../modules/features/{template-init.lua => templates/init.lua} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename lua/user/modules/features/{template-init.lua => templates/init.lua} (100%) diff --git a/lua/user/modules/features/template-init.lua b/lua/user/modules/features/templates/init.lua similarity index 100% rename from lua/user/modules/features/template-init.lua rename to lua/user/modules/features/templates/init.lua From 40636c17e6818143696117a4547b20a03c3dd2d9 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Fri, 31 Mar 2023 14:03:06 +0700 Subject: [PATCH 56/70] feat: add mini and session modules --- lua/doom/modules/features/telescope/init.lua | 29 +++++---- lua/user/modules/features/mini-util/init.lua | 65 +++++++++++++++++++ lua/user/modules/features/navigation/init.lua | 8 ++- lua/user/modules/features/session/init.lua | 44 +++++++++++++ modules.lua | 6 +- 5 files changed, 134 insertions(+), 18 deletions(-) create mode 100644 lua/user/modules/features/mini-util/init.lua create mode 100644 lua/user/modules/features/session/init.lua diff --git a/lua/doom/modules/features/telescope/init.lua b/lua/doom/modules/features/telescope/init.lua index b1049190..1fce5c83 100644 --- a/lua/doom/modules/features/telescope/init.lua +++ b/lua/doom/modules/features/telescope/init.lua @@ -43,11 +43,15 @@ telescope.settings = { use_less = true, set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil, }, - extensions = { "mapper", + extensions = { + "mapper", ["ui-select"] = { - -- require("telescope.themes").get_dropdown { } + -- require("telescope.themes").get_dropdown { } }, - } + sessions_picker = { + sessions_dir = vim.fn.stdpath("data") .. "/sessions/", -- same as '/home/user/.local/share/nvim/session' + }, + }, } telescope.packages = { @@ -69,21 +73,20 @@ telescope.packages = { "nvim-telescope/telescope-fzf-native.nvim", -- cmd = "Telescope ", after = "telescope.nvim", - config = function () - require('telescope').load_extension('fzf') - end , + config = function() + require("telescope").load_extension("fzf") + end, opt = false, }, ["telescope-ui-select.nvim"] = { "nvim-telescope/telescope-ui-select.nvim", -- cmd = "Telescope ", after = "telescope.nvim", - config = function () - require('telescope').load_extension('ui-select') - end , + config = function() + require("telescope").load_extension("ui-select") + end, opt = false, }, - } telescope.configs = {} @@ -202,10 +205,10 @@ telescope.binds = function() } if is_module_enabled("features", "lsp") then table.insert(binds[2], { + { + "c", + name = "+code", { - "c", - name = "+code", - { { "s", "Telescope lsp_document_symbols", name = "Lsp symbols", remap = true }, }, }, diff --git a/lua/user/modules/features/mini-util/init.lua b/lua/user/modules/features/mini-util/init.lua new file mode 100644 index 00000000..dea97027 --- /dev/null +++ b/lua/user/modules/features/mini-util/init.lua @@ -0,0 +1,65 @@ +-- Couple of mini plugin, most from https://github.com/echasnovski/mini.nvim + +local M = {} + +M.settings = {} + +M.packages = { + ["mini.nvim"] = { + "echasnovski/mini.nvim", + }, + -- ["vimade"] = { + -- "TaDaa/vimade", + -- }, +} + +M.configs = { + ["mini.nvim"] = function() + -- common sense setting + -- require('mini.basics').setup() + -- Go back/forward (f, F...) in also nextline. ";" supported + require("mini.jump").setup() + + -- Actually it's same with HopChar. Will keep both for a while to see which one is better + require("mini.jump2d").setup({ + mappings = { + start_jumping = "", + }, + }) + -- similar to vim-sandwich + require("mini.surround").setup() + + -- use gcc to comment line + require('mini.comment').setup() + + -- correct buffer to display when delete a buffer + -- Not use, sometime bugs when press j/k + -- require('mini.bufremove').setup() + -- Hight light current indent level + + require('mini.indentscope').setup( + {draw = { + animation = require('mini.indentscope').gen_animation.none() + }} + ) + end, +} + +M.autocmds = {} + +M.cmds = {} +-- M.requires_modules = { "features.auto_install" } +-- M.binds kk +-- { +-- -- { +-- -- "ghw", +-- -- [[HopWord]], +-- -- name = "Go to word in the screen", +-- -- mode = "nv", +-- -- }, +-- } + +-- Notes: +-- code for load module located at doom.core.module.load_modules +-- code for binding: ddom.services.keymaps.applyKeymaps +return M diff --git a/lua/user/modules/features/navigation/init.lua b/lua/user/modules/features/navigation/init.lua index 1b191a1f..97d2234f 100644 --- a/lua/user/modules/features/navigation/init.lua +++ b/lua/user/modules/features/navigation/init.lua @@ -7,9 +7,9 @@ M.packages = { -- "folke/noice.nvim", -- requires = {"MunifTanjim/nui.nvim"}, -- }, - ["vim-sandwich"] = { - "machakann/vim-sandwich", - }, + -- ["vim-sandwich"] = { + -- "machakann/vim-sandwich", + -- }, ["symbols-outline.nvim"] = { "simrat39/symbols-outline.nvim", }, -- ["cutlass.nvim"] = { @@ -92,6 +92,8 @@ M.configs = { ["a)"] = 1, ["iW"] = 0, ["it"] = 1, + ["ii"] = 1, -- inside indent from mini.nvim + ["ai"] = 1, -- around indent from mini.nvim -- ["ib"] = 1, -- ["iB"] = 1, ["il"] = 0, diff --git a/lua/user/modules/features/session/init.lua b/lua/user/modules/features/session/init.lua new file mode 100644 index 00000000..28d9cf41 --- /dev/null +++ b/lua/user/modules/features/session/init.lua @@ -0,0 +1,44 @@ +local M = {} + +M.settings = {} + +M.packages = { + ["telescope_sessions_picker"] = { + "JoseConseco/telescope_sessions_picker.nvim", + after = "telescope.nvim", + }, + -- ["vimade"] = { + -- "TaDaa/vimade", + -- }, +} + +M.configs = { + ["telescope_sessions_picker"] = function() + require("telescope").load_extension("sessions_picker") + require("mini.sessions").setup({ + autoread = true, + autowrite = true, + file = "Session.vim", + directory = vim.fn.stdpath("data") .. "/sessions/", + }) + end, +} + +M.autocmds = {} + +M.cmds = {} +-- M.requires_modules = { "features.auto_install" } +-- M.binds kk +-- { +-- -- { +-- -- "ghw", +-- -- [[HopWord]], +-- -- name = "Go to word in the screen", +-- -- mode = "nv", +-- -- }, +-- } + +-- Notes: +-- code for load module located at doom.core.module.load_modules +-- code for binding: ddom.services.keymaps.applyKeymaps +return M diff --git a/modules.lua b/modules.lua index aaf8ccde..82778c35 100644 --- a/modules.lua +++ b/modules.lua @@ -12,7 +12,7 @@ return { "annotations", -- Code annotation generator "auto_install", -- Auto install LSP providers "autopairs", -- Automatically close character pairs - "comment", -- Adds keybinds to comment in any language + -- "comment", -- Adds keybinds to comment in any language "linter", -- Linting and formatting for languages "lsp", -- Code completion "lsp_progress", -- Check status of LSP loading -- @@ -21,7 +21,7 @@ return { -- -- -- -- Editor -- - "auto_session", -- Remember sessions between loads + -- "auto_session", -- Remember sessions between loads -- "colorizer", -- Show colors in neovim "editorconfig", -- Support editorconfig files "gitsigns", -- Show git changes in sidebar. Also required for shoing branch in statusline @@ -67,6 +67,8 @@ return { "github", -- "copilot", -- Copilot using standard Copilot from github/tpope "copilot2", -- Copilot using Copilot lua plugin from zbirenbaum + "mini-util", + "session", -- -- "charcounter", -- custom module test }, From bb87ce62f5d8854fd6a74ca8d997a3bd108cb7f2 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Fri, 31 Mar 2023 14:04:27 +0700 Subject: [PATCH 57/70] minor changes: case insensitive in search --- config.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/config.lua b/config.lua index b25d7e46..aadf06a5 100644 --- a/config.lua +++ b/config.lua @@ -39,6 +39,7 @@ -- doom.indent = 2 -- doom.core.treesitter.settings.show_compiler_warning_message = false +doom.ignorecase = true doom.core.reloader.settings.reload_on_save = false -- if doom.langs.lua ~= nil then From 8100dec3f67f7c10f4455ec2f77e62b11460208b Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Fri, 31 Mar 2023 14:05:03 +0700 Subject: [PATCH 58/70] custom the dashboard page --- lua/doom/modules/features/dashboard/init.lua | 59 +++++++++++++------- 1 file changed, 39 insertions(+), 20 deletions(-) diff --git a/lua/doom/modules/features/dashboard/init.lua b/lua/doom/modules/features/dashboard/init.lua index 49de2def..6d704381 100644 --- a/lua/doom/modules/features/dashboard/init.lua +++ b/lua/doom/modules/features/dashboard/init.lua @@ -34,26 +34,29 @@ dashboard.settings = { }, }, header = { - " ", - "================= =============== =============== ======== ========", - "\\\\ . . . . . . .\\\\ //. . . . . . .\\\\ //. . . . . . .\\\\ \\\\. . .\\\\// . . //", - "||. . ._____. . .|| ||. . ._____. . .|| ||. . ._____. . .|| || . . .\\/ . . .||", - "|| . .|| ||. . || || . .|| ||. . || || . .|| ||. . || ||. . . . . . . ||", - "||. . || || . .|| ||. . || || . .|| ||. . || || . .|| || . | . . . . .||", - "|| . .|| ||. _-|| ||-_ .|| ||. . || || . .|| ||. _-|| ||-_.|\\ . . . . ||", - "||. . || ||-' || || `-|| || . .|| ||. . || ||-' || || `|\\_ . .|. .||", - "|| . _|| || || || || ||_ . || || . _|| || || || |\\ `-_/| . ||", - "||_-' || .|/ || || \\|. || `-_|| ||_-' || .|/ || || | \\ / |-_.||", - "|| ||_-' || || `-_|| || || ||_-' || || | \\ / | `||", - "|| `' || || `' || || `' || || | \\ / | ||", - "|| .===' `===. .==='.`===. .===' /==. | \\/ | ||", - "|| .==' \\_|-_ `===. .===' _|_ `===. .===' _-|/ `== \\/ | ||", - "|| .==' _-' `-_ `=' _-' `-_ `=' _-' `-_ /| \\/ | ||", - "|| .==' _-' `-__\\._-' `-_./__-' `' |. /| | ||", - "||.==' _-' `' | /==.||", - "==' _-' N E O V I M \\/ `==", - "\\ _-' `-_ /", - " `'' ``' ", +" .-----------------. .----------------. .----------------. .----------------. .----------------. .----------------. ", +"| .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. |", +"| | ____ _____ | || | _________ | || | ____ | || | ____ ____ | || | _____ | || | ____ ____ | |", +"| ||_ \\|_ _| | || | |_ ___ | | || | .' `. | || ||_ _| |_ _| | || | |_ _| | || ||_ \\ / _|| |", +"| | | \\ | | | || | | |_ \\_| | || | / .--. \\ | || | \\ \\ / / | || | | | | || | | \\/ | | |", +"| | | |\\ \\| | | || | | _| _ | || | | | | | | || | \\ \\ / / | || | | | | || | | |\\ /| | | |", +"| | _| |_\\ |_ | || | _| |___/ | | || | \\ `--' / | || | \\ ' / | || | _| |_ | || | _| |_\\/_| |_ | |", +"| ||_____|\\____| | || | |_________| | || | `.____.' | || | \\_/ | || | |_____| | || ||_____||_____|| |", +"| | | || | | || | | || | | || | | || | | |", +"| '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' |", +" '----------------' '----------------' '----------------' '----------------' '----------------' '----------------'", + "/ | / | / |/ \\ / |", + "$$$$$$$$/ __ __ ______ _______ $$ |____ ______ _______ _______ $$$$$$/ $$$$$$$ |$$$$$$$$/ ", + " $$ | / | / | / \\ / \\ $$ \\ / \\ / | / | $$ | $$ | $$ |$$ |__ ", + " $$ | $$ | $$ | $$$$$$ |$$$$$$$ |$$$$$$$ | $$$$$$ |/$$$$$$$/ /$$$$$$$/ $$ | $$ | $$ |$$ | ", + " $$ | $$ | $$ | / $$ |$$ | $$ |$$ | $$ | / $$ |$$ \\ $$ \\ $$ | $$ | $$ |$$$$$/ ", + " $$ | $$ \\__$$ |/$$$$$$$ |$$ | $$ |$$ |__$$ |/$$$$$$$ | $$$$$$ | $$$$$$ | _$$ |_ $$ |__$$ |$$ |_____", + " $$ | $$ $$/ $$ $$ |$$ | $$ |$$ $$/ $$ $$ |/ $$/ / $$/ / $$ |$$ $$/ $$ |", + " $$/ $$$$$$/ $$$$$$$/ $$/ $$/ $$$$$$$/ $$$$$$$/ $$$$$$$/ $$$$$$$/ $$$$$$/ $$$$$$$/ $$$$$$$$/", + " ", + " ", + " ", + " ", }, footer = { "", "Doom Nvim loaded" }, colors = { @@ -93,8 +96,23 @@ dashboard.configs["dashboard-nvim"] = function() action = "lua require('persistence').load({ last = true })", } end + if is_module_enabled("features", "session") then + doom.features.dashboard.settings.entries.t = { + icon = " ", + desc = "Load Last mini Session ", + shortcut = "Undef " , + action = "lua MiniSessions.read()", + } + doom.features.dashboard.settings.entries.z = { + icon = " ", + desc = "Telescope Session ", + shortcut = "Undef " , + action = "Telescope sessions_picker", + } + end db.custom_center = doom.features.dashboard.settings.entries + db.theme = "doom" if type(doom.features.dashboard.settings.footer) ~= "function" then db.custom_footer = doom.features.dashboard.settings.footer @@ -133,6 +151,7 @@ dashboard.autocmds = { "dashboard", function() require("doom.services.keymaps").applyKeymaps({ "q", "q", buffer = true }) + vim.cmd("set foldlevel=99") end, }, { From ab6d3f972e543697fb1f2624b27059400f84733a Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Fri, 31 Mar 2023 17:59:01 +0700 Subject: [PATCH 59/70] Add hydra module --- lua/user/modules/features/hydra/init.lua | 86 ++++++++++++++++++++++++ modules.lua | 1 + 2 files changed, 87 insertions(+) create mode 100644 lua/user/modules/features/hydra/init.lua diff --git a/lua/user/modules/features/hydra/init.lua b/lua/user/modules/features/hydra/init.lua new file mode 100644 index 00000000..d75dcd68 --- /dev/null +++ b/lua/user/modules/features/hydra/init.lua @@ -0,0 +1,86 @@ +local M = {} + +M.settings = {} + +M.packages = { + ["hydra.nvim"] = { + "anuvyklack/hydra.nvim", + requires = "anuvyklack/keymap-layer.nvim", + }, + -- ["vimade"] = { + -- "TaDaa/vimade", + -- }, +} +M.configs = { + ["hydra.nvim"] = function() + -- require("hydra").setup() + local this = require('user.modules.features.hydra') + this.window_hydra() + + end, +} + +M.autocmds = {} + +-- M.cmds = { +-- { +-- "TestHydra", +-- function() +-- require('user.modules.features.hydra').window_hydra() +-- -- vim.cmd(".,$-bdelete") +-- -- require('close_buffers').delete({ type = 'other' }) +-- end, +-- }, +-- } +-- M.requires_modules = { "features.auto_install" } +-- M.binds kk +-- { +-- -- { +-- -- "ghw", +-- -- [[HopWord]], +-- -- name = "Go to word in the screen", +-- -- mode = "nv", +-- -- }, +-- } + +-- Notes: +-- code for load module located at doom.core.module.load_modules +-- code for binding: ddom.services.keymaps.applyKeymaps +M.window_hydra = function() + local Hydra = require("hydra") + print("window_hydra") + Hydra({ + name = "Windows", + mode = "n", + body = "", + heads = { + { "+", "+" }, + { "-", "-" , { desc = "height" }}, + + { "<", "<" }, + { ">", ">" , { desc = "width" }}, + + { "h", "h" }, + { "j", "j" }, + { "k", "k" }, + { "l", "l" , { desc = "l/d/u/r" }}, + + }, + }) + +end +-- M.scroll_hydra = function() +-- local Hydra = require("hydra") +-- Hydra({ +-- name = "Side scroll", +-- mode = "n", +-- body = "z", +-- heads = { +-- { "h", "5zh" }, +-- { "l", "5zl", { desc = "←/→" } }, +-- { "H", "zH" }, +-- { "L", "zL", { desc = "half screen ←/→" } }, +-- }, +-- }) +-- end +return M diff --git a/modules.lua b/modules.lua index 82778c35..b93206d1 100644 --- a/modules.lua +++ b/modules.lua @@ -69,6 +69,7 @@ return { "copilot2", -- Copilot using Copilot lua plugin from zbirenbaum "mini-util", "session", + "hydra", -- -- "charcounter", -- custom module test }, From 89cac07775944fa763ec4341810af22ef4adfd7a Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Sun, 2 Apr 2023 01:11:51 +0700 Subject: [PATCH 60/70] Add the telescope picker to search all actions available in Octo --- lua/user/modules/features/github/init.lua | 217 ++++++++------------ lua/user/modules/features/github/picker.lua | 101 +++++++++ 2 files changed, 186 insertions(+), 132 deletions(-) create mode 100644 lua/user/modules/features/github/picker.lua diff --git a/lua/user/modules/features/github/init.lua b/lua/user/modules/features/github/init.lua index 39335e2c..c557a6b7 100644 --- a/lua/user/modules/features/github/init.lua +++ b/lua/user/modules/features/github/init.lua @@ -1,134 +1,31 @@ --- NeoRoot --- ThePrimeagen/refactoring.nvim --- ray-x/lsp_signature.nvim --- ray-x/lsp_signature.nvim --- rcarriga/nvim-dap-ui --- theHamsta/nvim-dap-virtual-text --- nvim-telescope/telescope-dap.nvim --- gcmt/taboo.vim --- pretty-fold --- fold-preview --- preservim/vim-markdown --- godlygeek/tabular --- iamcco/markdown-preview.nvim --- SidOfc/mkdx --- nvim-orgmode/orgmode --- -- ekickx/clipboard-image.nvim --- local key_mappings = { --- issue = { --- close_issue = { lhs = "ic", desc = "close issue" }, --- reopen_issue = { lhs = "io", desc = "reopen issue" }, --- list_issues = { lhs = "il", desc = "list open issues on same repo" }, --- -- list_issues = { lhs = "iL", desc = "list open issues on same repo" }, --- reload = { lhs = "", desc = "reload issue" }, --- open_in_browser = { lhs = "", desc = "open issue in browser" }, --- copy_url = { lhs = "", desc = "copy url to system clipboard" }, --- add_assignee = { lhs = "aa", desc = "add assignee" }, --- remove_assignee = { lhs = "ad", desc = "remove assignee" }, --- create_label = { lhs = "lc", desc = "create label" }, --- add_label = { lhs = "la", desc = "add label" }, --- remove_label = { lhs = "ld", desc = "remove label" }, --- goto_issue = { lhs = "gi", desc = "navigate to a local repo issue" }, --- add_comment = { lhs = "ca", desc = "add comment" }, --- delete_comment = { lhs = "cd", desc = "delete comment" }, --- next_comment = { lhs = "]c", desc = "go to next comment" }, --- prev_comment = { lhs = "[c", desc = "go to previous comment" }, --- react_hooray = { lhs = "rp", desc = "add/remove 🎉 reaction" }, --- react_heart = { lhs = "rh", desc = "add/remove ❤️ reaction" }, --- react_eyes = { lhs = "re", desc = "add/remove 👀 reaction" }, --- react_thumbs_up = { lhs = "r+", desc = "add/remove 👍 reaction" }, --- react_thumbs_down = { lhs = "r-", desc = "add/remove 👎 reaction" }, --- react_rocket = { lhs = "rr", desc = "add/remove 🚀 reaction" }, --- react_laugh = { lhs = "rl", desc = "add/remove 😄 reaction" }, --- react_confused = { lhs = "rc", desc = "add/remove 😕 reaction" }, --- }, --- pull_request = { --- checkout_pr = { lhs = "po", desc = "checkout PR" }, --- merge_pr = { lhs = "pm", desc = "merge commit PR" }, --- squash_and_merge_pr = { lhs = "psm", desc = "squash and merge PR" }, --- list_commits = { lhs = "pc", desc = "list PR commits" }, --- list_changed_files = { lhs = "pf", desc = "list PR changed files" }, --- show_pr_diff = { lhs = "pd", desc = "show PR diff" }, --- add_reviewer = { lhs = "va", desc = "add reviewer" }, --- remove_reviewer = { lhs = "vd", desc = "remove reviewer request" }, --- close_issue = { lhs = "ic", desc = "close PR" }, --- reopen_issue = { lhs = "io", desc = "reopen PR" }, --- list_issues = { lhs = "il", desc = "list open issues on same repo" }, --- reload = { lhs = "", desc = "reload PR" }, --- open_in_browser = { lhs = "", desc = "open PR in browser" }, --- copy_url = { lhs = "", desc = "copy url to system clipboard" }, --- goto_file = { lhs = "gf", desc = "go to file" }, --- add_assignee = { lhs = "aa", desc = "add assignee" }, --- remove_assignee = { lhs = "ad", desc = "remove assignee" }, --- create_label = { lhs = "lc", desc = "create label" }, --- add_label = { lhs = "la", desc = "add label" }, --- remove_label = { lhs = "ld", desc = "remove label" }, --- goto_issue = { lhs = "gi", desc = "navigate to a local repo issue" }, --- add_comment = { lhs = "ca", desc = "add comment" }, --- delete_comment = { lhs = "cd", desc = "delete comment" }, --- next_comment = { lhs = "]c", desc = "go to next comment" }, --- prev_comment = { lhs = "[c", desc = "go to previous comment" }, --- react_hooray = { lhs = "rp", desc = "add/remove 🎉 reaction" }, --- react_heart = { lhs = "rh", desc = "add/remove ❤️ reaction" }, --- react_eyes = { lhs = "re", desc = "add/remove 👀 reaction" }, --- react_thumbs_up = { lhs = "r+", desc = "add/remove 👍 reaction" }, --- react_thumbs_down = { lhs = "r-", desc = "add/remove 👎 reaction" }, --- react_rocket = { lhs = "rr", desc = "add/remove 🚀 reaction" }, --- react_laugh = { lhs = "rl", desc = "add/remove 😄 reaction" }, --- react_confused = { lhs = "rc", desc = "add/remove 😕 reaction" }, --- }, --- review_thread = { --- goto_issue = { lhs = "gi", desc = "navigate to a local repo issue" }, --- add_comment = { lhs = "ca", desc = "add comment" }, --- add_suggestion = { lhs = "sa", desc = "add suggestion" }, --- delete_comment = { lhs = "cd", desc = "delete comment" }, --- next_comment = { lhs = "]c", desc = "go to next comment" }, --- prev_comment = { lhs = "[c", desc = "go to previous comment" }, --- select_next_entry = { lhs = "]q", desc = "move to previous changed file" }, --- select_prev_entry = { lhs = "[q", desc = "move to next changed file" }, --- close_review_tab = { lhs = "", desc = "close review tab" }, --- react_hooray = { lhs = "rp", desc = "add/remove 🎉 reaction" }, --- react_heart = { lhs = "rh", desc = "add/remove ❤️ reaction" }, --- react_eyes = { lhs = "re", desc = "add/remove 👀 reaction" }, --- react_thumbs_up = { lhs = "r+", desc = "add/remove 👍 reaction" }, --- react_thumbs_down = { lhs = "r-", desc = "add/remove 👎 reaction" }, --- react_rocket = { lhs = "rr", desc = "add/remove 🚀 reaction" }, --- react_laugh = { lhs = "rl", desc = "add/remove 😄 reaction" }, --- react_confused = { lhs = "rc", desc = "add/remove 😕 reaction" }, --- }, --- submit_win = { --- approve_review = { lhs = "", desc = "approve review" }, --- comment_review = { lhs = "", desc = "comment review" }, --- request_changes = { lhs = "", desc = "request changes review" }, --- close_review_tab = { lhs = "", desc = "close review tab" }, --- }, --- review_diff = { --- add_review_comment = { lhs = "ca", desc = "add a new review comment" }, --- add_review_suggestion = { lhs = "sa", desc = "add a new review suggestion" }, --- focus_files = { lhs = "e", desc = "move focus to changed file panel" }, --- toggle_files = { lhs = "b", desc = "hide/show changed files panel" }, --- next_thread = { lhs = "]t", desc = "move to next thread" }, --- prev_thread = { lhs = "[t", desc = "move to previous thread" }, --- select_next_entry = { lhs = "]q", desc = "move to previous changed file" }, --- select_prev_entry = { lhs = "[q", desc = "move to next changed file" }, --- close_review_tab = { lhs = "", desc = "close review tab" }, --- toggle_viewed = { lhs = "", desc = "toggle viewer viewed state" }, --- }, --- file_panel = { --- next_entry = { lhs = "j", desc = "move to next changed file" }, --- prev_entry = { lhs = "k", desc = "move to previous changed file" }, --- select_entry = { lhs = "", desc = "show selected changed file diffs" }, --- refresh_files = { lhs = "R", desc = "refresh changed files panel" }, --- focus_files = { lhs = "e", desc = "move focus to changed file panel" }, --- toggle_files = { lhs = "b", desc = "hide/show changed files panel" }, --- select_next_entry = { lhs = "]q", desc = "move to previous changed file" }, --- select_prev_entry = { lhs = "[q", desc = "move to next changed file" }, --- close_review_tab = { lhs = "", desc = "close review tab" }, --- toggle_viewed = { lhs = "", desc = "toggle viewer viewed state" }, --- } --- } local M = {} +-- M.create_wk_mapping = function() +-- -- loop through all the mappings and create a wk mapping +-- local wk = require("which-key") +-- local buf_num = vim.fn.bufnr() +-- +-- for topic, mappings in pairs(M.keys_mappings) do +-- -- print("topic: ", topic) +-- for func, mapping in pairs(mappings) do +-- -- print("func: ", func) +-- local lhs = mapping.lhs +-- local desc = mapping.desc +-- +-- local wk_opts = { buffer = buf_num } +-- -- local wk_mapping = { lhs = lhs, opts = wk_opts, desc = desc } +-- local wk_mapping = {} +-- wk_mapping[lhs] = { +-- function() +-- print(func) +-- end, +-- desc, +-- } +-- wk.register(wk_mapping) +-- end +-- end +-- -- wk.register({ [""] = { name = "Leader" } }, { prefix = "" }) +-- end M.settings = {} M.packages = { @@ -157,15 +54,71 @@ M.configs = { }) end, } +M.octo_menu = function() + -- this.create_wk_mapping() + -- local buf_num = vim.fn.bufnr() + -- vim.api.nvim_buf_set_keymap(buf_num, "n", "ab", "echo 1", { noremap = true, silent = true }) + -- vim.api.nvim_buf_set_keymap(buf_num, "n", "ac", "echo 2", { noremap = true, silent = true }) + + -- local opts = {buffer = buf_num, prefix = ""} + -- local map = require("octo.mappings") + -- + local buf_num = vim.fn.bufnr() + -- local opts = { buffer = buf_num, prefix = "" } + local handler + if octo_buffers[buf_num] then + local picker = require("user.modules.features.github.picker") + -- print("in a octo buffer") + handler = picker.show + else + -- print("not in a octo buffer") + handler = require("octo.commands").actions + end -M.autocmds = {} + handler() + -- local opts = { buffer = buf_num, prefix = "" } + -- local wk_mappings = { + -- ["g"] = { + -- O = { handler, "Search Octo ops" }, + -- -- o= { map.open_issues , "reopen" }, + -- -- l= { map.list_issues , "list" }, + -- -- r= { map.reload , "reload(C-r)" }, + -- -- b= { map.open_in_browser , "open browser(C-b)" }, + -- -- y= { map.copy_url , "copy_url(c-y)" }, + -- }, + -- } + -- local wk = require("which-key") + -- wk.register(wk_mappings, opts) +end -M.cmds = {} +-- M.autocmds = { +-- { +-- "FileType", +-- -- "*", +-- "*octo", +-- octo_help +-- }, +-- } + +M.cmds = { + { + "OctoMenu", + function() + print("TestOcto") + local github = require("user.modules.features.github") + github.octo_menu() + + -- local picker = require("user.modules.features.github.picker") + -- local color = picker.show() + -- print("color: ", color) + end, + }, +} -- M.requires_modules = { "features.auto_install" } M.binds = { { "go", - [[Octo actions]], + [[OctoMenu]], name = "Octo menu", mode = "nv", }, diff --git a/lua/user/modules/features/github/picker.lua b/lua/user/modules/features/github/picker.lua new file mode 100644 index 00000000..9c713805 --- /dev/null +++ b/lua/user/modules/features/github/picker.lua @@ -0,0 +1,101 @@ +local octo_cfg = require("octo.config").defaults +local telescope_conf = require("telescope.config").values +local actions = require("telescope.actions") +local pickers = require("telescope.pickers") +local finders = require("telescope.finders") +local entry_display = require("telescope.pickers.entry_display") + +--- Read the key mapping from octo.nvim +--- then convert it to flat table which sutable for display in Telescope +---@param mappings: the key mapping from Octo +---@return flatted data +local function flat(mappings) + local flatted = {} + -- loop through all the mappings + for topic, commands in pairs(mappings) do + for func, command in pairs(commands) do + table.insert(flatted, { topic = topic, func = func, lhs = command.lhs, desc = command.desc }) + end + end + + return flatted +end + +local mapping = octo_cfg.mappings +local flatted_mapping = flat(mapping) + +--- Format the layout to display in telescope (Result pane) +---@param entry : represent each row in the result +---@return +local make_display = function(entry) + -- print("called make_display", vim.inspect(entry)) + if not entry then + return nil + end + + local columns = { + { entry.object.topic, "TelescopeResultsNumber" }, + { entry.object.func, "TelescopeResultsFunction" }, + { entry.object.desc, "TelescopeResultsNumber" }, + { entry.object.lhs, "TelescopeResultsNumber" }, + -- { entry.ordinal, "TelescopeResultsNumber" }, + } + + local displayer = entry_display.create({ + separator = " | ", + items = { + { width = 20 }, + { width = 25 }, + { width = 50 }, + { remaining = true }, + }, + }) + + return displayer(columns) +end + +--- Prepare the data for each row in the Telescope result pane +---@param entry +---@return +local entry_maker = function(entry) + -- print("called entry_maker", (entry)) + return { + display = make_display, + value = entry.desc, + ordinal = entry.topic .. entry.func .. entry.desc, -- text use for filter + object = entry, + } +end + +local close_picker = function(prompt_bufnr) + local selection = require("telescope.actions.state").get_selected_entry() + actions.close(prompt_bufnr) + local func_to_call = selection.object.func + local m = require("octo.mappings") + m[func_to_call]() +end + +--- Create the picker to select a function from Octo +---@return +local function create_picker() + pickers + .new({}, { + prompt_title = "Octo operations", + finder = finders.new_table({ + results = flatted_mapping, -- The result set, find by the finder + entry_maker = entry_maker, -- formating the result + }), + sorter = telescope_conf.generic_sorter(), + attach_mappings = function(prompt_bufnr, map) + -- will close the picker + map("i", "", close_picker) + map("n", "", close_picker) + return true + end, + }) + :find() +end + +return { + show = create_picker, +} From 8a59ab14eb3b3c06227c7d172f4307aa6bd99492 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Thu, 6 Apr 2023 11:50:45 +0700 Subject: [PATCH 61/70] disable groups in Bufferline --- lua/doom/modules/features/tabline/init.lua | 42 +++++++++++----------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/lua/doom/modules/features/tabline/init.lua b/lua/doom/modules/features/tabline/init.lua index f3d20e2e..1e71fe4f 100644 --- a/lua/doom/modules/features/tabline/init.lua +++ b/lua/doom/modules/features/tabline/init.lua @@ -31,27 +31,27 @@ tabline.settings = { return true end end, - groups = { - options = { - toggle_hidden_on_enter = true, -- when you re-enter a hidden group this options re-opens that group so the buffer is visible - }, - items = { - { - name = "Tests", - auto_close = true, - matcher = function(buf) - return buf.filename:match("%_test") or buf.filename:match("%_spec") - end, - }, - { - name = "Docs", - auto_close = true, - matcher = function(buf) - return buf.filename:match("%.md") or buf.filename:match("%.txt") - end, - }, - }, - }, + -- groups = { + -- options = { + -- toggle_hidden_on_enter = true, -- when you re-enter a hidden group this options re-opens that group so the buffer is visible + -- }, + -- items = { + -- { + -- name = "Tests", + -- auto_close = true, + -- matcher = function(buf) + -- return buf.filename:match("%_test") or buf.filename:match("%_spec") + -- end, + -- }, + -- { + -- name = "Docs", + -- auto_close = true, + -- matcher = function(buf) + -- return buf.filename:match("%.md") or buf.filename:match("%.txt") + -- end, + -- }, + -- }, + -- }, offsets = { { filetype = "NvimTree", From 85592644ea35611d641884e24ed51aeef1c6bea3 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Thu, 6 Apr 2023 15:35:17 +0700 Subject: [PATCH 62/70] issue #17: cleaner tab and window relation also remove some print command --- lua/doom/modules/features/tabline/init.lua | 8 +++++++- lua/user/modules/features/hydra/init.lua | 1 - 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lua/doom/modules/features/tabline/init.lua b/lua/doom/modules/features/tabline/init.lua index 1e71fe4f..7ad43a54 100644 --- a/lua/doom/modules/features/tabline/init.lua +++ b/lua/doom/modules/features/tabline/init.lua @@ -134,14 +134,20 @@ tabline.packages = { "akinsho/bufferline.nvim", branch = "main", commit = "2d5266d14b7b5dbc54923469b4599f0349f7cedc", - event = "BufAdd", + }, + ["scope.nvim"] = { + "tiagovla/scope.nvim", }, } tabline.configs = {} tabline.configs["bufferline.nvim"] = function() + print("bufferline.nvim setup") require("bufferline").setup(doom.features.tabline.settings) end +tabline.configs["scope.nvim"] = function() + require("scope").setup() +end tabline.binds = { "", diff --git a/lua/user/modules/features/hydra/init.lua b/lua/user/modules/features/hydra/init.lua index d75dcd68..f10cad4b 100644 --- a/lua/user/modules/features/hydra/init.lua +++ b/lua/user/modules/features/hydra/init.lua @@ -48,7 +48,6 @@ M.autocmds = {} -- code for binding: ddom.services.keymaps.applyKeymaps M.window_hydra = function() local Hydra = require("hydra") - print("window_hydra") Hydra({ name = "Windows", mode = "n", From 705a403ad9ff88f27b15a74429072b9189eb1631 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Mon, 10 Apr 2023 11:02:59 +0700 Subject: [PATCH 63/70] Always show tabline, even open only 1 buffer --- lua/doom/modules/features/tabline/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/modules/features/tabline/init.lua b/lua/doom/modules/features/tabline/init.lua index 7ad43a54..ac33120b 100644 --- a/lua/doom/modules/features/tabline/init.lua +++ b/lua/doom/modules/features/tabline/init.lua @@ -86,7 +86,7 @@ tabline.settings = { persist_buffer_sort = true, separator_style = "thick", enforce_regular_tabs = true, - always_show_bufferline = false, + always_show_bufferline = true, sort_by = "directory", custom_areas = { right = function() From d2017e8e0bf5232dcbcca558156c56e76987d959 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Mon, 10 Apr 2023 11:05:17 +0700 Subject: [PATCH 64/70] feat(copilot2): add black and whitelist file types for copilot2 Motivation: Copilot will send data to cloud to analysis. But It's really dangerous for sensitive data. --- lua/user/modules/features/copilot2/init.lua | 39 +++++++++++++++++---- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/lua/user/modules/features/copilot2/init.lua b/lua/user/modules/features/copilot2/init.lua index 6e814558..668aaa64 100644 --- a/lua/user/modules/features/copilot2/init.lua +++ b/lua/user/modules/features/copilot2/init.lua @@ -1,6 +1,15 @@ local M = {} -M.settings = {} +M.settings = { + filetypes_black_list = { + "text", + "csv", + "tsv", + }, + filetypes_white_list = { + "markdown", + }, +} M.packages = { @@ -34,12 +43,28 @@ M.configs = { -- }, -- }, -- }) - vim.defer_fn(function() - require("copilot").setup({ - suggestion = { enabled = false }, - panel = { enabled = false }, - }) - end, 100) + + -- calculate the blacklisted filetypes + local this = doom.features.copilot2 + local filetypes = {} + for _, filetype in ipairs(this.settings.filetypes_black_list) do + filetypes[filetype] = false + end + + for _, filetype in ipairs(this.settings.filetypes_white_list) do + filetypes[filetype] = true + end + + + require("copilot").setup({ + suggestion = { enabled = false }, + panel = { enabled = false }, + filetypes = filetypes, + -- black_list = filetypes, + -- markdown = false, + -- text = false, + -- csv = false, + }) -- require("copilot").setup({ -- suggestion = { enabled = false }, From feaced18083587b479828613e427e365220c1fb1 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Mon, 10 Apr 2023 14:36:33 +0700 Subject: [PATCH 65/70] auto closetab when close neogit --- lua/user/modules/features/git/init.lua | 33 ++++++++++++++++++-------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/lua/user/modules/features/git/init.lua b/lua/user/modules/features/git/init.lua index f5a88e65..5e97ed60 100644 --- a/lua/user/modules/features/git/init.lua +++ b/lua/user/modules/features/git/init.lua @@ -1,7 +1,6 @@ local M = {} -M.settings = { -} +M.settings = {} M.packages = { ["neogit"] = { @@ -12,7 +11,7 @@ M.packages = { }, ["diffview.nvim"] = { "sindrets/diffview.nvim", - requires = 'nvim-lua/plenary.nvim' + requires = "nvim-lua/plenary.nvim", }, ["git-conflict.nvim"] = { "akinsho/git-conflict.nvim", @@ -26,23 +25,36 @@ M.configs = { ["neogit"] = function() require("neogit").setup({ integrations = { - diffview = true + diffview = true, }, }) end, ["git-conflict.nvim"] = function() - require('git-conflict').setup() + require("git-conflict").setup() end, ["gitsigns.nvim"] = function() - require('gitsigns').setup() + require("gitsigns").setup() end, } M.autocmds = { + { + "BufUnload", + "NeogitStatus", + function() + vim.defer_fn(function() + -- code + vim.cmd("tabclose") + -- Neogit auto open a new tab when create but does not clean up the tab when close + -- so we need to close it manually + -- this is a tricky way, but actually this is enough when we wait for a solution from Neogit + -- still bug when open neogit with no "normal" file buffer + end, 100) + end, + }, } -M.cmds = { -} +M.cmds = {} -- TODO: fix bug doom-nvim, so it can load if 'M.bind= {}' M.binds = { @@ -65,6 +77,7 @@ M.binds = { { "g", "Neogit", name = "Neogit" }, { "l", "Telescope git_bcommits", name = "Current buffer logs" }, { "L", "Telescope git_commits", name = "Git Logs" }, - } + }, }, -} return M +} +return M From 4e3103908810d9be1bdcb3a78b183b90f492e6c3 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Tue, 11 Apr 2023 00:03:07 +0700 Subject: [PATCH 66/70] default mode for module key binding if not specify mode, the binding will effective in "nv" (old is "n" only) --- lua/doom/core/modules.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lua/doom/core/modules.lua b/lua/doom/core/modules.lua index 6cddd567..4c5f7b6a 100644 --- a/lua/doom/core/modules.lua +++ b/lua/doom/core/modules.lua @@ -189,8 +189,14 @@ modules.load_modules = function() end if module.binds then + local bind_config = type(module.binds) == "function" and module.binds() or module.binds + if (bind_config.mode == nil) then + bind_config.mode = "nv" + end + keymaps_service.applyKeymaps( - type(module.binds) == "function" and module.binds() or module.binds + -- type(module.binds) == "function" and module.binds() or module.binds + bind_config ) end end From a5bf9d071429a16e019a553ff36915b55ccd86e6 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Tue, 11 Apr 2023 00:45:37 +0700 Subject: [PATCH 67/70] add "g?" shortcut for octo menu in issue buffer --- lua/user/modules/features/github/init.lua | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/lua/user/modules/features/github/init.lua b/lua/user/modules/features/github/init.lua index c557a6b7..f9b33050 100644 --- a/lua/user/modules/features/github/init.lua +++ b/lua/user/modules/features/github/init.lua @@ -91,20 +91,23 @@ M.octo_menu = function() -- wk.register(wk_mappings, opts) end --- M.autocmds = { --- { --- "FileType", --- -- "*", --- "*octo", --- octo_help --- }, --- } +M.autocmds = { + { + "FileType", + "octo", + function() + vim.cmd [[ + map g? :OctoMenu + ]] + end, + }, +} + M.cmds = { { "OctoMenu", function() - print("TestOcto") local github = require("user.modules.features.github") github.octo_menu() From 77c3f30d22b95088e4264b9a0e82da1cac7d3bbd Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Tue, 11 Apr 2023 11:25:09 +0700 Subject: [PATCH 68/70] fix: bug crash when having module with empty module.binds --- lua/doom/core/modules.lua | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lua/doom/core/modules.lua b/lua/doom/core/modules.lua index 4c5f7b6a..575e22df 100644 --- a/lua/doom/core/modules.lua +++ b/lua/doom/core/modules.lua @@ -194,10 +194,16 @@ modules.load_modules = function() bind_config.mode = "nv" end - keymaps_service.applyKeymaps( - -- type(module.binds) == "function" and module.binds() or module.binds - bind_config - ) + if (#bind_config >0) then + keymaps_service.applyKeymaps( + -- type(module.binds) == "function" and module.binds() or module.binds + bind_config + ) + else + -- without assign it to nil, it crashed if a module declare module.binds as an empty collection + -- Not really found the root cause, but this is the easiest way to avoid it + module.binds = nil + end end end profiler.stop(profile_msg) From a9cf7c8f1468bef7a8b9033467877ad3760801ee Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Tue, 11 Apr 2023 11:31:13 +0700 Subject: [PATCH 69/70] Add DO-NOTHING-MODULE for testing purpose --- lua/user/modules/features/nope/init.lua | 50 +++++++++++++++++++++++++ modules.lua | 1 + 2 files changed, 51 insertions(+) create mode 100644 lua/user/modules/features/nope/init.lua diff --git a/lua/user/modules/features/nope/init.lua b/lua/user/modules/features/nope/init.lua new file mode 100644 index 00000000..273a4ebd --- /dev/null +++ b/lua/user/modules/features/nope/init.lua @@ -0,0 +1,50 @@ +-- This is DO-NOTHING load_modules +-- FOr testing api of doom-nvim only purpose +local M = {} + +M.settings = { +} + +M.packages = { + -- ["zen-mode.nvim"] = { + -- "folke/zen-mode.nvim", + -- }, + -- ["vimade"] = { + -- "TaDaa/vimade", + -- }, + +} + +M.configs = { + -- ["zen-mode.nvim"] = function() + -- require("zen-mode").setup { + -- window = { + -- width = 180, + -- } + -- } + -- end, + +} + +M.autocmds = { +} + +M.cmds = { +} +M.binds = { +} +-- M.requires_modules = { "features.auto_install" } +-- M.binds kk +-- { +-- -- { +-- -- "ghw", +-- -- [[HopWord]], +-- -- name = "Go to word in the screen", +-- -- mode = "nv", +-- -- }, +-- } + +-- Notes: +-- code for load module located at doom.core.module.load_modules +-- code for binding: ddom.services.keymaps.applyKeymaps +return M diff --git a/modules.lua b/modules.lua index b93206d1..a649c418 100644 --- a/modules.lua +++ b/modules.lua @@ -70,6 +70,7 @@ return { "mini-util", "session", "hydra", + "nope", -- -- "charcounter", -- custom module test }, From 87c99b15d43c5f927e4a87fa2ee5df2c0f847574 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Thu, 13 Apr 2023 15:24:33 +0700 Subject: [PATCH 70/70] change shortcut for hopchar to "t" Also change foldlevelstart " --- config.lua | 2 +- lua/user/modules/features/navigation/init.lua | 42 +++++++++---------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/config.lua b/config.lua index aadf06a5..8c09b5a4 100644 --- a/config.lua +++ b/config.lua @@ -121,7 +121,7 @@ if doom.features.whichkey ~= nil then end if doom.features.fold ~= nil then - doom.features.fold.settings.foldlevelstart = 3 + doom.features.fold.settings.foldlevelstart = 99 end -- -- -- -- diff --git a/lua/user/modules/features/navigation/init.lua b/lua/user/modules/features/navigation/init.lua index 97d2234f..fefa823f 100644 --- a/lua/user/modules/features/navigation/init.lua +++ b/lua/user/modules/features/navigation/init.lua @@ -10,7 +10,7 @@ M.packages = { -- ["vim-sandwich"] = { -- "machakann/vim-sandwich", -- }, - ["symbols-outline.nvim"] = { "simrat39/symbols-outline.nvim", }, + ["symbols-outline.nvim"] = { "simrat39/symbols-outline.nvim" }, -- ["cutlass.nvim"] = { -- "tuanbass/cutlass.nvim", }, @@ -60,22 +60,24 @@ M.configs = { -- }) -- end, ["telescope-fzf-native.nvim"] = function() - print ('loading fzf for telescope') + print("loading fzf for telescope") -- require('telescope').load_extension('fzf') end, ["better-escape.nvim"] = function() - - - require("better_escape").setup({ - mapping = {"jk", "jj", "kj", "kk"}, -- a table with mappings to use - keys = "", -- keys used for escaping, if it is a function will use the result everytime - }) - + require("better_escape").setup({ + mapping = { "jk", "jj", "kj", "kk" }, -- a table with mappings to use + keys = "", -- keys used for escaping, if it is a function will use the result everytime + }) end, ["hop.nvim"] = function() -- vim.notify("Setting up cutlass plugin", "info") + -- unmap t characters, so we can use it for HopChar + vim.defer_fn(function() + -- vim.cmd("unmap t") + vim.cmd("nmap t HopChar1") + end, 0) require("hop").setup() end, ["vim-expand-region"] = function() @@ -111,20 +113,19 @@ M.configs = { require("symbols-outline").setup() end, ["vim-matchup"] = function() - vim.g.matchup_matchparen_offscreen = {} + vim.g.matchup_matchparen_offscreen = {} end, ["delaytrain.nvim"] = function() - require('delaytrain').setup { - delay_ms = 500, -- How long repeated usage of a key should be prevented - grace_period = 3, -- How many repeated keypresses are allowed - keys = { -- Which keys (in which modes) should be delayed - ['n'] = {'h', 'j', 'k', 'l'}, - -- ['nvi'] = {'', '', '', ''}, - }, - } + require("delaytrain").setup({ + delay_ms = 500, -- How long repeated usage of a key should be prevented + grace_period = 3, -- How many repeated keypresses are allowed + keys = { -- Which keys (in which modes) should be delayed + ["n"] = { "h", "j", "k", "l" }, + -- ['nvi'] = {'', '', '', ''}, + }, + }) -- vim.notify("Setting up cutlass plugin", "info") end, - } M.autocmds = {} @@ -135,7 +136,7 @@ M.binds = { { -- Hop char - "s", + "t", [[HopChar1]], name = "Go to anychar in the screen", mode = "nv", @@ -174,5 +175,4 @@ M.binds = { -- mode = "nv", -- }, } - return M