diff --git a/Daniel_plugin.txt b/Daniel_plugin.txt new file mode 100644 index 000000000..9d60fc6dc --- /dev/null +++ b/Daniel_plugin.txt @@ -0,0 +1,112 @@ +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: 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) + ***• copilot-cmp (not loaded) + ***• copilot.vim + ---• crates.nvim (not loaded): Package managemment for rust. Similar to package-info for javascript + ***• 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) -- Generate code link + +++• gitsigns.nvim + ---• gruvqueen (not loaded) -- theme + ***• 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) : Now : neodev: Support dev in lua (signature, completion, docs). Use LSP instead + +++• markdown-preview.nvim + ---• material.nvim theme + ---• mkdir.nvim + +++• neogen (not loaded) Function doc/comment + +++• 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) 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: Already merged into neovim core + -- • stabilize.nvim -- Neovim plugin to stabilize buffer content on window open/close events. + ---• suda.vim (not loaded): No need, as with "w!", neovim auto chown for the file + -- • surround.nvim + ***• 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) + ---• 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 + *** dense-analysis/ale diff --git a/README.md b/README.md index bd4efdd94..ef0980e12 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 diff --git a/config.lua b/config.lua index 34f21449a..8c09b5a4f 100644 --- a/config.lua +++ b/config.lua @@ -5,18 +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({ +-- ADDING A KEYBIND doom.use_keybind({ -- -- The `name` field will add the keybind to whichkey -- {"s", name = '+search', { -- -- Bind to a vim command @@ -41,4 +37,202 @@ -- { "FileType", "javascript", function() print('This is a javascript file') end } -- }) --- vim: sw=2 sts=2 ts=2 expandtab +-- 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 + doom.langs.lua.settings.disable_lsp = true +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" }, + } + -- 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 + + +-- not hide file with any prifix +doom.features.explorer.settings.filters.custom={} +-- 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 +-- +-- -- +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 = 99 +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", +-- 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 +-- 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.list = true +opt.listchars:append("eol:↴") + +-- tab options +opt.tabstop = 2 +opt.shiftwidth = 4 +opt.expandtab = true +-- +-- confirm when delete +opt.confirm = true +-- +-- 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 +-- +-- ]]) + +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()', + } , +}) diff --git a/lua/doom/core/modules.lua b/lua/doom/core/modules.lua index 00636774f..9ba519474 100644 --- a/lua/doom/core/modules.lua +++ b/lua/doom/core/modules.lua @@ -110,9 +110,21 @@ modules.load_modules = function() end if module.binds then - keymaps_service.applyKeymaps( - type(module.binds) == "function" and module.binds() or module.binds - ) + local bind_config = type(module.binds) == "function" and module.binds() or module.binds + if (bind_config.mode == nil) then + bind_config.mode = "nv" + end + + 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) diff --git a/lua/doom/modules/features/dashboard/init.lua b/lua/doom/modules/features/dashboard/init.lua index 4e4389739..36c86981d 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, }, { diff --git a/lua/doom/modules/features/explorer/init.lua b/lua/doom/modules/features/explorer/init.lua index 7283cd3a7..171f15081 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 000000000..95a5b50ef --- /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 diff --git a/lua/doom/modules/features/indentlines/init.lua b/lua/doom/modules/features/indentlines/init.lua index f7218a6f5..5bd1816c4 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 = "c4c203c3e8a595bc333abaf168fcb10c13ed5fb7", - event = "ColorScheme", + -- event = "ColorScheme", -- No idea why the plugin should be activated when change colorscheme }, } diff --git a/lua/doom/modules/features/lsp/init.lua b/lua/doom/modules/features/lsp/init.lua index 112f2b5a0..913931973 100644 --- a/lua/doom/modules/features/lsp/init.lua +++ b/lua/doom/modules/features/lsp/init.lua @@ -158,6 +158,16 @@ lsp.packages = { }, event = "VeryLazy", }, + ["cmp-cmdline"] = { + "hrsh7th/cmp-cmdline", + commit = "23c51b2a3c00f6abc4e922dbd7c3b9aca6992063", + after = "nvim-cmp", + }, + ["cmp-cmdline"] = { + "hrsh7th/cmp-cmdline", + commit = "23c51b2a3c00f6abc4e922dbd7c3b9aca6992063", + after = "nvim-cmp", + }, } lsp.configs = {} @@ -306,6 +316,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( diff --git a/lua/doom/modules/features/projects/init.lua b/lua/doom/modules/features/projects/init.lua index 656758df9..3dc469a4a 100644 --- a/lua/doom/modules/features/projects/init.lua +++ b/lua/doom/modules/features/projects/init.lua @@ -49,8 +49,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 = { diff --git a/lua/doom/modules/features/tabline/init.lua b/lua/doom/modules/features/tabline/init.lua index f3d20e2ea..ac33120b4 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", @@ -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() @@ -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/doom/modules/features/telescope/init.lua b/lua/doom/modules/features/telescope/init.lua index e42b913e0..5cf6c56b0 100644 --- a/lua/doom/modules/features/telescope/init.lua +++ b/lua/doom/modules/features/telescope/init.lua @@ -43,7 +43,15 @@ telescope.settings = { use_less = true, set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil, }, - extensions = { "mapper" }, + extensions = { + "mapper", + ["ui-select"] = { + -- require("telescope.themes").get_dropdown { } + }, + sessions_picker = { + sessions_dir = vim.fn.stdpath("data") .. "/sessions/", -- same as '/home/user/.local/share/nvim/session' + }, + }, } telescope.packages = { @@ -53,6 +61,24 @@ telescope.packages = { cmd = "Telescope", lazy = true, }, + ["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, + }, + ["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-file-browser.nvim"] = { "nvim-telescope/telescope-file-browser.nvim", commit = "304508fb7bea78e3c0eeddd88c4837501e403ae8", @@ -180,10 +206,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/doom/modules/langs/markdown/init.lua b/lua/doom/modules/langs/markdown/init.lua index a7c95afe0..7a1573ef9 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 diff --git a/lua/doom/modules/langs/typescript/init.lua b/lua/doom/modules/langs/typescript/init.lua index 591015d70..f7fa7e08a 100644 --- a/lua/doom/modules/langs/typescript/init.lua +++ b/lua/doom/modules/langs/typescript/init.lua @@ -23,10 +23,16 @@ typescript.settings = { disable_formatting = false, --- Mason.nvim package to auto install the formatter from --- @type string - formatting_package = "eslint_d", + 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_d", + -- 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, diff --git a/lua/user/modules/char_counter/init.lua b/lua/user/modules/char_counter/init.lua deleted file mode 100644 index 1b8634c1a..000000000 --- a/lua/user/modules/char_counter/init.lua +++ /dev/null @@ -1,119 +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 diff --git a/lua/user/modules/features/copilot/init.lua b/lua/user/modules/features/copilot/init.lua new file mode 100644 index 000000000..9670a74d8 --- /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 diff --git a/lua/user/modules/features/copilot2/init.lua b/lua/user/modules/features/copilot2/init.lua new file mode 100644 index 000000000..668aaa643 --- /dev/null +++ b/lua/user/modules/features/copilot2/init.lua @@ -0,0 +1,93 @@ +local M = {} + +M.settings = { + filetypes_black_list = { + "text", + "csv", + "tsv", + }, + filetypes_white_list = { + "markdown", + }, +} + +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 = "", + -- }, + -- }, + -- }) + + -- 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 }, + -- 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/lua/user/modules/features/entertainments/init.lua b/lua/user/modules/features/entertainments/init.lua new file mode 100644 index 000000000..454ba56b7 --- /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/lua/user/modules/features/fold/init.lua b/lua/user/modules/features/fold/init.lua new file mode 100644 index 000000000..e10d6dab4 --- /dev/null +++ b/lua/user/modules/features/fold/init.lua @@ -0,0 +1,116 @@ +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 = { + { + "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 = { + { + "zv", + [[lua require('ufo.preview'):peekFoldedLinesUnderCursor(true, false) ]], + 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 diff --git a/lua/user/modules/features/git/init.lua b/lua/user/modules/features/git/init.lua new file mode 100644 index 000000000..5e97ed60d --- /dev/null +++ b/lua/user/modules/features/git/init.lua @@ -0,0 +1,83 @@ +local M = {} + +M.settings = {} + +M.packages = { + ["neogit"] = { + "TimUntersberger/neogit", + }, + ["git-blame.nvim"] = { + "f-person/git-blame.nvim", + }, + ["diffview.nvim"] = { + "sindrets/diffview.nvim", + requires = "nvim-lua/plenary.nvim", + }, + ["git-conflict.nvim"] = { + "akinsho/git-conflict.nvim", + }, + ["gitsigns.nvim"] = { + "lewis6991/gitsigns.nvim", + }, +} + +M.configs = { + ["neogit"] = function() + require("neogit").setup({ + integrations = { + diffview = true, + }, + }) + end, + + ["git-conflict.nvim"] = function() + require("git-conflict").setup() + end, + ["gitsigns.nvim"] = function() + 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 = {} + +-- TODO: fix bug doom-nvim, so it can load if 'M.bind= {}' +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 diff --git a/lua/user/modules/features/github/init.lua b/lua/user/modules/features/github/init.lua new file mode 100644 index 000000000..f9b330503 --- /dev/null +++ b/lua/user/modules/features/github/init.lua @@ -0,0 +1,134 @@ +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 = { + + ["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.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 + + 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.autocmds = { + { + "FileType", + "octo", + function() + vim.cmd [[ + map g? :OctoMenu + ]] + end, + }, +} + + +M.cmds = { + { + "OctoMenu", + function() + 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", + [[OctoMenu]], + 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/lua/user/modules/features/github/picker.lua b/lua/user/modules/features/github/picker.lua new file mode 100644 index 000000000..9c713805d --- /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, +} diff --git a/lua/user/modules/features/hydra/init.lua b/lua/user/modules/features/hydra/init.lua new file mode 100644 index 000000000..f10cad4bf --- /dev/null +++ b/lua/user/modules/features/hydra/init.lua @@ -0,0 +1,85 @@ +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") + 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/lua/user/modules/features/mini-util/init.lua b/lua/user/modules/features/mini-util/init.lua new file mode 100644 index 000000000..dea970277 --- /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 new file mode 100644 index 000000000..fefa823f0 --- /dev/null +++ b/lua/user/modules/features/navigation/init.lua @@ -0,0 +1,178 @@ +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 screenvim-telescope/telescope.nvimc:Pn + }, + ["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", + }, + -- ["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 = { + -- ["noice.nvim"] = function() + -- require("noice").setup() + -- end, + + -- ["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 + }) + 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() + 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, + ["ii"] = 1, -- inside indent from mini.nvim + ["ai"] = 1, -- around indent from mini.nvim + -- ["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, + ["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 = {} + +M.cmds = {} + +M.binds = { + + { + -- Hop char + "t", + [[HopChar1]], + name = "Go to anychar in the screen", + mode = "nv", + }, + { + -- Hop char + "", + [[HopChar1]], + name = "Go to anychar in the screen", + mode = "inv", + }, + { + "ghc", + [[HopChar1]], + name = "Go to anychar in the screen", + mode = "nv", + }, + { + "ghw", + [[HopWord]], + name = "Go to word in the screen", + mode = "nv", + }, + { + "w", + [[HopWord]], + 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/nope/init.lua b/lua/user/modules/features/nope/init.lua new file mode 100644 index 000000000..273a4ebd1 --- /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/lua/user/modules/features/refactor/init.lua b/lua/user/modules/features/refactor/init.lua new file mode 100644 index 000000000..06b040066 --- /dev/null +++ b/lua/user/modules/features/refactor/init.lua @@ -0,0 +1,47 @@ +local M = {} + +M.settings = { +} + +M.packages = { + ["refactoring.nvim"] = { + "ThePrimeagen/refactoring.nvim", + }, + -- ["vimade"] = { + -- "TaDaa/vimade", + -- }, + +} + +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") + end + end, + +} + +M.autocmds = { +} + +M.cmds = { +} +-- M.requires_modules = { "features.auto_install" } + +M.binds = { + { + "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 M diff --git a/lua/user/modules/features/scratch/init.lua b/lua/user/modules/features/scratch/init.lua new file mode 100644 index 000000000..167d04f6f --- /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/lua/user/modules/features/session/init.lua b/lua/user/modules/features/session/init.lua new file mode 100644 index 000000000..28d9cf41a --- /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/lua/user/modules/features/templates/init.lua b/lua/user/modules/features/templates/init.lua new file mode 100644 index 000000000..7091a0df8 --- /dev/null +++ b/lua/user/modules/features/templates/init.lua @@ -0,0 +1,65 @@ +-- 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.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/views/init.lua b/lua/user/modules/features/views/init.lua new file mode 100644 index 000000000..88deb8d0e --- /dev/null +++ b/lua/user/modules/features/views/init.lua @@ -0,0 +1,153 @@ +local M = {} + +M.settings = {} + +M.packages = { + ["zen-mode.nvim"] = { + "folke/zen-mode.nvim", + }, + ["vimade"] = { -- fade unfocused buffer + "TaDaa/vimade", + }, + ["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 + "konfekt/vim-scratchpad", + }, + ["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 = { + ["zen-mode.nvim"] = function() + require("zen-mode").setup({ + window = { + width = 180, + }, + }) + 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() + + for _, window in ipairs(windows) do + vim.api.nvim_win_set_buf(window, bufnr) + end + end, + }) + end, +} + +M.autocmds = {} + +M.cmds = { + -- command! BufferKillForce lua require('lvim.core.bufferline').buf_kill('bd', nil, true) + { + "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() + vim.cmd("BDelete! this") + -- vim.cmd(".,$-bdelete") + -- require('close_buffers').delete({ type = 'other' }) + end, + }, + { + "BD2Other", + function() + -- vim.cmd("%bdelete") + vim.cmd("BufferLineCloseLeft") + vim.cmd("BufferLineCloseRight") + end, + }, + { + "BD3All", + function() + -- vim.cmd("%bdelete") + vim.cmd("BD2Other") + vim.cmd("BD1this") + end, + }, + + { + "ToggleScratchPad", + function() + -- vim.cmd("%bdelete") + vim.cmd("echo 'type dsp in normal mode to toggle Scratpad'") + end, + }, +} + +M.binds = { + { + "v", + 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", "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 diff --git a/modules.lua b/modules.lua index 04463a58c..a649c4181 100644 --- a/modules.lua +++ b/modules.lua @@ -1,98 +1,120 @@ --- 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`. return { features = { - -- Language features +-- -- 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", -- Code completion "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 +-- -- +-- -- Editor +-- + -- "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 + "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 - "lsp_progress", -- Check status of LSP loading +-- -- "doom_themes", -- Extra themes for doom +-- +-- -- UI Components "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 - -- "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 +-- "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 +-- -- "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 + "navigation", + "git", + "views", + "fold", + "refactor", + "entertainments", + "scratch", + "github", + -- "copilot", -- Copilot using standard Copilot from github/tpope + "copilot2", -- Copilot using Copilot lua plugin from zbirenbaum + "mini-util", + "session", + "hydra", + "nope", +-- -- "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", - -- "markdown", - -- "terraform", -- Terraform / hcl files support + "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 + -- -- "nix", -- Nix declarations + }, } + + -- vim: sw=2 sts=2 ts=2 fdm=indent expandtab diff --git a/sessions/%Users%connormeehan%.config%nvim.vim b/sessions/%Users%connormeehan%.config%nvim.vim deleted file mode 100644 index 0f1fe11b5..000000000 --- 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 : diff --git a/todo.norg b/todo.norg new file mode 100644 index 000000000..350329041 --- /dev/null +++ b/todo.norg @@ -0,0 +1,36 @@ +@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 +* [x] integrate git-sign into git feature => done +* [x] Error msg when save => done +* [x] mark down lsp (remark) not work +* [x] Markdown preview +* [ ] integrate octo plugin (edit github PR in nvim) +* [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) +* [ ] Luasnip work independly (for golang) +* [ ] copilot +* [x] sometime current line is undeadable because of grey color = +* [ ] Virtual whichkey hint +* [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 +* [ ] 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