diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index cfe3038..e33b580 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,2 +1,2 @@ ---require "lazy" -- my config based on folkes LazyVim starter -require("chris") -- my config based on Christian Chiarullis work +require "lazyvim" -- my config based on folkes LazyVim starter +-- require("chris") -- my config based on Christian Chiarullis work diff --git a/.config/nvim/lua/chris/colorscheme.lua b/.config/nvim/lua/chris/colorscheme.lua index 95f3e92..2031380 100644 --- a/.config/nvim/lua/chris/colorscheme.lua +++ b/.config/nvim/lua/chris/colorscheme.lua @@ -3,8 +3,8 @@ local colorscheme = "base16-gruvbox-dark-medium" local s_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme) if not s_ok then - vim.notify("Colorscheme" .. colorscheme .. " not found!") - return + vim.notify("Colorscheme" .. colorscheme .. " not found!") + return end -- For transperant background diff --git a/.config/nvim/lua/chris/nvim-tree.lua b/.config/nvim/lua/chris/nvim-tree.lua index 02b0e61..eae1996 100644 --- a/.config/nvim/lua/chris/nvim-tree.lua +++ b/.config/nvim/lua/chris/nvim-tree.lua @@ -1,117 +1,117 @@ local status_ok, nvim_tree = pcall(require, "nvim-tree") if not status_ok then - return + return end local config_status_ok, nvim_tree_config = pcall(require, "nvim-tree.config") if not config_status_ok then - return + return end -local icons = require "chris.icons" +local icons = require("chris.icons") local tree_cb = nvim_tree_config.nvim_tree_callback -nvim_tree.setup { - hijack_directories = { - enable = false, - }, - ignore_ft_on_setup = { - "alpha", - }, - filters = { - custom = { ".git" }, - exclude = { ".gitignore" }, - }, - hijack_cursor = false, - update_cwd = true, - renderer = { - add_trailing = false, - group_empty = false, - highlight_git = false, - highlight_opened_files = "none", - root_folder_modifier = ":t", - indent_markers = { - enable = false, - icons = { - corner = "└ ", - edge = "│ ", - none = " ", - }, - }, - icons = { - webdev_colors = true, - git_placement = "before", - padding = " ", - symlink_arrow = " ➛ ", - show = { - file = true, - folder = true, - folder_arrow = true, - git = true, - }, - glyphs = { - default = "", - symlink = "", - folder = { - arrow_open = icons.ui.ArrowOpen, - arrow_closed = icons.ui.ArrowClosed, - default = "", - open = "", - empty = "", - empty_open = "", - symlink = "", - symlink_open = "", - }, - git = { - unstaged = "", - staged = "S", - unmerged = "", - renamed = "➜", - untracked = "U", - deleted = "", - ignored = "◌", - }, - }, - }, - }, - diagnostics = { - enable = true, - icons = { - hint = icons.diagnostics.Hint, - info = icons.diagnostics.Information, - warning = icons.diagnostics.Warning, - error = icons.diagnostics.Error, - }, - }, - update_focused_file = { - enable = true, - update_cwd = true, - ignore_list = {}, - }, - git = { - enable = true, - ignore = true, - timeout = 500, - }, - view = { - width = 30, - hide_root_folder = false, - side = "left", - mappings = { - custom_only = false, - list = { - { key = { "l", "", "o" }, cb = tree_cb "edit" }, - { key = "h", cb = tree_cb "close_node" }, - { key = "v", cb = tree_cb "vsplit" }, - }, - }, - number = false, - relativenumber = false, - }, - actions = { - open_file = { - quit_on_open = true, - } - } -} +nvim_tree.setup({ + hijack_directories = { + enable = false, + }, + ignore_ft_on_setup = { + "alpha", + }, + filters = { + custom = { ".git" }, + exclude = { ".gitignore" }, + }, + hijack_cursor = false, + update_cwd = true, + renderer = { + add_trailing = false, + group_empty = false, + highlight_git = false, + highlight_opened_files = "none", + root_folder_modifier = ":t", + indent_markers = { + enable = false, + icons = { + corner = "└ ", + edge = "│ ", + none = " ", + }, + }, + icons = { + webdev_colors = true, + git_placement = "before", + padding = " ", + symlink_arrow = " ➛ ", + show = { + file = true, + folder = true, + folder_arrow = true, + git = true, + }, + glyphs = { + default = "", + symlink = "", + folder = { + arrow_open = icons.ui.ArrowOpen, + arrow_closed = icons.ui.ArrowClosed, + default = "", + open = "", + empty = "", + empty_open = "", + symlink = "", + symlink_open = "", + }, + git = { + unstaged = "", + staged = "S", + unmerged = "", + renamed = "➜", + untracked = "U", + deleted = "", + ignored = "◌", + }, + }, + }, + }, + diagnostics = { + enable = true, + icons = { + hint = icons.diagnostics.Hint, + info = icons.diagnostics.Information, + warning = icons.diagnostics.Warning, + error = icons.diagnostics.Error, + }, + }, + update_focused_file = { + enable = true, + update_cwd = true, + ignore_list = {}, + }, + git = { + enable = true, + ignore = true, + timeout = 500, + }, + view = { + width = 30, + hide_root_folder = false, + side = "left", + mappings = { + custom_only = false, + list = { + { key = { "l", "", "o" }, cb = tree_cb("edit") }, + { key = "h", cb = tree_cb("close_node") }, + { key = "v", cb = tree_cb("vsplit") }, + }, + }, + number = false, + relativenumber = false, + }, + actions = { + open_file = { + quit_on_open = true, + }, + }, +}) diff --git a/.config/nvim/lua/lazy/config/options.lua b/.config/nvim/lua/lazy/config/options.lua deleted file mode 100644 index b81deec..0000000 --- a/.config/nvim/lua/lazy/config/options.lua +++ /dev/null @@ -1,66 +0,0 @@ -vim.g.mapleader = " " -vim.g.maplocalleader = " " - -local options = { - backup = false, -- creates a backup file - clipboard = "unnamedplus", -- gives nvim access to clipboard - cmdheight = 1, -- more space in nvim cmd line - completeopt = { "menuone", "noselect" }, -- cmp related - conceallevel = 3, -- don't hide `` in md - fileencoding = "utf-8", - hlsearch = false, - ignorecase = true, - mouse = "a", -- allow use of mouse (bad I know but sometimes useful) - pumheight = 10, -- popup menu height - showmode = true, - smartcase = true, - smartindent = true, - splitbelow = true, - splitright = true, - swapfile = false, - termguicolors = true, - timeoutlen = 500, - ttimeoutlen = 10, - undofile = true, - updatetime = 100, - writebackup = false, - expandtab = true, -- use spaces instead of tab - shiftwidth = 4, -- insert 4 spaces for indentation - tabstop = 4, -- insert 4 spaces for tab - cursorline = false, - number = true, - laststatus = 3, - showcmd = false, - ruler = false, - relativenumber = true, - numberwidth = 2, - signcolumn = "yes", - wrap = false, - scrolloff = 8, - sidescrolloff = 8, - guifont = "monospace:h17", - title = true, - spelllang = "en_us", - autowrite = true, - confirm = true, - formatoptions = "jcroqlnt", -- tcqj - grepformat = "%f:%l:%c:%m", - grepprg = "rg --vimgrep", - guifont = "FiraCode Nerd Font:h11", - -} - -vim.opt.fillchars = vim.opt.fillchars + 'eob: ' - -vim.opt.shortmess:append "c" - -for k, v in pairs(options) do - vim.opt[k] = v -end - -vim.cmd "set whichwrap+=<,>,[,],h,l" -vim.cmd "set colorcolumn=80" -vim.cmd [[set iskeyword+=-]] - --- fix markdown indentation settings -vim.g.markdown_recommended_style = 0 diff --git a/.config/nvim/lua/lazy/plugins/config.lua b/.config/nvim/lua/lazy/plugins/config.lua deleted file mode 100644 index c80a8bb..0000000 --- a/.config/nvim/lua/lazy/plugins/config.lua +++ /dev/null @@ -1,33 +0,0 @@ -local function load(name) - local Util = require("lazy.core.util") - -- always load lazyvim, then user file - for _, mod in ipairs({ "lazy.config." .. name, "config." .. name }) do - Util.try(function() - require(mod) - end, { - msg = "Failed loading " .. mod, - on_error = function(msg) - local modpath = require("lazy.core.cache").find(mod) - if modpath then - Util.error(msg) - end - end, - }) - end -end - --- load options here, before lazy init while sourcing plugin modules --- this is needed to make sure options will be correctly applied --- after installing missing plugins -load("options") - --- autocmds and keymaps can wait to load -vim.api.nvim_create_autocmd("User", { - pattern = "VeryLazy", - callback = function() - load("autocmds") - load("keymaps") - end, -}) - -return {} diff --git a/.config/nvim/lua/lazy/plugins/editor.lua b/.config/nvim/lua/lazy/plugins/editor.lua deleted file mode 100644 index d04c43f..0000000 --- a/.config/nvim/lua/lazy/plugins/editor.lua +++ /dev/null @@ -1,268 +0,0 @@ -local util = require"lazy.functions" - -return { - { - "kyazdani42/nvim-tree.lua", - config = function() - local nvim_tree_config = require"nvim-tree.config" - local icons = require "user.icons" - - local tree_cb = nvim_tree_config.nvim_tree_callback - - nvim_tree.setup { - hijack_directories = { - enable = false, - }, - ignore_ft_on_setup = { - "alpha", - }, - filters = { - custom = { ".git" }, - exclude = { ".gitignore" }, - }, - hijack_cursor = false, - update_cwd = true, - renderer = { - add_trailing = false, - group_empty = false, - highlight_git = false, - highlight_opened_files = "none", - root_folder_modifier = ":t", - indent_markers = { - enable = false, - icons = { - corner = "└ ", - edge = "│ ", - none = " ", - }, - }, - icons = { - webdev_colors = true, - git_placement = "before", - padding = " ", - symlink_arrow = " ➛ ", - show = { - file = true, - folder = true, - folder_arrow = true, - git = true, - }, - glyphs = { - default = "", - symlink = "", - folder = { - arrow_open = icons.ui.ArrowOpen, - arrow_closed = icons.ui.ArrowClosed, - default = "", - open = "", - empty = "", - empty_open = "", - symlink = "", - symlink_open = "", - }, - git = { - unstaged = "", - staged = "S", - unmerged = "", - renamed = "➜", - untracked = "U", - deleted = "", - ignored = "◌", - }, - }, - }, - }, - diagnostics = { - enable = true, - icons = { - hint = icons.diagnostics.Hint, - info = icons.diagnostics.Information, - warning = icons.diagnostics.Warning, - error = icons.diagnostics.Error, - }, - }, - update_focused_file = { - enable = true, - update_cwd = true, - ignore_list = {}, - }, - git = { - enable = true, - ignore = true, - timeout = 500, - }, - view = { - width = 30, - hide_root_folder = false, - side = "left", - mappings = { - custom_only = false, - list = { - { key = { "l", "", "o" }, cb = tree_cb "edit" }, - { key = "h", cb = tree_cb "close_node" }, - { key = "v", cb = tree_cb "vsplit" }, - }, - }, - number = false, - relativenumber = false, - }, - actions = { - open_file = { - quit_on_open = true, - } - } - } - end, - }, - { - "windwp/nvim-spectre", - -- stylua: ignore - keys = { - { "sr", function() require("spectre").open() end, desc = "Replace in files (Spectre)" }, - }, - }, - { - "nvim-telescope/telescope.nvim", - cmd = "Telescope", - keys = { - { "/", util.telescope("live_grep"), desc = "Find in Files (Grep)" }, - { "", util.telescope("find_files"), desc = "Find Files (root dir)" }, - { "fb", "Telescope buffers", desc = "Buffers" }, - { "ff", util.telescope("find_files"), desc = "Find Files (root dir)" }, - { "fF", util.telescope("find_files", { cwd = false }), desc = "Find Files (cwd)" }, - { "fr", "Telescope oldfiles", desc = "Recent" }, - { "gc", "Telescope git_commits", desc = "commits" }, - { "gs", "Telescope git_status", desc = "status" }, - { "ha", "Telescope autocommands", desc = "Auto Commands" }, - { "hc", "Telescope commands", desc = "Commands" }, - { "hf", "Telescope filetypes", desc = "File Types" }, - { "hh", "Telescope help_tags", desc = "Help Pages" }, - { "hk", "Telescope keymaps", desc = "Key Maps" }, - { "hm", "Telescope man_pages", desc = "Man Pages" }, - { "ho", "Telescope vim_options", desc = "Options" }, - { "hs", "Telescope highlights", desc = "Search Highlight Groups" }, - { "ht", "Telescope builtin", desc = "Telescope" }, - { "sb", "Telescope current_buffer_fuzzy_find", desc = "Buffer" }, - { "sc", "Telescope command_history", desc = "Command History" }, - { "sg", util.telescope("live_grep"), desc = "Grep (root dir)" }, - { "sG", util.telescope("live_grep", { cwd = false }), desc = "Grep (cwd)" }, - { "sm", "Telescope marks", desc = "Jump to Mark" }, - { ",", "Telescope buffers show_all_buffers=true", desc = "Switch Buffer" }, - { ":", "Telescope command_history", desc = "Command History" }, - { - "ss", - util.telescope("lsp_document_symbols", { - symbols = { - "Class", - "Function", - "Method", - "Constructor", - "Interface", - "Module", - "Struct", - "Trait", - "Field", - "Property", - }, - }), - desc = "Goto Symbol", - }, - }, - config = { - defaults = { - prompt_prefix = " ", - selection_caret = " ", - mappings = { - i = { - [""] = function(...) - return require("trouble.providers.telescope").open_with_trouble(...) - end, - [""] = function() - util.telescope("find_files", { no_ignore = true })() - end, - [""] = function() - util.telescope("find_files", { hidden = true })() - end, - [""] = function(...) - return require("telescope.actions").cycle_history_next(...) - end, - [""] = function(...) - return require("telescope.actions").cycle_history_prev(...) - end, - }, - }, - }, - }, - }, -{ - "folke/which-key.nvim", - event = "VeryLazy", - config = function() - local wk = require("which-key") - wk.setup({ - plugins = { spelling = true }, - key_labels = { [""] = "SPC" }, - }) - wk.register({ - mode = { "n", "v" }, - ["g"] = { name = "+goto" }, - ["]"] = { name = "+next" }, - ["["] = { name = "+prev" }, - ["b"] = { name = "+buffer" }, - ["c"] = { name = "+code" }, - ["f"] = { name = "+file" }, - ["g"] = { name = "+git" }, - ["h"] = { name = "+help" }, - ["n"] = { name = "+noice" }, - ["o"] = { name = "+open" }, - ["q"] = { name = "+quit/session" }, - ["s"] = { name = "+search" }, - ["t"] = { name = "+toggle" }, - ["x"] = { name = "+diagnostics/quickfix" }, - ["w"] = { name = "+windows" }, - [""] = { name = "+tabs" }, - }) - end, - }, -{ - "RRethy/vim-illuminate", - event = "BufReadPost", - config = function() - require("illuminate").configure({ delay = 200 }) - end, - -- stylua: ignore - keys = { - { "]]", function() require("illuminate").goto_next_reference(false) end, desc = "Next Reference", }, - { "[[", function() require("illuminate").goto_prev_reference(false) end, desc = "Prev Reference" }, - }, - }, - { - "folke/trouble.nvim", - cmd = { "TroubleToggle", "Trouble" }, - config = { use_diagnostic_signs = true }, - keys = { - { "xx", "TroubleToggle document_diagnostics", desc = "Document Diagnostics (Trouble)" }, - { "xX", "TroubleToggle workspace_diagnostics", desc = "Workspace Diagnostics (Trouble)" }, - }, - }, - { - "folke/todo-comments.nvim", - cmd = { "TodoTrouble", "TodoTelescope" }, - event = "BufReadPost", - config = true, - -- stylua: ignore - keys = { - { "]t", function() require("todo-comments").jump_next() end, desc = "Next todo comment" }, - { "[t", function() require("todo-comments").jump_prev() end, desc = "Previous todo comment" }, - { "xt", "TodoTrouble", desc = "Todo Trouble" }, - { "xtt", "TodoTrouble keywords=TODO,FIX,FIXME", desc = "Todo Trouble" }, - { "xT", "TodoTelescope", desc = "Todo Telescope" }, - }, - }, - { - "numToStr/Comment.nvim", - config = function() - require"Comment".setup({}) - end, - }, -} diff --git a/.config/nvim/lua/lazy/plugins/noice.lua b/.config/nvim/lua/lazy/plugins/noice.lua deleted file mode 100644 index d2b2a3f..0000000 --- a/.config/nvim/lua/lazy/plugins/noice.lua +++ /dev/null @@ -1,28 +0,0 @@ -return { - { - "folke/noice.nvim", - event = "VeryLazy", - config = { - lsp = { - override = { - ["vim.lsp.util.convert_input_to_markdown_lines"] = true, - ["vim.lsp.util.stylize_markdown"] = true, - }, - }, - presets = { - bottom_search = true, - command_palette = true, - long_message_to_split = true, - }, - }, - -- stylua: ignore - keys = { - { "", function() require("noice").redirect(vim.fn.getcmdline()) end, mode = "c", desc = "Redirect Cmdline" }, - { "nl", function() require("noice").cmd("last") end, desc = "Noice Last Message" }, - { "nh", function() require("noice").cmd("history") end, desc = "Noice History" }, - { "na", function() require("noice").cmd("all") end, desc = "Noice All" }, - { "", function() if not require("noice.lsp").scroll(4) then return "" end end, silent = true, expr = true }, - { "", function() if not require("noice.lsp").scroll(-4) then return "" end end, silent = true, expr = true }, - }, - }, -} diff --git a/.config/nvim/lua/lazy/plugins/utility.lua b/.config/nvim/lua/lazy/plugins/utility.lua deleted file mode 100644 index 188bd67..0000000 --- a/.config/nvim/lua/lazy/plugins/utility.lua +++ /dev/null @@ -1,274 +0,0 @@ -return { - { - "nvim-lua/plenary.nvim", - }, - { - "nvim-lua/popup.nvim", - }, - { - "folke/neodev.nvim", - }, - { - "rcarriga/nvim-notify", - config = function() - local icons = require "user.icons" - require"notify".setup { - -- Animation style (see below for details) - stages = "fade_in_slide_out", - - -- Function called when a new window is opened, use for changing win settings/config - on_open = nil, - - -- Function called when a window is closed - on_close = nil, - - -- Render function for notifications. See notify-render() - render = "default", - - -- Default timeout for notifications - timeout = 2000, - - -- For stages that change opacity this is treated as the highlight behind the window - -- Set this to either a highlight group or an RGB hex value e.g. "#000000" - background_colour = "Normal", - - -- Minimum width for notification windows - minimum_width = 10, - - -- Icons for the different levels - icons = { - ERROR = icons.diagnostics.Error, - WARN = icons.diagnostics.Warning, - INFO = icons.diagnostics.Information, - DEBUG = icons.ui.Bug, - TRACE = icons.ui.Pencil, - }, - } - end, - }, - { - "moll/vim-bbye", - }, - { - "lewis6991/impatient.nvim", - config = function() - require"impatient".enable_profile() - end, - }, - { - "ghillb/cybu.nvim", - config = function() - require"cybu".setup({ - position = { - relative_to = "win", -- win, editor, cursor - anchor = "topright", -- topleft, topcenter, topright, - -- centerleft, center, centerright, - -- bottomleft, bottomcenter, bottomright - -- vertical_offset = 10, -- vertical offset from anchor in lines - -- horizontal_offset = 0, -- vertical offset from anchor in columns - -- max_win_height = 5, -- height of cybu window in lines - -- max_win_width = 0.5, -- integer for absolute in columns - -- float for relative to win/editor width - }, - display_time = 1750, -- time the cybu window is displayed - style = { - separator = " ", -- string used as separator - prefix = "…", -- string used as prefix for truncated paths - padding = 1, -- left & right padding in number of spaces - hide_buffer_id = true, - devicons = { - enabled = true, -- enable or disable web dev icons - colored = true, -- enable color for web dev icons - }, - }, - }) - end, - }, - { - "mbbill/undotree", - }, - { - "MunifTanjim/nui.nvim", - }, - { - "kyazdani42/nvim-web-devicons" - }, - { - "lukas-reineke/indent-blankline.nvim", - config = function() - vim.g.indent_blankline_buftype_exclude = { "terminal", "nofile" } - vim.g.indent_blankline_filetype_exclude = { - "help", - "startify", - "dashboard", - "packer", - "neogitstatus", - "NvimTree", - "Trouble", - "text" - } - vim.g.indentLine_enabled = 1 - vim.g.indent_blankline_char = "▏" - - vim.g.indent_blankline_show_trailing_blankline_indent = false - vim.g.indent_blankline_show_first_indent_level = true - vim.g.indent_blankline_use_treesitter = false - vim.g.indent_blankline_show_current_context = true - - require"indent_blankline".setup({ - show_current_context = true, - }) - end, - }, - { - "windwp/nvim-autopairs", - config = function() - require"nvim-autopairs".setup({ - disable_filetype = { "TelescopePrompt", "spectre_panel" }, - ignore_next_char = "[%w%.*]", -- don't place pair when cursor sits in front of any char - }) - end, - }, - { - "preservim/vim-markdown", - }, - { - "nacro90/numb.nvim", - config = function() - require"numb".setup({ - show_numbers = true, -- enable 'number' for the window while peeking - show_cursorline = true, -- enable 'cursorline' for window wdile peeking - }) - end, - }, - { - "andymass/vim-matchup", - }, - { - "junegunn/vim-slash", - }, - { - "folke/zen-mode.nvim", - config = function() - require"zen-mode".setup({ - window = { - backdrop = 1, - height = 0.9, - width = 80, - options = { - signcolumn = "no", - number = false, - relativenumber = false, - cursorline = true, - cursorcolumn = false, -- disable cursor column - }, - }, - plugins = { - gitsigns = { enabled = false }, - tmux = { enabled = false }, - twilight = { enabled = false }, - }, - on_open = function() - vim.g.cmp_active = false - vim.cmd [[LspStop]] - local status_ok, _ = pcall(vim.api.nvim_set_option_value, "winbar", nil, { scope = "local" }) - if not status_ok then - return - end - if vim.fn.exists("#" .. "_winbar") == 1 then - vim.cmd("au! " .. "_winbar") - end - end, - on_close = function() - vim.g.cmp_active = true - vim.cmd [[LspStart]] - require("user.winbar").create_winbar() - end, - }) - end, - }, - { - "tpope/vim-surround", - }, - { - "danymat/neogen", - config = function() - require"neogen".setup({ - enabled = true, - input_after_comment = true, - }) - end, - }, - { - "monaqa/dial.nvim", - config = function() - local dial_config = require"dial.config" - - local y = "2024/05/29" - - local augend = require "dial.augend" - dial_config.augends:register_group { - default = { - augend.integer.alias.decimal, - augend.integer.alias.hex, - augend.date.alias["%Y/%m/%d"], - }, - typescript = { - augend.integer.alias.decimal, - augend.integer.alias.hex, - augend.constant.new { elements = { "let", "const" } }, - }, - visual = { - augend.integer.alias.decimal, - augend.integer.alias.hex, - augend.date.alias["%Y/%m/%d"], - augend.constant.alias.alpha, - augend.constant.alias.Alpha, - }, - mygroup = { - augend.constant.new { - elements = { "and", "or" }, - word = true, -- if false, "sand" is incremented into "sor", "doctor" into "doctand", etc. - cyclic = true, -- "or" is incremented into "and". - }, - augend.constant.new { - elements = { "True", "False" }, - word = true, - cyclic = true, - }, - augend.constant.new { - elements = { "public", "private" }, - word = true, - cyclic = true, - }, - augend.constant.new { - elements = { "&&", "||" }, - word = false, - cyclic = true, - }, - augend.date.alias["%d/%m/%Y"], -- date (02/19/2022, etc.) - augend.constant.alias.bool, -- boolean value (true <-> false) - augend.integer.alias.decimal, - augend.integer.alias.hex, - augend.semver.alias.semver - }, - } - - local map = require "dial.map" - - -- change augends in VISUAL mode - vim.api.nvim_set_keymap("n", "", map.inc_normal "mygroup", { noremap = true }) - vim.api.nvim_set_keymap("n", "", map.dec_normal "mygroup", { noremap = true }) - vim.api.nvim_set_keymap("v", "", map.inc_normal "visual", { noremap = true }) - vim.api.nvim_set_keymap("v", "", map.dec_normal "visual", { noremap = true }) - - vim.cmd [[ - " enable only for specific FileType - autocmd FileType typescript,javascript lua vim.api.nvim_buf_set_keymap(0, "n", "", require("dial.map").inc_normal("typescript"), {noremap = true}) - ]] - end, - }, - { - "ThePrimeagen/harpoon", - }, -} diff --git a/.config/nvim/lua/lazy/config/autocmd.lua b/.config/nvim/lua/lazyvim/config/autocmd.lua similarity index 100% rename from .config/nvim/lua/lazy/config/autocmd.lua rename to .config/nvim/lua/lazyvim/config/autocmd.lua diff --git a/.config/nvim/lua/lazy/config/icons.lua b/.config/nvim/lua/lazyvim/config/icons.lua similarity index 100% rename from .config/nvim/lua/lazy/config/icons.lua rename to .config/nvim/lua/lazyvim/config/icons.lua diff --git a/.config/nvim/lua/lazy/config/keymaps.lua b/.config/nvim/lua/lazyvim/config/keymaps.lua similarity index 96% rename from .config/nvim/lua/lazy/config/keymaps.lua rename to .config/nvim/lua/lazyvim/config/keymaps.lua index 8727e95..7e82d6b 100644 --- a/.config/nvim/lua/lazy/config/keymaps.lua +++ b/.config/nvim/lua/lazyvim/config/keymaps.lua @@ -2,6 +2,8 @@ local opts = { noremap = true, silent = true } local map = vim.api.nvim_set_keymap +map("n", "", "", opts) + -- NORMAL -- Move text up and down map("n", "", ":m .-2==", opts) diff --git a/.config/nvim/lua/lazyvim/config/options.lua b/.config/nvim/lua/lazyvim/config/options.lua new file mode 100644 index 0000000..fb1e394 --- /dev/null +++ b/.config/nvim/lua/lazyvim/config/options.lua @@ -0,0 +1,64 @@ +vim.g.mapleader = " " +vim.g.maplocalleader = " " + +local options = { + backup = false, -- creates a backup file + clipboard = "unnamedplus", -- gives nvim access to clipboard + cmdheight = 1, -- more space in nvim cmd line + completeopt = { "menuone", "noselect" }, -- cmp related + conceallevel = 3, -- don't hide `` in md + fileencoding = "utf-8", + hlsearch = false, + ignorecase = true, + mouse = "a", -- allow use of mouse (bad I know but sometimes useful) + pumheight = 10, -- popup menu height + showmode = true, + smartcase = true, + smartindent = true, + splitbelow = true, + splitright = true, + swapfile = false, + termguicolors = true, + timeoutlen = 500, + ttimeoutlen = 10, + undofile = true, + updatetime = 100, + writebackup = false, + expandtab = true, -- use spaces instead of tab + shiftwidth = 4, -- insert 4 spaces for indentation + tabstop = 4, -- insert 4 spaces for tab + cursorline = false, + number = true, + laststatus = 3, + showcmd = false, + ruler = false, + relativenumber = true, + numberwidth = 2, + signcolumn = "yes", + wrap = false, + scrolloff = 8, + sidescrolloff = 8, + guifont = "monospace:h17", + title = true, + spelllang = "en_us", + autowrite = true, + confirm = true, + formatoptions = "jcroqlnt", -- tcqj + grepformat = "%f:%l:%c:%m", + grepprg = "rg --vimgrep", +} + +vim.opt.fillchars = vim.opt.fillchars + "eob: " + +vim.opt.shortmess:append("c") + +for k, v in pairs(options) do + vim.opt[k] = v +end + +vim.cmd("set whichwrap+=<,>,[,],h,l") +vim.cmd("set colorcolumn=80") +vim.cmd([[set iskeyword+=-]]) + +-- fix markdown indentation settings +vim.g.markdown_recommended_style = 0 diff --git a/.config/nvim/lua/lazy/functions.lua b/.config/nvim/lua/lazyvim/functions.lua similarity index 100% rename from .config/nvim/lua/lazy/functions.lua rename to .config/nvim/lua/lazyvim/functions.lua diff --git a/.config/nvim/lua/lazy/init.lua b/.config/nvim/lua/lazyvim/init.lua similarity index 74% rename from .config/nvim/lua/lazy/init.lua rename to .config/nvim/lua/lazyvim/init.lua index 538580d..4270c00 100644 --- a/.config/nvim/lua/lazy/init.lua +++ b/.config/nvim/lua/lazyvim/init.lua @@ -14,7 +14,7 @@ end vim.opt.rtp:prepend(vim.env.LAZY or lazypath) require("lazy").setup({ - spec = "lazy.plugins", + spec = "lazyvim.plugins", defaults = { lazy = true, version = "*" }, checker = { enabled = true }, performance = { @@ -35,4 +35,10 @@ require("lazy").setup({ vim.keymap.set("n", "l", ":Lazy") -vim.cmd("colorscheme base16-gruvbox-dark-medium") +local colorscheme = "base16-gruvbox-dark-medium" + +local okay, _ = pcall(vim.cmd, "colorscheme " .. colorscheme) + +if not okay then + vim.notify("Colorscheme " .. colorscheme .. " not found!") +end diff --git a/.config/nvim/lua/lazy/plugins/alpha.lua b/.config/nvim/lua/lazyvim/plugins/alpha.lua similarity index 100% rename from .config/nvim/lua/lazy/plugins/alpha.lua rename to .config/nvim/lua/lazyvim/plugins/alpha.lua diff --git a/.config/nvim/lua/lazy/plugins/cmp.lua b/.config/nvim/lua/lazyvim/plugins/cmp.lua similarity index 91% rename from .config/nvim/lua/lazy/plugins/cmp.lua rename to .config/nvim/lua/lazyvim/plugins/cmp.lua index 9dc74bb..04733f5 100644 --- a/.config/nvim/lua/lazy/plugins/cmp.lua +++ b/.config/nvim/lua/lazyvim/plugins/cmp.lua @@ -36,9 +36,9 @@ return { }), formatting = { format = function(_, item) - local icons = require("lazy.config.icons").kinds + local icons = require("lazyvim.config.icons").kind if icons[item.kind] then - item.kind = icons[item.kind] .. item.kind + item.kind = icons[item.kind] .. " " .. item.kind end return item end, diff --git a/.config/nvim/lua/lazy/plugins/color.lua b/.config/nvim/lua/lazyvim/plugins/color.lua similarity index 100% rename from .config/nvim/lua/lazy/plugins/color.lua rename to .config/nvim/lua/lazyvim/plugins/color.lua diff --git a/.config/nvim/lua/lazyvim/plugins/config.lua b/.config/nvim/lua/lazyvim/plugins/config.lua new file mode 100644 index 0000000..cf169d8 --- /dev/null +++ b/.config/nvim/lua/lazyvim/plugins/config.lua @@ -0,0 +1,33 @@ +local function load(name) + local Util = require("lazy.core.util") + -- always load lazyvim, then user file + for _, mod in ipairs({ "lazyvim.config." .. name, "config." .. name }) do + Util.try(function() + require(mod) + end, { + msg = "Failed loading " .. mod, + on_error = function(msg) + local modpath = require("lazy.core.cache").find(mod) + if modpath then + Util.error(msg) + end + end, + }) + end +end + +-- load options here, before lazy init while sourcing plugin modules +-- this is needed to make sure options will be correctly applied +-- after installing missing plugins +load("options") + +-- autocmds and keymaps can wait to load +vim.api.nvim_create_autocmd("User", { + pattern = "VeryLazy", + callback = function() + load("autocmds") + load("keymaps") + end, +}) + +return {} diff --git a/.config/nvim/lua/lazyvim/plugins/core.lua b/.config/nvim/lua/lazyvim/plugins/core.lua new file mode 100644 index 0000000..3d66252 --- /dev/null +++ b/.config/nvim/lua/lazyvim/plugins/core.lua @@ -0,0 +1,5 @@ +return { + { + "folke/lazy.nvim" + }, +} diff --git a/.config/nvim/lua/lazy/plugins/dressing.lua b/.config/nvim/lua/lazyvim/plugins/dressing.lua similarity index 100% rename from .config/nvim/lua/lazy/plugins/dressing.lua rename to .config/nvim/lua/lazyvim/plugins/dressing.lua diff --git a/.config/nvim/lua/lazyvim/plugins/editor.lua b/.config/nvim/lua/lazyvim/plugins/editor.lua new file mode 100644 index 0000000..c87558c --- /dev/null +++ b/.config/nvim/lua/lazyvim/plugins/editor.lua @@ -0,0 +1,228 @@ +local util = require("lazyvim.functions") + +return { + { + "kyazdani42/nvim-tree.lua", + cmd = "NvimTreeToggle", + config = function() + local nvim_tree = require("nvim-tree") + local nvim_tree_config = require("nvim-tree.config") + local icons = require("lazyvim.config.icons") + + local tree_cb = nvim_tree_config.nvim_tree_callback + + nvim_tree.setup({ + hijack_directories = { + enable = false, + }, + ignore_ft_on_setup = { + "alpha", + }, + filters = { + custom = { ".git" }, + exclude = { ".gitignore" }, + }, + hijack_cursor = false, + update_cwd = true, + renderer = { + add_trailing = false, + group_empty = false, + highlight_git = false, + highlight_opened_files = "none", + root_folder_modifier = ":t", + indent_markers = { + enable = false, + icons = { + corner = "└ ", + edge = "│ ", + none = " ", + }, + }, + icons = { + webdev_colors = true, + git_placement = "before", + padding = " ", + symlink_arrow = " ➛ ", + show = { + file = true, + folder = true, + folder_arrow = true, + git = true, + }, + glyphs = { + default = "", + symlink = "", + folder = { + arrow_open = icons.ui.ArrowOpen, + arrow_closed = icons.ui.ArrowClosed, + default = "", + open = "", + empty = "", + empty_open = "", + symlink = "", + symlink_open = "", + }, + git = { + unstaged = "", + staged = "S", + unmerged = "", + renamed = "➜", + untracked = "U", + deleted = "", + ignored = "◌", + }, + }, + }, + }, + diagnostics = { + enable = true, + icons = { + hint = icons.diagnostics.Hint, + info = icons.diagnostics.Information, + warning = icons.diagnostics.Warning, + error = icons.diagnostics.Error, + }, + }, + update_focused_file = { + enable = true, + update_cwd = true, + ignore_list = {}, + }, + git = { + enable = true, + ignore = true, + timeout = 500, + }, + view = { + width = 30, + hide_root_folder = false, + side = "left", + mappings = { + custom_only = false, + list = { + { key = { "l", "", "o" }, cb = tree_cb("edit") }, + { key = "h", cb = tree_cb("close_node") }, + { key = "v", cb = tree_cb("vsplit") }, + }, + }, + number = false, + relativenumber = false, + }, + actions = { + open_file = { + quit_on_open = true, + }, + }, + }) + end, + }, + { + "windwp/nvim-spectre", + -- stylua: ignore + keys = { + { "sr", function() require("spectre").open() end, desc = "Replace in files (Spectre)" }, + }, + }, + { + "nvim-telescope/telescope.nvim", + cmd = "Telescope", + keys = { + { "/", util.telescope("live_grep"), desc = "Find in Files (Grep)" }, + { "", util.telescope("find_files"), desc = "Find Files (root dir)" }, + { "fb", "Telescope buffers", desc = "Buffers" }, + { "ff", util.telescope("find_files"), desc = "Find Files (root dir)" }, + { "fF", util.telescope("find_files", { cwd = false }), desc = "Find Files (cwd)" }, + { "fr", "Telescope oldfiles", desc = "Recent" }, + { "gc", "Telescope git_commits", desc = "commits" }, + { "gs", "Telescope git_status", desc = "status" }, + { "ha", "Telescope autocommands", desc = "Auto Commands" }, + { "hc", "Telescope commands", desc = "Commands" }, + { "hf", "Telescope filetypes", desc = "File Types" }, + { "hh", "Telescope help_tags", desc = "Help Pages" }, + { "hk", "Telescope keymaps", desc = "Key Maps" }, + { "hm", "Telescope man_pages", desc = "Man Pages" }, + { "ho", "Telescope vim_options", desc = "Options" }, + { "hs", "Telescope highlights", desc = "Search Highlight Groups" }, + { "ht", "Telescope builtin", desc = "Telescope" }, + { "sb", "Telescope current_buffer_fuzzy_find", desc = "Buffer" }, + { "sc", "Telescope command_history", desc = "Command History" }, + { "sg", util.telescope("live_grep"), desc = "Grep (root dir)" }, + { "sG", util.telescope("live_grep", { cwd = false }), desc = "Grep (cwd)" }, + { "sm", "Telescope marks", desc = "Jump to Mark" }, + { ",", "Telescope buffers show_all_buffers=true", desc = "Switch Buffer" }, + { ":", "Telescope command_history", desc = "Command History" }, + { + "ss", + util.telescope("lsp_document_symbols", { + symbols = { + "Class", + "Function", + "Method", + "Constructor", + "Interface", + "Module", + "Struct", + "Trait", + "Field", + "Property", + }, + }), + desc = "Goto Symbol", + }, + }, + config = { + defaults = { + prompt_prefix = " ", + selection_caret = " ", + mappings = { + i = { + [""] = function(...) + return require("trouble.providers.telescope").open_with_trouble(...) + end, + [""] = function() + util.telescope("find_files", { no_ignore = true })() + end, + [""] = function() + util.telescope("find_files", { hidden = true })() + end, + [""] = function(...) + return require("telescope.actions").cycle_history_next(...) + end, + [""] = function(...) + return require("telescope.actions").cycle_history_prev(...) + end, + }, + }, + }, + }, + }, + { + "folke/trouble.nvim", + cmd = { "TroubleToggle", "Trouble" }, + config = { use_diagnostic_signs = true }, + keys = { + { "xx", "TroubleToggle document_diagnostics", desc = "Document Diagnostics (Trouble)" }, + { "xX", "TroubleToggle workspace_diagnostics", desc = "Workspace Diagnostics (Trouble)" }, + }, + }, + { + "folke/todo-comments.nvim", + cmd = { "TodoTrouble", "TodoTelescope" }, + event = "BufReadPost", + config = true, + -- stylua: ignore + keys = { + { "]t", function() require("todo-comments").jump_next() end, desc = "Next todo comment" }, + { "[t", function() require("todo-comments").jump_prev() end, desc = "Previous todo comment" }, + { "xt", "TodoTrouble", desc = "Todo Trouble" }, + { "xtt", "TodoTrouble keywords=TODO,FIX,FIXME", desc = "Todo Trouble" }, + { "xT", "TodoTelescope", desc = "Todo Telescope" }, + }, + }, + { + "numToStr/Comment.nvim", + config = function() + require("Comment").setup({}) + end, + }, +} diff --git a/.config/nvim/lua/lazy/plugins/git.lua b/.config/nvim/lua/lazyvim/plugins/git.lua similarity index 100% rename from .config/nvim/lua/lazy/plugins/git.lua rename to .config/nvim/lua/lazyvim/plugins/git.lua diff --git a/.config/nvim/lua/lazy/plugins/lsp/format.lua b/.config/nvim/lua/lazyvim/plugins/lsp/format.lua similarity index 100% rename from .config/nvim/lua/lazy/plugins/lsp/format.lua rename to .config/nvim/lua/lazyvim/plugins/lsp/format.lua diff --git a/.config/nvim/lua/lazy/plugins/lsp/init.lua b/.config/nvim/lua/lazyvim/plugins/lsp/init.lua similarity index 90% rename from .config/nvim/lua/lazy/plugins/lsp/init.lua rename to .config/nvim/lua/lazyvim/plugins/lsp/init.lua index 69ca08d..ea0a84f 100644 --- a/.config/nvim/lua/lazy/plugins/lsp/init.lua +++ b/.config/nvim/lua/lazyvim/plugins/lsp/init.lua @@ -36,13 +36,13 @@ return { config = function(plugin) -- setup formatting and keymaps - require("lazy.functions").on_attach(function(client, buffer) - require("lazy.plugins.lsp.format").on_attach(client, buffer) - require("lazy.plugins.lsp.keymaps").on_attach(client, buffer) + require("lazyvim.functions").on_attach(function(client, buffer) + require("lazyvim.plugins.lsp.format").on_attach(client, buffer) + require("lazyvim.plugins.lsp.keymaps").on_attach(client, buffer) end) -- diagnostics - for name, icon in pairs(require("lazy.config.icons").diagnostics) do + for name, icon in pairs(require("lazyvim.config.icons").diagnostics) do name = "DiagnosticSign" .. name vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" }) end diff --git a/.config/nvim/lua/lazy/plugins/lsp/keymaps.lua b/.config/nvim/lua/lazyvim/plugins/lsp/keymaps.lua similarity index 97% rename from .config/nvim/lua/lazy/plugins/lsp/keymaps.lua rename to .config/nvim/lua/lazyvim/plugins/lsp/keymaps.lua index 32d403f..cadec6d 100644 --- a/.config/nvim/lua/lazy/plugins/lsp/keymaps.lua +++ b/.config/nvim/lua/lazyvim/plugins/lsp/keymaps.lua @@ -21,7 +21,7 @@ function M.on_attach(client, buffer) self:map("[w", M.diagnostic_goto(false, "WARNING"), { desc = "Prev Warning" }) self:map("ca", vim.lsp.buf.code_action, { desc = "Code Action", mode = { "n", "v" }, has = "codeAction" }) - local format = require("lazy.plugins.lsp.format").format + local format = require("lazyvim.plugins.lsp.format").format self:map("cf", format, { desc = "Format Document", has = "documentFormatting" }) self:map("cf", format, { desc = "Format Range", mode = "v", has = "documentRangeFormatting" }) self:map("cr", M.rename, { expr = true, desc = "Rename", has = "rename" }) diff --git a/.config/nvim/lua/lazy/plugins/lualine.lua b/.config/nvim/lua/lazyvim/plugins/lualine.lua similarity index 100% rename from .config/nvim/lua/lazy/plugins/lualine.lua rename to .config/nvim/lua/lazyvim/plugins/lualine.lua diff --git a/.config/nvim/lua/lazyvim/plugins/noice.lua b/.config/nvim/lua/lazyvim/plugins/noice.lua new file mode 100644 index 0000000..3150d5f --- /dev/null +++ b/.config/nvim/lua/lazyvim/plugins/noice.lua @@ -0,0 +1,28 @@ +return { + { + -- "folke/noice.nvim", + -- event = "VeryLazy", + -- config = { + -- lsp = { + -- override = { + -- ["vim.lsp.util.convert_input_to_markdown_lines"] = true, + -- ["vim.lsp.util.stylize_markdown"] = true, + -- }, + -- }, + -- presets = { + -- bottom_search = true, + -- command_palette = true, + -- long_message_to_split = true, + -- }, + -- }, + -- -- stylua: ignore + -- keys = { + -- { "", function() require("noice").redirect(vim.fn.getcmdline()) end, mode = "c", desc = "Redirect Cmdline" }, + -- { "nl", function() require("noice").cmd("last") end, desc = "Noice Last Message" }, + -- { "nh", function() require("noice").cmd("history") end, desc = "Noice History" }, + -- { "na", function() require("noice").cmd("all") end, desc = "Noice All" }, + -- { "", function() if not require("noice.lsp").scroll(4) then return "" end end, silent = true, expr = true }, + -- { "", function() if not require("noice.lsp").scroll(-4) then return "" end end, silent = true, expr = true }, + -- }, + }, +} diff --git a/.config/nvim/lua/lazy/plugins/snippets.lua b/.config/nvim/lua/lazyvim/plugins/snippets.lua similarity index 100% rename from .config/nvim/lua/lazy/plugins/snippets.lua rename to .config/nvim/lua/lazyvim/plugins/snippets.lua diff --git a/.config/nvim/lua/lazy/plugins/starter.lua b/.config/nvim/lua/lazyvim/plugins/starter.lua similarity index 100% rename from .config/nvim/lua/lazy/plugins/starter.lua rename to .config/nvim/lua/lazyvim/plugins/starter.lua diff --git a/.config/nvim/lua/lazy/plugins/treesitter.lua b/.config/nvim/lua/lazyvim/plugins/treesitter.lua similarity index 100% rename from .config/nvim/lua/lazy/plugins/treesitter.lua rename to .config/nvim/lua/lazyvim/plugins/treesitter.lua diff --git a/.config/nvim/lua/lazyvim/plugins/utility.lua b/.config/nvim/lua/lazyvim/plugins/utility.lua new file mode 100644 index 0000000..99b890c --- /dev/null +++ b/.config/nvim/lua/lazyvim/plugins/utility.lua @@ -0,0 +1,287 @@ +return { + { + "nvim-lua/plenary.nvim", + }, + { + "RRethy/vim-illuminate", + event = "BufReadPost", + config = function() + require("illuminate").configure({ delay = 200 }) + end, + -- stylua: ignore + keys = { + { "]]", function() require("illuminate").goto_next_reference(false) end, desc = "Next Reference", }, + { "[[", function() require("illuminate").goto_prev_reference(false) end, desc = "Prev Reference" }, + }, + }, + { + "nvim-lua/popup.nvim", + }, + { + "folke/neodev.nvim", + }, + { + "rcarriga/nvim-notify", + config = function() + local icons = require("lazyvim.config.icons") + require("notify").setup({ + -- Animation style (see below for details) + stages = "fade_in_slide_out", + + -- Function called when a new window is opened, use for changing win settings/config + on_open = nil, + + -- Function called when a window is closed + on_close = nil, + + -- Render function for notifications. See notify-render() + render = "default", + + -- Default timeout for notifications + timeout = 2000, + + -- For stages that change opacity this is treated as the highlight behind the window + -- Set this to either a highlight group or an RGB hex value e.g. "#000000" + background_colour = "Normal", + + -- Minimum width for notification windows + minimum_width = 10, + + -- Icons for the different levels + icons = { + ERROR = icons.diagnostics.Error, + WARN = icons.diagnostics.Warning, + INFO = icons.diagnostics.Information, + DEBUG = icons.ui.Bug, + TRACE = icons.ui.Pencil, + }, + }) + end, + }, + { + "moll/vim-bbye", + }, + { + "lewis6991/impatient.nvim", + config = function() + require("impatient").enable_profile() + end, + }, + { + "ghillb/cybu.nvim", + cmd = { "CybuNext", "CybuPrev" }, + config = function() + require("cybu").setup({ + position = { + relative_to = "win", -- win, editor, cursor + anchor = "topright", -- topleft, topcenter, topright, + -- centerleft, center, centerright, + -- bottomleft, bottomcenter, bottomright + -- vertical_offset = 10, -- vertical offset from anchor in lines + -- horizontal_offset = 0, -- vertical offset from anchor in columns + -- max_win_height = 5, -- height of cybu window in lines + -- max_win_width = 0.5, -- integer for absolute in columns + -- float for relative to win/editor width + }, + display_time = 1750, -- time the cybu window is displayed + style = { + separator = " ", -- string used as separator + prefix = "…", -- string used as prefix for truncated paths + padding = 1, -- left & right padding in number of spaces + hide_buffer_id = true, + devicons = { + enabled = true, -- enable or disable web dev icons + colored = true, -- enable color for web dev icons + }, + }, + }) + end, + }, + { + "mbbill/undotree", + }, + { + "MunifTanjim/nui.nvim", + }, + { + "kyazdani42/nvim-web-devicons", + }, + { + "lukas-reineke/indent-blankline.nvim", + config = function() + vim.g.indent_blankline_buftype_exclude = { "terminal", "nofile" } + vim.g.indent_blankline_filetype_exclude = { + "help", + "startify", + "dashboard", + "packer", + "neogitstatus", + "NvimTree", + "Trouble", + "text", + } + vim.g.indentLine_enabled = 1 + vim.g.indent_blankline_char = "▏" + + vim.g.indent_blankline_show_trailing_blankline_indent = false + vim.g.indent_blankline_show_first_indent_level = true + vim.g.indent_blankline_use_treesitter = false + vim.g.indent_blankline_show_current_context = true + + require("indent_blankline").setup({ + show_current_context = true, + }) + end, + }, + { + "windwp/nvim-autopairs", + config = function() + require("nvim-autopairs").setup({ + disable_filetype = { "TelescopePrompt", "spectre_panel" }, + ignore_next_char = "[%w%.*]", -- don't place pair when cursor sits in front of any char + }) + end, + }, + { + "preservim/vim-markdown", + }, + { + "nacro90/numb.nvim", + config = function() + require("numb").setup({ + show_numbers = true, -- enable 'number' for the window while peeking + show_cursorline = true, -- enable 'cursorline' for window wdile peeking + }) + end, + }, + { + "andymass/vim-matchup", + }, + { + "junegunn/vim-slash", + }, + { + "folke/zen-mode.nvim", + config = function() + require("zen-mode").setup({ + window = { + backdrop = 1, + height = 0.9, + width = 80, + options = { + signcolumn = "no", + number = false, + relativenumber = false, + cursorline = true, + cursorcolumn = false, -- disable cursor column + }, + }, + plugins = { + gitsigns = { enabled = false }, + tmux = { enabled = false }, + twilight = { enabled = false }, + }, + on_open = function() + vim.g.cmp_active = false + vim.cmd([[LspStop]]) + local status_ok, _ = pcall(vim.api.nvim_set_option_value, "winbar", nil, { scope = "local" }) + if not status_ok then + return + end + if vim.fn.exists("#" .. "_winbar") == 1 then + vim.cmd("au! " .. "_winbar") + end + end, + on_close = function() + vim.g.cmp_active = true + vim.cmd([[LspStart]]) + require("winbar").create_winbar() + end, + }) + end, + }, + { + "tpope/vim-surround", + }, + { + "danymat/neogen", + config = function() + require("neogen").setup({ + enabled = true, + input_after_comment = true, + }) + end, + }, + { + "monaqa/dial.nvim", + config = function() + local dial_config = require("dial.config") + + local y = "2024/05/29" + + local augend = require("dial.augend") + dial_config.augends:register_group({ + default = { + augend.integer.alias.decimal, + augend.integer.alias.hex, + augend.date.alias["%Y/%m/%d"], + }, + typescript = { + augend.integer.alias.decimal, + augend.integer.alias.hex, + augend.constant.new({ elements = { "let", "const" } }), + }, + visual = { + augend.integer.alias.decimal, + augend.integer.alias.hex, + augend.date.alias["%Y/%m/%d"], + augend.constant.alias.alpha, + augend.constant.alias.Alpha, + }, + mygroup = { + augend.constant.new({ + elements = { "and", "or" }, + word = true, -- if false, "sand" is incremented into "sor", "doctor" into "doctand", etc. + cyclic = true, -- "or" is incremented into "and". + }), + augend.constant.new({ + elements = { "True", "False" }, + word = true, + cyclic = true, + }), + augend.constant.new({ + elements = { "public", "private" }, + word = true, + cyclic = true, + }), + augend.constant.new({ + elements = { "&&", "||" }, + word = false, + cyclic = true, + }), + augend.date.alias["%d/%m/%Y"], -- date (02/19/2022, etc.) + augend.constant.alias.bool, -- boolean value (true <-> false) + augend.integer.alias.decimal, + augend.integer.alias.hex, + augend.semver.alias.semver, + }, + }) + + local map = require("dial.map") + + -- change augends in VISUAL mode + vim.api.nvim_set_keymap("n", "", map.inc_normal("mygroup"), { noremap = true }) + vim.api.nvim_set_keymap("n", "", map.dec_normal("mygroup"), { noremap = true }) + vim.api.nvim_set_keymap("v", "", map.inc_normal("visual"), { noremap = true }) + vim.api.nvim_set_keymap("v", "", map.dec_normal("visual"), { noremap = true }) + + vim.cmd([[ + " enable only for specific FileType + autocmd FileType typescript,javascript lua vim.api.nvim_buf_set_keymap(0, "n", "", require("dial.map").inc_normal("typescript"), {noremap = true}) + ]]) + end, + }, + { + "ThePrimeagen/harpoon", + }, +} diff --git a/.config/nvim/lua/lazyvim/plugins/whichkey.lua b/.config/nvim/lua/lazyvim/plugins/whichkey.lua new file mode 100644 index 0000000..247c340 --- /dev/null +++ b/.config/nvim/lua/lazyvim/plugins/whichkey.lua @@ -0,0 +1,128 @@ +return { + { + "folke/which-key.nvim", + event = "BufEnter", + config = function() + local whichkey = require("which-key") + whichkey.setup({ + plugins = { + marks = true, -- shows a list of your marks on ' and ` + registers = true, -- shows your registers on " in NORMAL or in INSERT mode + spelling = { + enabled = true, -- enabling this will show WhichKey when pressing z= to select spelling suggestions + suggestions = 20, -- how many suggestions should be shown in the list? + }, + -- the presets plugin, adds help for a bunch of default keybindings in Neovim + -- No actual key bindings are created + presets = { + operators = false, -- adds help for operators like d, y, ... and registers them for motion / text object completion + motions = false, -- adds help for motions + text_objects = false, -- help for text objects triggered after entering an operator + windows = true, -- default bindings on + nav = true, -- misc bindings to work with windows + z = true, -- bindings for folds, spelling and others prefixed with z + g = true, -- bindings for prefixed with g + }, + }, + key_labels = { + -- override the label used to display some keys. It doesn't effect WK in any other way. + [""] = "SPC", + }, + icons = { + breadcrumb = "»", -- symbol used in the command line area that shows your active key combo + separator = "➜", -- symbol used between a key and it's label + group = "+", -- symbol prepended to a group + }, + popup_mappings = { + scroll_down = "", -- binding to scroll down inside the popup + scroll_up = "", -- binding to scroll up inside the popup + }, + window = { + border = "rounded", -- none, single, double, shadow + position = "bottom", -- bottom, top + margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left] + padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left] + winblend = 0, + }, + layout = { + height = { min = 4, max = 25 }, -- min and max height of the columns + width = { min = 20, max = 50 }, -- min and max width of the columns + spacing = 3, -- spacing between columns + align = "center", -- align columns left, center or right + }, + ignore_missing = true, -- enable this to hide mappings for which you didn't specify a label + hidden = { "", "", "", "", "call", "lua", "^:", "^ " }, -- hide mapping boilerplate + show_help = false, -- show help message on the command line when the popup is visible + triggers_blacklist = { + -- list of mode / prefixes that should never be hooked by WhichKey + -- this is mostly relevant for key maps that start with a native binding + -- most people should not need to change this + i = { "j", "k" }, + v = { "j", "k" }, + }, + }) + + local opts = { + mode = "n", -- NORMAL mode + buffer = nil, -- Global mappings + prefix = "", + silent = true, -- use 'silent' + noremap = true, -- use 'noremap' + nowait = true, -- use 'nowait' + } + + local leader_opts = { + mode = "n", -- NORMAL mode + buffer = nil, -- Global mappings + prefix = "", + silent = true, -- use 'silent' + noremap = true, -- use 'noremap' + nowait = true, -- use 'nowait' + } + + local m_opts = { + mode = "n", -- NORMAL mode + buffer = nil, -- Global mappings + prefix = "m", + silent = true, -- use 'silent' + noremap = true, -- use 'noremap' + nowait = true, -- use 'nowait' + } + + local m_mappings = { + m = { 'lua require("harpoon.mark").add_file()', "Harpoon" }, + l = { 'lua require("harpoon.ui").nav_next()', "Harpoon Next" }, + h = { 'lua require("harpoon.ui").nav_prev()', "Harpoon Prev" }, + s = { "Telescope harpoon marks", "Search Files" }, + u = { 'lua require("harpoon.ui").toggle_quick_menu()', "Harpoon UI" }, + + ["1"] = { ' lua require("harpoon.ui").nav_file(1)', "Goto 1" }, + ["2"] = { ' lua require("harpoon.ui").nav_file(2)', "Goto 2" }, + ["3"] = { ' lua require("harpoon.ui").nav_file(3)', "Goto 3" }, + ["4"] = { ' lua require("harpoon.ui").nav_file(4)', "Goto 4" }, + } + + whichkey.register(m_mappings, m_opts) + + whichkey.register({ + mode = { "n", "v" }, + ["g"] = { name = "+goto" }, + ["]"] = { name = "+next" }, + ["["] = { name = "+prev" }, + ["b"] = { name = "+buffer" }, + ["c"] = { name = "+code" }, + ["f"] = { name = "+file" }, + ["g"] = { name = "+git" }, + ["h"] = { name = "+help" }, + ["n"] = { name = "+noice" }, + ["o"] = { name = "+open" }, + ["q"] = { name = "+quit/session" }, + ["s"] = { name = "+search" }, + ["t"] = { name = "+toggle" }, + ["x"] = { name = "+diagnostics/quickfix" }, + ["w"] = { name = "+windows" }, + [""] = { name = "+tabs" }, + }) + end, + }, +}