diff --git a/lua/custom/configs/settings.lua b/lua/custom/configs/settings.lua index eebf351e..5b558a12 100644 --- a/lua/custom/configs/settings.lua +++ b/lua/custom/configs/settings.lua @@ -37,4 +37,5 @@ o.swapfile = false o.scrolloff = 8 o.colorcolumn = '80' +o.timeoutlen = 500 diff --git a/lua/custom/plugins/README.md b/lua/custom/plugins/README.md index 96b29002..98941963 100644 --- a/lua/custom/plugins/README.md +++ b/lua/custom/plugins/README.md @@ -6,5 +6,30 @@ go install github.com/incu6us/goimports-reviser/v3@latest go install mvdan.cc/gofumpt@latest go install github.com/segmentio/golines@latest + +go install github.com/go-delve/delve/cmd/dlv@latest # for go debug ``` +Substitute Mode +```shell +:V,s/pattern/ +``` + +Check for key combination +```shell +:nmap # show all maps for normal mode +:nmap # show maps for the leader +:verbose nmap # show where the map was last set +:telescope keymaps +``` + +Open new Tab +```shell +wT +``` + +Moving between tabs +```shell +gt # next tab +gT # previous tab +``` diff --git a/lua/custom/plugins/autopairs.lua b/lua/custom/plugins/autopairs.lua new file mode 100644 index 00000000..b45ccc6c --- /dev/null +++ b/lua/custom/plugins/autopairs.lua @@ -0,0 +1,8 @@ +return { + "windwp/nvim-autopairs", + config = function() + require("nvim-autopairs").setup { + disable_filetype = { "TelescopePrompt", "vim" }, + } + end, +} diff --git a/lua/custom/plugins/debug.lua b/lua/custom/plugins/debug.lua new file mode 100644 index 00000000..c6c6ec18 --- /dev/null +++ b/lua/custom/plugins/debug.lua @@ -0,0 +1,92 @@ +-- debug.lua +-- +-- Shows how to use the DAP plugin to debug your code. +-- +-- Primarily focused on configuring the debugger for Go, but can +-- be extended to other languages as well. That's why it's called +-- kickstart.nvim and not kitchen-sink.nvim ;) + +return { + -- NOTE: Yes, you can install new plugins here! + 'mfussenegger/nvim-dap', + -- NOTE: And you can specify dependencies as well + dependencies = { + -- Creates a beautiful debugger UI + 'rcarriga/nvim-dap-ui', + + -- Installs the debug adapters for you + 'williamboman/mason.nvim', + 'jay-babu/mason-nvim-dap.nvim', + + -- Add your own debuggers here + 'leoluz/nvim-dap-go', + + -- telescope dap + 'nvim-telescope/telescope-dap.nvim', + + -- add debug description text + 'theHamsta/nvim-dap-virtual-text', + }, + config = function() + local dap = require 'dap' + local dapui = require 'dapui' + + require('mason-nvim-dap').setup { + -- Makes a best effort to setup the various debuggers with + -- reasonable debug configurations + automatic_setup = true, + + -- You can provide additional configuration to the handlers, + -- see mason-nvim-dap README for more information + handlers = {}, + + -- You'll need to check that you have the required things installed + -- online, please don't ask me how to install them :) + ensure_installed = { + -- Update this to ensure that you have the debuggers for the langs you want + 'delve', + }, + } + + -- Basic debugging keymaps, feel free to change to your liking! + vim.keymap.set('n', '', dap.continue, { desc = 'dap run/continue debug' }) + vim.keymap.set('n', '', dap.step_into, { desc = 'dap step into' }) + vim.keymap.set('n', '', dap.step_over, { desc = 'dap step over' }) + vim.keymap.set('n', '', dap.step_out, { desc = 'dap step out' }) + vim.keymap.set('n', 'b', dap.toggle_breakpoint, { desc = 'dap toggle breakpoint' }) + vim.keymap.set('n', 'B', function() + dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ') + end, { desc = 'dap breakpoint condition' }) + + -- Dap UI setup + -- For more information, see |:help nvim-dap-ui| + dapui.setup { + -- Set icons to characters that are more likely to work in every terminal. + -- Feel free to remove or use ones that you like more! :) + -- Don't feel like these are good choices. + icons = { expanded = '▾', collapsed = '▸', current_frame = '*' }, + controls = { + icons = { + pause = '⏸', + play = '▶', + step_into = '⏎', + step_over = '⏭', + step_out = '⏮', + step_back = 'b', + run_last = '▶▶', + terminate = '⏹', + disconnect = "⏏", + }, + }, + } + -- toggle to see last session result. Without this ,you can't see session output in case of unhandled exception. + vim.keymap.set("n", "", dapui.toggle) + dap.listeners.after.event_initialized['dapui_config'] = dapui.open + dap.listeners.before.event_terminated['dapui_config'] = dapui.close + dap.listeners.before.event_exited['dapui_config'] = dapui.close + + -- Install golang specific config + require('dap-go').setup() + require('nvim-dap-virtual-text').setup() + end, +} diff --git a/lua/custom/plugins/harpoon.lua b/lua/custom/plugins/harpoon.lua index 340ed713..e8e28031 100644 --- a/lua/custom/plugins/harpoon.lua +++ b/lua/custom/plugins/harpoon.lua @@ -3,13 +3,13 @@ return { dependencies = { 'nvim-lua/plenary.nvim' }, config = function () local mark = require('harpoon.mark') - vim.keymap.set("n", "ha", mark.add_file) + vim.keymap.set("n", "ha", mark.add_file, { desc = "[H]arpoon [A]dd file" }) local ui = require('harpoon.ui') - vim.keymap.set("n", "", ui.toggle_quick_menu) - vim.keymap.set("n", "", function() ui.nav_file(1) end) - vim.keymap.set("n", "", function() ui.nav_file(2) end) - vim.keymap.set("n", "", function() ui.nav_file(3) end) - vim.keymap.set("n", "", function() ui.nav_file(4) end) + vim.keymap.set("n", "", ui.toggle_quick_menu, { desc = "harpoon toggle quick menu" }) + vim.keymap.set("n", "", function() ui.nav_file(1) end, { desc = "harpoon add nav file 1" }) + vim.keymap.set("n", "", function() ui.nav_file(2) end, { desc = "harpoon add nav file 2" }) + vim.keymap.set("n", "", function() ui.nav_file(3) end, { desc = "harpoon add nav file 3" }) + vim.keymap.set("n", "", function() ui.nav_file(4) end, { desc = "harpoon add nav file 4" }) end } diff --git a/lua/custom/plugins/neo-tree.lua b/lua/custom/plugins/neo-tree.lua index ae51dd89..5e4a8cf1 100644 --- a/lua/custom/plugins/neo-tree.lua +++ b/lua/custom/plugins/neo-tree.lua @@ -1,19 +1,91 @@ --- You can add your own plugins here or in other files in this directory! --- I promise not to create any merge conflicts in this directory :) --- --- See the kickstart.nvim README for more information - return { "nvim-neo-tree/neo-tree.nvim", version = "*", - dependencies= { + dependencies = { "nvim-lua/plenary.nvim", "nvim-tree/nvim-web-devicons", "MunifTanjim/nui.nvim", }, - config = function () - require('neo-tree').setup {} + config = function() + require('neo-tree').setup { + window = { + position = "float", + popup = { + -- settings that apply to float position only + size = { height = "20", width = "95" }, + -- 50% means center it + position = "50%", + }, + }, + default_component_configs = { + container = { + enable_character_fade = true + }, + indent = { + indent_size = 2, + padding = 1, -- extra padding on left hand side + -- indent guides + with_markers = true, + indent_marker = "│", + last_indent_marker = "└", + highlight = "NeoTreeIndentMarker", + -- expander config, needed for nesting files + with_expanders = nil, -- if nil and file nesting is enabled, will enable expanders + expander_collapsed = "", + expander_expanded = "", + expander_highlight = "NeoTreeExpander", + }, + icon = { + folder_closed = "", + folder_open = "", + folder_empty = "ﰊ", + -- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there + -- then these will never be used. + default = "*", + highlight = "NeoTreeFileIcon" + }, + modified = { + symbol = "[+]", + highlight = "NeoTreeModified", + }, + name = { + trailing_slash = false, + use_git_status_colors = true, + highlight = "NeoTreeFileName", + }, + git_status = { + symbols = { + -- Change type + added = "", -- or "✚", but this is redundant info if you use git_status_colors on the name + modified = "", -- or "", but this is redundant info if you use git_status_colors on the name + deleted = "✖", -- this can only be used in the git_status source + renamed = "󰁕", -- this can only be used in the git_status source + -- Status type + untracked = "", + ignored = "", + unstaged = "󰄱", + staged = "", + conflict = "", + } + }, + }, + filesystem = { + filtered_items = { + visible = true, + hide_dotfiles = false, + show_hidden_count = true, + hide_by_name = { + }, + never_show = { + ".git", + ".idea", + ".DS_Store", + + }, + }, + }, + } vim.keymap.set("n", "nt", "Neotree toggle") vim.keymap.set("n", "o", "Neotree focus") - end + end, } diff --git a/lua/custom/plugins/toggleterm.lua b/lua/custom/plugins/toggleterm.lua index 9835a1f3..4c573a38 100644 --- a/lua/custom/plugins/toggleterm.lua +++ b/lua/custom/plugins/toggleterm.lua @@ -6,7 +6,7 @@ return { term.setup { size = 20, - open_mapping = [[tf]], + open_mapping = [[]], shading_factor = 2, direction = 'float', float_opts = {