From 0d1b98f65e6f205e470c28b6fdfd3b47c5796c38 Mon Sep 17 00:00:00 2001 From: Nikita Bykov Date: Tue, 15 Jul 2025 15:41:50 +0500 Subject: [PATCH] nvim lazy plugin management part 1 --- .config/nvim/init.lua | 17 +- .config/nvim/lua/user/autopairs.lua | 33 ---- .../nvim/lua/user/blank_indent_highlight.lua | 7 - .config/nvim/lua/user/bufferline.lua | 37 ---- .config/nvim/lua/user/dropbar.lua | 6 - .config/nvim/lua/user/gitsigns.lua | 39 ---- .config/nvim/lua/user/harpoon.lua | 40 ----- .config/nvim/lua/user/keymaps.lua | 9 +- .config/nvim/lua/user/lazy.lua | 81 +++++++++ .config/nvim/lua/user/lualine.lua | 46 ----- .config/nvim/lua/user/neoscroll.lua | 26 --- .config/nvim/lua/user/neotree.lua | 82 --------- .config/nvim/lua/user/nvim_navic.lua | 13 -- .config/nvim/lua/user/nvim_scrollbar.lua | 6 - .config/nvim/lua/user/nvim_tree.lua | 24 --- .config/nvim/lua/user/oil.lua | 113 ------------ .config/nvim/lua/user/plugins.lua | 166 ------------------ .config/nvim/lua/user/plugins/autopairs.lua | 34 ++++ .../user/plugins/blank_indent_highlight.lua | 14 ++ .config/nvim/lua/user/plugins/gitsigns.lua | 46 +++++ .config/nvim/lua/user/plugins/harpoon.lua | 46 +++++ .config/nvim/lua/user/plugins/neotree.lua | 92 ++++++++++ .../nvim/lua/user/plugins/nvim_scrollbar.lua | 5 + .config/nvim/lua/user/plugins/snipptes.lua | 11 ++ .config/nvim/lua/user/plugins/telescope.lua | 121 +++++++++++++ .config/nvim/lua/user/plugins/treesitter.lua | 38 ++++ .config/nvim/lua/user/plugins/which_key.lua | 142 +++++++++++++++ .config/nvim/lua/user/telescope.lua | 104 ----------- .config/nvim/lua/user/treesitter.lua | 33 ---- .config/nvim/lua/user/which_key.lua | 141 --------------- 30 files changed, 637 insertions(+), 935 deletions(-) delete mode 100644 .config/nvim/lua/user/autopairs.lua delete mode 100644 .config/nvim/lua/user/blank_indent_highlight.lua delete mode 100644 .config/nvim/lua/user/bufferline.lua delete mode 100644 .config/nvim/lua/user/dropbar.lua delete mode 100644 .config/nvim/lua/user/gitsigns.lua delete mode 100644 .config/nvim/lua/user/harpoon.lua create mode 100644 .config/nvim/lua/user/lazy.lua delete mode 100644 .config/nvim/lua/user/lualine.lua delete mode 100644 .config/nvim/lua/user/neoscroll.lua delete mode 100644 .config/nvim/lua/user/neotree.lua delete mode 100644 .config/nvim/lua/user/nvim_navic.lua delete mode 100644 .config/nvim/lua/user/nvim_scrollbar.lua delete mode 100644 .config/nvim/lua/user/nvim_tree.lua delete mode 100644 .config/nvim/lua/user/oil.lua delete mode 100644 .config/nvim/lua/user/plugins.lua create mode 100644 .config/nvim/lua/user/plugins/autopairs.lua create mode 100644 .config/nvim/lua/user/plugins/blank_indent_highlight.lua create mode 100644 .config/nvim/lua/user/plugins/gitsigns.lua create mode 100644 .config/nvim/lua/user/plugins/harpoon.lua create mode 100644 .config/nvim/lua/user/plugins/neotree.lua create mode 100644 .config/nvim/lua/user/plugins/nvim_scrollbar.lua create mode 100644 .config/nvim/lua/user/plugins/snipptes.lua create mode 100644 .config/nvim/lua/user/plugins/telescope.lua create mode 100644 .config/nvim/lua/user/plugins/treesitter.lua create mode 100644 .config/nvim/lua/user/plugins/which_key.lua delete mode 100644 .config/nvim/lua/user/telescope.lua delete mode 100644 .config/nvim/lua/user/treesitter.lua delete mode 100644 .config/nvim/lua/user/which_key.lua diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index c30c41f..9c8d7c1 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,21 +1,12 @@ -require("user.plugins") +require("user.keymaps") +require("user.lazy") require("user.themes.kanagawa") require("user.options") -require("user.keymaps") require("user.cmp") require("user.lsp") require("user.lsp_format") -require("user.treesitter") -require("user.blank_indent_highlight") -require("user.autopairs") -require("user.telescope") -require("user.nvim_scrollbar") -require("user.gitsigns") -require("user.dap.dapui") -require("user.dap.dap") -require("user.neotree") -require("user.which_key") -require("user.harpoon") +-- require("user.dap.dapui") +-- require("user.dap.dap") diff --git a/.config/nvim/lua/user/autopairs.lua b/.config/nvim/lua/user/autopairs.lua deleted file mode 100644 index 577e571..0000000 --- a/.config/nvim/lua/user/autopairs.lua +++ /dev/null @@ -1,33 +0,0 @@ --- Setup nvim-cmp. -local status_ok, npairs = pcall(require, "nvim-autopairs") -if not status_ok then - return -end - -npairs.setup { - check_ts = true, - ts_config = { - lua = { "string", "source" }, - javascript = { "string", "template_string" }, - java = false, - }, - disable_filetype = { "TelescopePrompt", "spectre_panel" }, - fast_wrap = { - map = "", - chars = { "{", "[", "(", '"', "'" }, - pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""), - offset = 0, -- Offset from pattern match - end_key = "$", - keys = "qwertyuiopzxcvbnmasdfghjkl", - check_comma = true, - highlight = "PmenuSel", - highlight_grey = "LineNr", - }, -} - -local cmp_autopairs = require "nvim-autopairs.completion.cmp" -local cmp_status_ok, cmp = pcall(require, "cmp") -if not cmp_status_ok then - return -end -cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done { map_char = { tex = "" } }) diff --git a/.config/nvim/lua/user/blank_indent_highlight.lua b/.config/nvim/lua/user/blank_indent_highlight.lua deleted file mode 100644 index 5cbcdfe..0000000 --- a/.config/nvim/lua/user/blank_indent_highlight.lua +++ /dev/null @@ -1,7 +0,0 @@ -require("ibl").setup({ - scope = { - enabled = true, - show_start = false, - show_end = false, - }, -}) diff --git a/.config/nvim/lua/user/bufferline.lua b/.config/nvim/lua/user/bufferline.lua deleted file mode 100644 index 8f00287..0000000 --- a/.config/nvim/lua/user/bufferline.lua +++ /dev/null @@ -1,37 +0,0 @@ -local status_ok, bufferline = pcall(require, "bufferline") - -if not status_ok then - return -end - -bufferline.setup({ - options = { - mode = "tabs", - offsets = { - { filetype = "NvimTree", text = "", padding = 1 }, - { filetype = "neo-tree", text = "", padding = 1 }, - }, - style_preset = bufferline.style_preset.minimal, - buffer_close_icon = "", - modified_icon = "", - close_icon = "", - max_name_length = 14, - max_prefix_length = 13, - tab_size = 20, - separator_style = { "", "" }, - hover = { - enabled = true, - delay = 200, - reveal = { 'close' } - } - - -- indicator = { - -- style = "underline" - -- }, - -- highlights = { - -- tab_separator_selected = { - -- underline = "0xc8c093", - -- }, - -- } - }, -}) diff --git a/.config/nvim/lua/user/dropbar.lua b/.config/nvim/lua/user/dropbar.lua deleted file mode 100644 index 4fcaff7..0000000 --- a/.config/nvim/lua/user/dropbar.lua +++ /dev/null @@ -1,6 +0,0 @@ -local null_ls_status_ok, breadcrumbs = pcall(require, "breadcrumbs") -if not null_ls_status_ok then - return -end - -breadcrumbs.setup() diff --git a/.config/nvim/lua/user/gitsigns.lua b/.config/nvim/lua/user/gitsigns.lua deleted file mode 100644 index a1523eb..0000000 --- a/.config/nvim/lua/user/gitsigns.lua +++ /dev/null @@ -1,39 +0,0 @@ -require("gitsigns").setup({ - signs = { - add = { text = "│" }, - change = { text = "│" }, - delete = { text = "_" }, - topdelete = { text = "‾" }, - changedelete = { text = "~" }, - untracked = { text = "┆" }, - }, - signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` - numhl = false, -- Toggle with `:Gitsigns toggle_numhl` - linehl = false, -- Toggle with `:Gitsigns toggle_linehl` - word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` - watch_gitdir = { - interval = 1000, - follow_files = true, - }, - attach_to_untracked = true, - current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame` - current_line_blame_opts = { - virt_text = true, - virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align' - delay = 1000, - ignore_whitespace = false, - }, - current_line_blame_formatter = ", - ", - sign_priority = 6, - update_debounce = 100, - status_formatter = nil, -- Use default - max_file_length = 40000, -- Disable if file is longer than this (in lines) - preview_config = { - -- Options passed to nvim_open_win - border = "single", - style = "minimal", - relative = "cursor", - row = 0, - col = 1, - } -}) diff --git a/.config/nvim/lua/user/harpoon.lua b/.config/nvim/lua/user/harpoon.lua deleted file mode 100644 index 3125824..0000000 --- a/.config/nvim/lua/user/harpoon.lua +++ /dev/null @@ -1,40 +0,0 @@ -local null_ls_status_ok, harpoon = pcall(require, "harpoon") -if not null_ls_status_ok then - return -end - --- REQUIRED -harpoon:setup() --- REQUIRED - -vim.keymap.set("n", "a", function() harpoon:list():add() end) -vim.keymap.set("n", "hm", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end) - -vim.keymap.set("n", "", function() harpoon:list():select(1) end) -vim.keymap.set("n", "", function() harpoon:list():select(2) end) -vim.keymap.set("n", "", function() harpoon:list():select(3) end) -vim.keymap.set("n", "", function() harpoon:list():select(4) end) - --- Toggle previous & next buffers stored within Harpoon list -vim.keymap.set("n", "hp", function() harpoon:list():prev() end) -vim.keymap.set("n", "hn", function() harpoon:list():next() end) - -local conf = require("telescope.config").values -local function toggle_telescope(harpoon_files) - local file_paths = {} - for _, item in ipairs(harpoon_files.items) do - table.insert(file_paths, item.value) - end - - require("telescope.pickers").new({}, { - prompt_title = "Harpoon", - finder = require("telescope.finders").new_table({ - results = file_paths, - }), - previewer = conf.file_previewer({}), - sorter = conf.generic_sorter({}), - }):find() -end - -vim.keymap.set("n", "", function() toggle_telescope(harpoon:list()) end, - { desc = "Open harpoon window" }) diff --git a/.config/nvim/lua/user/keymaps.lua b/.config/nvim/lua/user/keymaps.lua index 375f303..fa36832 100644 --- a/.config/nvim/lua/user/keymaps.lua +++ b/.config/nvim/lua/user/keymaps.lua @@ -1,14 +1,11 @@ +vim.g.mapleader = " " +vim.g.maplocalleader = " " + local opts = { noremap = true, silent = true } - -local term_opts = { silent = true } - local keymap = vim.api.nvim_set_keymap keymap("", "", "", opts) -vim.g.mapleader = " " -vim.g.maplocalleader = " " - --window navigation keymap("n", "", "h", opts) keymap("n", "", "j", opts) diff --git a/.config/nvim/lua/user/lazy.lua b/.config/nvim/lua/user/lazy.lua new file mode 100644 index 0000000..5bf2f94 --- /dev/null +++ b/.config/nvim/lua/user/lazy.lua @@ -0,0 +1,81 @@ +local fn = vim.fn + +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) +end + +vim.opt.rtp:prepend(lazypath) + +local status_ok, lazy = pcall(require, "lazy") +if not status_ok then + return +end + +lazy.setup( + { + spec = { + { import = "user.plugins" }, + + { "hrsh7th/nvim-cmp", event = "VeryLazy" }, -- The completion plugin + { "hrsh7th/cmp-buffer", event = "VeryLazy" }, -- buffer completions + { "hrsh7th/cmp-path", event = "VeryLazy" }, -- path completions + { "hrsh7th/cmp-cmdline", event = "VeryLazy" }, -- cmdline completions + { "saadparwaiz1/cmp_luasnip", event = "VeryLazy" }, -- snippet completions + { "hrsh7th/cmp-nvim-lsp", event = "VeryLazy" }, + + -- snippets + + -- LSP + { "williamboman/mason.nvim", event = "VeryLazy" }, -- simple to use language server installer + { "williamboman/mason-lspconfig.nvim", event = "VeryLazy" }, + { "neovim/nvim-lspconfig", event = "VeryLazy" }, -- enable LSP + { + "folke/zen-mode.nvim", + opts = { + window = { + backdrop = 1 + } + }, + event = "VeryLazy" + }, + + + { + "nvimtools/none-ls.nvim", + event = "VeryLazy" + }, + + { "lukas-reineke/lsp-format.nvim", event = "VeryLazy" }, + + --comment out + { "tpope/vim-commentary", event = "VeryLazy" }, + { "windwp/nvim-ts-autotag", event = "VeryLazy" }, + + { + "rebelot/kanagawa.nvim", + lazy = false, + priority = 1000, + }, + + --debugging + { "mfussenegger/nvim-dap", event = "VeryLazy" }, + { + "rcarriga/nvim-dap-ui", + dependencies = { + "mfussenegger/nvim-dap", + "nvim-neotest/nvim-nio" + }, + event = { "VeryLazy" } + }, + + }, + } +) diff --git a/.config/nvim/lua/user/lualine.lua b/.config/nvim/lua/user/lualine.lua deleted file mode 100644 index 90ce219..0000000 --- a/.config/nvim/lua/user/lualine.lua +++ /dev/null @@ -1,46 +0,0 @@ -require('lualine').setup { - options = { - icons_enabled = true, - theme = 'kanagawa', - component_separators = { left = '', right = ''}, - section_separators = { left = '', right = ''}, - disabled_filetypes = { - statusline = {}, - winbar = {}, - }, - ignore_focus = {}, - always_divide_middle = true, - globalstatus = true, - refresh = { - statusline = 1000, - tabline = 1000, - winbar = 1000, - }, - -- use_mode_colors = false - }, - sections = { - lualine_a = {'branch'}, - -- lualine_b = {'diff', 'diagnostics'}, - lualine_b = {'diagnostics'}, - lualine_c = {}, - -- lualine_x = {'encoding', 'fileformat', 'filetype'}, - lualine_x = {'encoding', 'fileformat'}, - lualine_y = {'progress'}, - lualine_z = {'location'} - }, - inactive_sections = { - lualine_a = {}, - lualine_b = {}, - lualine_c = {}, - lualine_x = {}, - lualine_y = {}, - lualine_z = {} - }, - tabline = {}, - winbar = {}, - inactive_winbar = {}, - extensions = {} -} - -vim.api.nvim_create_autocmd('CursorMoved', {callback=require('lualine').refresh}) -vim.api.nvim_create_autocmd('ModeChanged', {callback=require('lualine').refresh}) diff --git a/.config/nvim/lua/user/neoscroll.lua b/.config/nvim/lua/user/neoscroll.lua deleted file mode 100644 index dbdd42c..0000000 --- a/.config/nvim/lua/user/neoscroll.lua +++ /dev/null @@ -1,26 +0,0 @@ -require("neoscroll").setup({ - -- All these keys will be mapped to their corresponding default scrolling animation - mappings = { "", "", "", "", "", "", "zt", "zz", "zb" }, - hide_cursor = true, -- Hide cursor while scrolling - stop_eof = true, -- Stop at when scrolling downwards - respect_scrolloff = false, -- Stop scrolling when the cursor reaches the scrolloff margin of the file - cursor_scrolls_alone = true, -- The cursor will keep on scrolling even if the window cannot scroll further - easing_function = nil, -- Default easing function - pre_hook = nil, -- Function to run before the scrolling animation starts - post_hook = nil, - performance_mode = false, -}) - --- local t = {} --- -- Syntax: t[keys] = {function, {function arguments}} --- t[''] = { 'scroll', { '-vim.wo.scroll', 'true', '250' } } --- t[''] = { 'scroll', { 'vim.wo.scroll', 'true', '250' } } --- t[''] = { 'scroll', { '-vim.api.nvim_win_get_height(0)', 'true', '450' } } --- t[''] = { 'scroll', { 'vim.api.nvim_win_get_height(0)', 'true', '450' } } --- t[''] = { 'scroll', { '-0.10', 'false', '100' } } --- t[''] = { 'scroll', { '0.10', 'false', '100' } } --- t['zt'] = { 'zt', { '250' } } --- t['zz'] = { 'zz', { '250' } } --- t['zb'] = { 'zb', { '250' } } - --- require('neoscroll.config').set_mappings(t) diff --git a/.config/nvim/lua/user/neotree.lua b/.config/nvim/lua/user/neotree.lua deleted file mode 100644 index 29f7711..0000000 --- a/.config/nvim/lua/user/neotree.lua +++ /dev/null @@ -1,82 +0,0 @@ -require("neo-tree").setup({ - enable_diagnostics = false, - enable_git_status = true, - default_component_configs = { - icon = { - folder_empty = "󰜌", - folder_empty_open = "󰜌", - }, - 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 = "", - }, - }, - }, - document_symbols = { - kinds = { - File = { icon = "󰈙", hl = "Tag" }, - Namespace = { icon = "󰌗", hl = "Include" }, - Package = { icon = "󰏖", hl = "Label" }, - Class = { icon = "󰌗", hl = "Include" }, - Property = { icon = "󰆧", hl = "@property" }, - Enum = { icon = "󰒻", hl = "@number" }, - Function = { icon = "󰊕", hl = "Function" }, - String = { icon = "󰀬", hl = "String" }, - Number = { icon = "󰎠", hl = "Number" }, - Array = { icon = "󰅪", hl = "Type" }, - Object = { icon = "󰅩", hl = "Type" }, - Key = { icon = "󰌋", hl = "" }, - Struct = { icon = "󰌗", hl = "Type" }, - Operator = { icon = "󰆕", hl = "Operator" }, - TypeParameter = { icon = "󰊄", hl = "Type" }, - StaticMethod = { icon = "󰠄 ", hl = "Function" }, - }, - }, - 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 = "", - }, - }, - -- Add this section only if you've configured source selector. - source_selector = { - sources = { - { source = "filesystem", display_name = " 󰉓 Files " }, - { source = "git_status", display_name = " 󰊢 Git " }, - }, - }, - - event_handlers = { - { - event = "neo_tree_buffer_enter", - handler = function(arg) - vim.opt.relativenumber = true - end, - }, - { - event = "file_open_requested", - handler = function() - require("neo-tree.command").execute({ action = "close" }) - end - }, - }, -}) diff --git a/.config/nvim/lua/user/nvim_navic.lua b/.config/nvim/lua/user/nvim_navic.lua deleted file mode 100644 index 1a3d002..0000000 --- a/.config/nvim/lua/user/nvim_navic.lua +++ /dev/null @@ -1,13 +0,0 @@ -local nvim_navic_status_ok, nvim_navic = pcall(require, "nvim-navic") -if not nvim_navic_status_ok then - return -end - -nvim_navic.setup({ - lsp = { - auto_attach = true, - preference = {"pyright", "pylsp"} - } -}) - --- vim.o.winbar = "%t %{%v:lua.require'nvim-navic'.get_location()%}" diff --git a/.config/nvim/lua/user/nvim_scrollbar.lua b/.config/nvim/lua/user/nvim_scrollbar.lua deleted file mode 100644 index 534039b..0000000 --- a/.config/nvim/lua/user/nvim_scrollbar.lua +++ /dev/null @@ -1,6 +0,0 @@ -local null_ls_status_ok, null_ls = pcall(require, "scrollbar") -if not null_ls_status_ok then - return -end - -null_ls.setup() diff --git a/.config/nvim/lua/user/nvim_tree.lua b/.config/nvim/lua/user/nvim_tree.lua deleted file mode 100644 index 636ac18..0000000 --- a/.config/nvim/lua/user/nvim_tree.lua +++ /dev/null @@ -1,24 +0,0 @@ --- examples for your init.lua - --- empty setup using defaults - --- OR setup with some options -require("nvim-tree").setup({ - sort_by = "case_sensitive", - view = { - adaptive_size = false, - width = 22, - height = 22, - mappings = { - list = { - { key = "u", action = "dir_up" }, - }, - }, - }, - renderer = { - group_empty = true, - }, - filters = { - dotfiles = true, - }, -}) diff --git a/.config/nvim/lua/user/oil.lua b/.config/nvim/lua/user/oil.lua deleted file mode 100644 index 22663ba..0000000 --- a/.config/nvim/lua/user/oil.lua +++ /dev/null @@ -1,113 +0,0 @@ -local oil_status_ok, oil = pcall(require, "scrollbar") -if not oil_status_ok then - return -end - -oil.setup({ - default_file_explorer = false, - columns = { - "icon", - }, - -- Buffer-local options to use for oil buffers - buf_options = { - buflisted = false, - bufhidden = "hide", - }, - -- Window-local options to use for oil buffers - win_options = { - wrap = false, - signcolumn = "no", - cursorcolumn = false, - foldcolumn = "0", - spell = false, - list = false, - conceallevel = 3, - concealcursor = "nvic", - }, - -- Send deleted files to the trash instead of permanently deleting them (:help oil-trash) - delete_to_trash = false, - -- Skip the confirmation popup for simple operations (:help oil.skip_confirm_for_simple_edits) - skip_confirm_for_simple_edits = false, - -- Selecting a new/moved/renamed file or directory will prompt you to save changes first - -- (:help prompt_save_on_select_new_entry) - prompt_save_on_select_new_entry = true, - -- Oil will automatically delete hidden buffers after this delay - -- You can set the delay to false to disable cleanup entirely - -- Note that the cleanup process only starts when none of the oil buffers are currently displayed - cleanup_delay_ms = 2000, - lsp_file_methods = { - -- Time to wait for LSP file operations to complete before skipping - timeout_ms = 1000, - -- Set to true to autosave buffers that are updated with LSP willRenameFiles - -- Set to "unmodified" to only save unmodified buffers - autosave_changes = false, - }, - -- Constrain the cursor to the editable parts of the oil buffer - -- Set to `false` to disable, or "name" to keep it on the file names - constrain_cursor = "editable", - -- Set to true to watch the filesystem for changes and reload oil - experimental_watch_for_changes = false, - -- Keymaps in oil buffer. Can be any value that `vim.keymap.set` accepts OR a table of keymap - -- options with a `callback` (e.g. { callback = function() ... end, desc = "", mode = "n" }) - -- Additionally, if it is a string that matches "actions.", - -- it will use the mapping at require("oil.actions"). - -- Set to `false` to remove a keymap - -- See :help oil-actions for a list of all available actions - keymaps = { - ["g?"] = "actions.show_help", - [""] = "actions.select", - [""] = { "actions.select", opts = { vertical = true }, desc = "Open the entry in a vertical split" }, - [""] = { "actions.select", opts = { horizontal = true }, desc = "Open the entry in a horizontal split" }, - [""] = { "actions.select", opts = { tab = true }, desc = "Open the entry in new tab" }, - [""] = "actions.preview", - [""] = "actions.close", - [""] = "actions.refresh", - ["-"] = "actions.parent", - ["_"] = "actions.open_cwd", - ["`"] = "actions.cd", - ["~"] = { "actions.cd", opts = { scope = "tab" }, desc = ":tcd to the current oil directory" }, - ["gs"] = "actions.change_sort", - ["gx"] = "actions.open_external", - ["g."] = "actions.toggle_hidden", - ["g\\"] = "actions.toggle_trash", - }, - -- Set to false to disable all of the above keymaps - use_default_keymaps = true, - view_options = { - -- Show files and directories that start with "." - show_hidden = false, - -- This function defines what is considered a "hidden" file - is_hidden_file = function(name, bufnr) - return vim.startswith(name, ".") - end, - -- This function defines what will never be shown, even when `show_hidden` is set - is_always_hidden = function(name, bufnr) - return false - end, - -- Sort file names in a more intuitive order for humans. Is less performant, - -- so you may want to set to false if you work with large directories. - natural_order = true, - sort = { - -- sort order can be "asc" or "desc" - -- see :help oil-columns to see which columns are sortable - { "type", "asc" }, - { "name", "asc" }, - }, - }, - -- Configuration for the floating window in oil.open_float - float = { - -- Padding around the floating window - padding = 2, - max_width = 0, - max_height = 0, - border = "rounded", - win_options = { - winblend = 0, - }, - -- This is the config that will be passed to nvim_open_win. - -- Change values here to customize the layout - override = function(conf) - return conf - end, - }, -}) diff --git a/.config/nvim/lua/user/plugins.lua b/.config/nvim/lua/user/plugins.lua deleted file mode 100644 index 23742f3..0000000 --- a/.config/nvim/lua/user/plugins.lua +++ /dev/null @@ -1,166 +0,0 @@ -local fn = vim.fn - -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not vim.loop.fs_stat(lazypath) then - vim.fn.system({ - "git", - "clone", - "--filter=blob:none", - "https://github.com/folke/lazy.nvim.git", - "--branch=stable", -- latest stable release - lazypath, - }) -end - -vim.opt.rtp:prepend(lazypath) - -local status_ok, lazy = pcall(require, "lazy") -if not status_ok then - return -end - -lazy.setup({ - - -- "nvim-lua/popup.nvim", -- An implementation of the Popup API from vim in Neovim - { "windwp/nvim-autopairs", event = "VeryLazy" }, - - { "hrsh7th/nvim-cmp", event = "VeryLazy" }, -- The completion plugin - { "hrsh7th/cmp-buffer", event = "VeryLazy" }, -- buffer completions - { "hrsh7th/cmp-path", event = "VeryLazy" }, -- path completions - { "hrsh7th/cmp-cmdline", event = "VeryLazy" }, -- cmdline completions - { "saadparwaiz1/cmp_luasnip", event = "VeryLazy" }, -- snippet completions - { "hrsh7th/cmp-nvim-lsp", event = "VeryLazy" }, - - -- snippets - { "L3MON4D3/LuaSnip", event = "VeryLazy" }, --snippet engine - { "rafamadriz/friendly-snippets", event = "VeryLazy" }, -- a bunch of snippets to use - { - "dsznajder/vscode-es7-javascript-react-snippets", - run = "yarn install --frozen-lockfile && yarn compile", - event = "VeryLazy" - }, - - -- LSP - { "williamboman/mason.nvim", event = "VeryLazy" }, -- simple to use language server installer - { "williamboman/mason-lspconfig.nvim", event = "VeryLazy" }, - { "neovim/nvim-lspconfig", event = "VeryLazy" }, -- enable LSP - -- { "nvim-treesitter/nvim-treesitter-refactor", event = "VeryLazy" }, - - -- file explorer - -- { - -- 'stevearc/oil.nvim', - -- opts = {}, - -- -- Optional dependencies - -- dependencies = { "nvim-tree/nvim-web-devicons" }, - -- init = function() - - -- end - -- }, - { - "nvim-neo-tree/neo-tree.nvim", - branch = "v3.x", - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-tree/nvim-web-devicons", - "MunifTanjim/nui.nvim", - }, - event = "VeryLazy" - } - , - -- { - -- "akinsho/bufferline.nvim", - -- version = "*", - -- dependencies = { "kyazdani42/nvim-web-devicons" }, - -- }, - { - "ThePrimeagen/harpoon", - branch = "harpoon2", - dependencies = { "nvim-lua/plenary.nvim" }, - event = "VeryLazy" - }, - - { - "folke/zen-mode.nvim", - opts = { - window = { - backdrop = 1 - } - }, - event = "VeryLazy" - }, - - { - "nvim-treesitter/nvim-treesitter", - run = ":TSUpdate", - event = "VeryLazy" - }, - - { - "nvimtools/none-ls.nvim", - event = "VeryLazy" - }, - - { "lukas-reineke/lsp-format.nvim", event = "VeryLazy" }, - -- "Vimjas/vim-python-pep8-indent", - - --telescope - { "nvim-telescope/telescope.nvim", event = "VeryLazy" }, - { "nvim-telescope/telescope-media-files.nvim", event = "VeryLazy" }, - - --comment out - { "tpope/vim-commentary", event = "VeryLazy" }, - { "lukas-reineke/indent-blankline.nvim", event = "VeryLazy" }, - { "windwp/nvim-ts-autotag", event = "VeryLazy" }, - - { - "rebelot/kanagawa.nvim", - lazy = false, - priority = 1000, - }, - { - "folke/which-key.nvim", - lazy = false, - }, - - --scrollbar - { "petertriho/nvim-scrollbar", event = "VeryLazy" }, - - --heirline statusbar - -- "rebelot/heirline.nvim", - - --gitsigns - { "lewis6991/gitsigns.nvim", event = "VeryLazy" }, - - --debugging - { "mfussenegger/nvim-dap", event = "VeryLazy" }, - { - "rcarriga/nvim-dap-ui", - dependencies = { - "mfussenegger/nvim-dap", - "nvim-neotest/nvim-nio" - }, - event = { "VeryLazy" } - }, - - -- "nvim-lualine/lualine.nvim", - - -- "folke/neodev.nvim", - -- "MunifTanjim/nui.nvim", - -- "b0o/schemastore.nvim", - -- { - -- 'Bekaboo/dropbar.nvim', - -- -- optional, but required for fuzzy finder support - -- dependencies = { - -- 'nvim-telescope/telescope-fzf-native.nvim' - -- } - -- }, - -- { - -- "LunarVim/breadcrumbs.nvim", - -- dependencies = { - -- { "SmiteshP/nvim-navic" }, - -- }, - -- }, - -- { - -- "karb94/neoscroll.nvim", - -- }, -}) diff --git a/.config/nvim/lua/user/plugins/autopairs.lua b/.config/nvim/lua/user/plugins/autopairs.lua new file mode 100644 index 0000000..f73b03c --- /dev/null +++ b/.config/nvim/lua/user/plugins/autopairs.lua @@ -0,0 +1,34 @@ +return { + "windwp/nvim-autopairs", + event = "VeryLazy", + opts = { + check_ts = true, + ts_config = { + lua = { "string", "source" }, + javascript = { "string", "template_string" }, + java = false, + }, + disable_filetype = { "TelescopePrompt", "spectre_panel" }, + fast_wrap = { + map = "", + chars = { "{", "[", "(", '"', "'" }, + pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""), + offset = 0, -- Offset from pattern match + end_key = "$", + keys = "qwertyuiopzxcvbnmasdfghjkl", + check_comma = true, + highlight = "PmenuSel", + highlight_grey = "LineNr", + }, + }, + config = function () + require("nvim-autopairs").setup() + -- require ("nvim-autopairs.completion.cmp") + -- local cmp_status_ok, cmp = pcall(require, "cmp") + -- if not cmp_status_ok then + -- return + -- end + -- cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done { map_char = { tex = "" } }) + end +} + diff --git a/.config/nvim/lua/user/plugins/blank_indent_highlight.lua b/.config/nvim/lua/user/plugins/blank_indent_highlight.lua new file mode 100644 index 0000000..3b19dd6 --- /dev/null +++ b/.config/nvim/lua/user/plugins/blank_indent_highlight.lua @@ -0,0 +1,14 @@ +return { + "lukas-reineke/indent-blankline.nvim", + event = "VeryLazy", + opts = { + scope = { + enabled = true, + show_start = false, + show_end = false, + }, + }, + config = function (_, _opts) + require("ibl").setup(_opts) + end +} diff --git a/.config/nvim/lua/user/plugins/gitsigns.lua b/.config/nvim/lua/user/plugins/gitsigns.lua new file mode 100644 index 0000000..554a9a3 --- /dev/null +++ b/.config/nvim/lua/user/plugins/gitsigns.lua @@ -0,0 +1,46 @@ +return { + { + "lewis6991/gitsigns.nvim", + event = "VeryLazy", + opts = { + signs = { + add = { text = "│" }, + change = { text = "│" }, + delete = { text = "_" }, + topdelete = { text = "‾" }, + changedelete = { text = "~" }, + untracked = { text = "┆" }, + }, + signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` + numhl = false, -- Toggle with `:Gitsigns toggle_numhl` + linehl = false, -- Toggle with `:Gitsigns toggle_linehl` + word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` + watch_gitdir = { + interval = 1000, + follow_files = true, + }, + attach_to_untracked = true, + current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame` + current_line_blame_opts = { + virt_text = true, + virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align' + delay = 1000, + ignore_whitespace = false, + }, + current_line_blame_formatter = ", - ", + sign_priority = 6, + update_debounce = 100, + status_formatter = nil, -- Use default + max_file_length = 40000, -- Disable if file is longer than this (in lines) + preview_config = { + -- Options passed to nvim_open_win + border = "single", + style = "minimal", + relative = "cursor", + row = 0, + col = 1, + } + } + }, + +} diff --git a/.config/nvim/lua/user/plugins/harpoon.lua b/.config/nvim/lua/user/plugins/harpoon.lua new file mode 100644 index 0000000..4c732ab --- /dev/null +++ b/.config/nvim/lua/user/plugins/harpoon.lua @@ -0,0 +1,46 @@ +return { + { + "ThePrimeagen/harpoon", + branch = "harpoon2", + dependencies = { "nvim-lua/plenary.nvim", "nvim-telescope/telescope.nvim" }, + event = "VeryLazy", + config = function(_, _opts) + local harpoon = require("harpoon") + -- REQUIRED + harpoon:setup() + -- REQUIRED + + vim.keymap.set("n", "a", function() harpoon:list():add() end) + vim.keymap.set("n", "hm", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end) + + vim.keymap.set("n", "", function() harpoon:list():select(1) end) + vim.keymap.set("n", "", function() harpoon:list():select(2) end) + vim.keymap.set("n", "", function() harpoon:list():select(3) end) + vim.keymap.set("n", "", function() harpoon:list():select(4) end) + + -- Toggle previous & next buffers stored within Harpoon list + vim.keymap.set("n", "hp", function() harpoon:list():prev() end) + vim.keymap.set("n", "hn", function() harpoon:list():next() end) + + local conf = require("telescope.config").values + local function toggle_telescope(harpoon_files) + local file_paths = {} + for _, item in ipairs(harpoon_files.items) do + table.insert(file_paths, item.value) + end + + require("telescope.pickers").new({}, { + prompt_title = "Harpoon", + finder = require("telescope.finders").new_table({ + results = file_paths, + }), + previewer = conf.file_previewer({}), + sorter = conf.generic_sorter({}), + }):find() + end + + vim.keymap.set("n", "", function() toggle_telescope(harpoon:list()) end, + { desc = "Open harpoon window" }) + end + }, +} diff --git a/.config/nvim/lua/user/plugins/neotree.lua b/.config/nvim/lua/user/plugins/neotree.lua new file mode 100644 index 0000000..a14e25c --- /dev/null +++ b/.config/nvim/lua/user/plugins/neotree.lua @@ -0,0 +1,92 @@ +return { + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", + "MunifTanjim/nui.nvim", + }, + event = "VeryLazy", + opts = { + enable_diagnostics = false, + enable_git_status = true, + default_component_configs = { + icon = { + folder_empty = "󰜌", + folder_empty_open = "󰜌", + }, + 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 = "", + }, + }, + }, + document_symbols = { + kinds = { + File = { icon = "󰈙", hl = "Tag" }, + Namespace = { icon = "󰌗", hl = "Include" }, + Package = { icon = "󰏖", hl = "Label" }, + Class = { icon = "󰌗", hl = "Include" }, + Property = { icon = "󰆧", hl = "@property" }, + Enum = { icon = "󰒻", hl = "@number" }, + Function = { icon = "󰊕", hl = "Function" }, + String = { icon = "󰀬", hl = "String" }, + Number = { icon = "󰎠", hl = "Number" }, + Array = { icon = "󰅪", hl = "Type" }, + Object = { icon = "󰅩", hl = "Type" }, + Key = { icon = "󰌋", hl = "" }, + Struct = { icon = "󰌗", hl = "Type" }, + Operator = { icon = "󰆕", hl = "Operator" }, + TypeParameter = { icon = "󰊄", hl = "Type" }, + StaticMethod = { icon = "󰠄 ", hl = "Function" }, + }, + }, + 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 = "", + }, + }, + -- Add this section only if you've configured source selector. + source_selector = { + sources = { + { source = "filesystem", display_name = " 󰉓 Files " }, + { source = "git_status", display_name = " 󰊢 Git " }, + }, + }, + + event_handlers = { + { + event = "neo_tree_buffer_enter", + handler = function(arg) + vim.opt.relativenumber = true + end, + }, + { + event = "file_open_requested", + handler = function() + require("neo-tree.command").execute({ action = "close" }) + end + }, + }, + } +} diff --git a/.config/nvim/lua/user/plugins/nvim_scrollbar.lua b/.config/nvim/lua/user/plugins/nvim_scrollbar.lua new file mode 100644 index 0000000..f122541 --- /dev/null +++ b/.config/nvim/lua/user/plugins/nvim_scrollbar.lua @@ -0,0 +1,5 @@ +return { + "petertriho/nvim-scrollbar", + event = "VeryLazy", + config = true +} diff --git a/.config/nvim/lua/user/plugins/snipptes.lua b/.config/nvim/lua/user/plugins/snipptes.lua new file mode 100644 index 0000000..770e223 --- /dev/null +++ b/.config/nvim/lua/user/plugins/snipptes.lua @@ -0,0 +1,11 @@ +return { + + { "L3MON4D3/LuaSnip", event = "VeryLazy" }, --snippet engine + { "rafamadriz/friendly-snippets", event = "VeryLazy" }, -- a bunch of snippets to use + { + "dsznajder/vscode-es7-javascript-react-snippets", + run = "yarn install --frozen-lockfile && yarn compile", + event = "VeryLazy" + }, + +} diff --git a/.config/nvim/lua/user/plugins/telescope.lua b/.config/nvim/lua/user/plugins/telescope.lua new file mode 100644 index 0000000..7d7bbce --- /dev/null +++ b/.config/nvim/lua/user/plugins/telescope.lua @@ -0,0 +1,121 @@ +return { + { + "nvim-telescope/telescope.nvim", + config = function() + local telescope = require("telescope") + telescope.load_extension("media_files") + + local telescope_builtin = require("telescope.builtin") + + local which_key = require("which-key") + which_key.add({ + { "f", group = "Find" }, + { "ff", "lua require'telescope.builtin'.find_files(require('telescope.themes').get_dropdown({ previewer = false }))", desc = "Find file" }, + { "fw", "lua require'telescope.builtin'.live_grep()", desc = "Grep file" }, + { "fb", "lua require'telescope.builtin'.buffers()", desc = "Find buffer" }, + { "fh", "lua require'telescope.builtin'.resume()", desc = "Resume last search" }, + }) + end, + opts = function() + local actions = require("telescope.actions") + + return { + defaults = { + file_ignore_patterns = { "node_modules", "venv" }, + prompt_prefix = " ", + selection_caret = " ", + path_display = { "smart" }, + + mappings = { + i = { + [""] = actions.cycle_history_next, + [""] = actions.cycle_history_prev, + + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + + [""] = actions.close, + + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + + [""] = actions.select_default, + [""] = actions.select_horizontal, + [""] = actions.select_vertical, + [""] = actions.select_tab, + + [""] = actions.preview_scrolling_up, + [""] = actions.preview_scrolling_down, + + [""] = actions.results_scrolling_up, + [""] = actions.results_scrolling_down, + + [""] = actions.toggle_selection + actions.move_selection_worse, + [""] = actions.toggle_selection + actions.move_selection_better, + [""] = actions.send_to_qflist + actions.open_qflist, + [""] = actions.send_selected_to_qflist + actions.open_qflist, + [""] = actions.complete_tag, + [""] = actions.which_key, -- keys from pressing + }, + + n = { + [""] = actions.close, + [""] = actions.select_default, + [""] = actions.select_horizontal, + [""] = actions.select_vertical, + [""] = actions.select_tab, + + [""] = actions.toggle_selection + actions.move_selection_worse, + [""] = actions.toggle_selection + actions.move_selection_better, + [""] = actions.send_to_qflist + actions.open_qflist, + [""] = actions.send_selected_to_qflist + actions.open_qflist, + + ["j"] = actions.move_selection_next, + ["k"] = actions.move_selection_previous, + ["H"] = actions.move_to_top, + ["M"] = actions.move_to_middle, + ["L"] = actions.move_to_bottom, + + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + ["gg"] = actions.move_to_top, + ["G"] = actions.move_to_bottom, + + [""] = actions.preview_scrolling_up, + [""] = actions.preview_scrolling_down, + + [""] = actions.results_scrolling_up, + [""] = actions.results_scrolling_down, + + ["?"] = actions.which_key, + }, + }, + }, + pickers = { + -- Default configuration for builtin pickers goes here: + -- picker_name = { + -- picker_config_key = value, + -- ... + -- } + -- Now the picker_config_key will be applied every time you call this + -- builtin picker + }, + extensions = { + media_files = { + -- filetypes whitelist + -- defaults to {"png", "jpg", "mp4", "webm", "pdf"} + filetypes = { "png", "webp", "jpg", "jpeg" }, + find_cmd = "rg", -- find command (defaults to `fd`) + }, + -- Your extension configuration goes here: + -- extension_name = { + -- extension_config_key = value, + -- } + -- please take a look at the readme of the extension you want to configure + }, + } + end, + event = "VeryLazy" + }, + { "nvim-telescope/telescope-media-files.nvim", event = "VeryLazy" }, +} diff --git a/.config/nvim/lua/user/plugins/treesitter.lua b/.config/nvim/lua/user/plugins/treesitter.lua new file mode 100644 index 0000000..c6919da --- /dev/null +++ b/.config/nvim/lua/user/plugins/treesitter.lua @@ -0,0 +1,38 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + run = ":TSUpdate", + event = "VeryLazy", + -- init = function(plugin) + -- require("nvim-treesitter") + -- end, + opts = { + ensure_installed = { "python", "rust", "javascript" }, -- one of "all" or a list of languages + ignore_install = { "phpdoc", "comment", "rst" }, -- List of parsers to ignore installing + highlight = { + enable = true, + disable = { "css" }, + }, + autopairs = { + enable = true, + }, + indent = { enable = true }, + autotag = { + enable = true, + }, + refactor = { + highlight_definitions = { + enable = false, + -- Set to false if you have an `updatetime` of ~100. + clear_on_cursor_move = true, + }, + smart_rename = { + enable = false, + keymaps = { + smart_rename = "grr", + }, + }, + }, + }, + }, +} diff --git a/.config/nvim/lua/user/plugins/which_key.lua b/.config/nvim/lua/user/plugins/which_key.lua new file mode 100644 index 0000000..509079e --- /dev/null +++ b/.config/nvim/lua/user/plugins/which_key.lua @@ -0,0 +1,142 @@ +local toggle_gitsigns_blame = function() + local function is_filetype_open(filetype) + for _, buf in ipairs(vim.api.nvim_list_bufs()) do + if vim.api.nvim_buf_is_loaded(buf) and vim.bo[buf].filetype == filetype then + return buf + end + end + return nil + end + + -- check if gitsigns-blame buffer is open + local bufnr = is_filetype_open("gitsigns-blame") + + if bufnr then + vim.api.nvim_buf_delete(bufnr, { force = false }) + else + vim.cmd("Gitsigns blame") + end +end + +return { + "folke/which-key.nvim", + lazy = false, + opts = { + plugins = { + marks = false, -- shows a list of your marks on ' and ` + registers = false, -- shows your registers on " in NORMAL or in INSERT mode + spelling = { + enabled = true, + suggestions = 20, + }, -- use which-key for spelling hints + -- 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, ... + motions = false, -- adds help for motions + text_objects = false, -- help for text objects triggered after entering an operator + windows = false, -- default bindings on + nav = false, -- misc bindings to work with windows + z = false, -- bindings for folds, spelling and others prefixed with z + g = false, -- bindings for prefixed with g + }, + }, + preset = "classic", + keys = { + scroll_down = "", -- binding to scroll down inside the popup + scroll_up = "", -- binding to scroll up inside the popup + }, + win = { + -- border = "single", -- none, single, double, shadow + padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left] + wo = { + 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 = "left", -- align columns left, center or right + }, + filter = function(mapping) -- enable this to hide mappings for which you didn't specify a label + return mapping.desc + end, + show_help = true, -- show help message on the command line when the popup is visible + show_keys = true, -- show the currently pressed key and its label as a message in the command line + triggers = {}, + -- disable the WhichKey popup for certain buf types and file types. + -- Disabled by default for Telescope + disable = { + buftypes = {}, + filetypes = { "TelescopePrompt" }, + }, + }, + config = function() + local which_key = require("which-key") + which_key.add({ + { "", group = "Hotkeys" }, + { "?", ":WhichKey ", desc = "Show keybindings" }, + { "o", ":Oil --float ", desc = "Oil nvim toggle" }, + { "e", ":Neotree toggle position=current ", desc = "File tree toggle" }, + { "F", ":lua vim.lsp.buf.format() ", desc = "Format file" }, + }) + + -- which_key.add({ + -- { "f", group = "Find" }, + -- { "ff", "lua require'telescope.builtin'.find_files(require('telescope.themes').get_dropdown({ previewer = false }))", desc = "Find file" }, + -- { "fw", "lua require'telescope.builtin'.live_grep()", desc = "Grep file" }, + -- { "fb", "lua require'telescope.builtin'.buffers()", desc = "Find buffer" }, + -- { "fh", "lua require'telescope.builtin'.resume()", desc = "Resume last search" }, + -- }) + + which_key.add({ + { "g", group = "Git" }, + { "gb", toggle_gitsigns_blame, desc = "Toggle git blame view" }, + }) + + which_key.add({ + { "z", ":ZenMode", desc = "Zen mode toggle" }, + }) + + which_key.add({ + { "c", group = "Code actions" }, + { "ca", "lua vim.lsp.buf.code_action()", desc = "Show code actions" }, + }) + + which_key.add({ + { "l", "lua vim.diagnostic.setloclist()", desc = "Show diagnostic list" }, + }) + + which_key.add({ + { "d", group = "Dap" }, + { "dr", "DapContinue", desc = "Continue" }, + { "dj", "DapStepInto", desc = "Step into" }, + { "dl", "DapStepOver", desc = "Step over" }, + { "dk", "DapStepOut", desc = "Step out" }, + { "db", "DapToggleBreakpoint", desc = "Toggle breakpoint" }, + { "ds", "DapTerminate", desc = "Terminate" }, + }) + + which_key.add({ + { "t", group = "Tabs" }, + { "tn", "tabnew", desc = "New tab" }, + { "tq", "tabclose", desc = "Close tab" }, + }) + + which_key.add({ + { "g", group = "LSP Actions" }, + { "gD", "lua vim.lsp.buf.declaration()", desc = "Go to declaration" }, + { "gd", "lua vim.lsp.buf.definition()", desc = "Go to definition" }, + { "gi", "lua vim.lsp.buf.implementation()", desc = "Show implementations" }, + { "grr", "lua vim.lsp.buf.rename()", desc = "Rename" }, + { "gr", "lua vim.lsp.buf.references()", desc = "Show references" }, + { "gl", "lua vim.diagnostic.open_float({ border = 'rounded' })", desc = "Show diagnostic at line" }, + }) + + which_key.add({ + { "", "lua vim.lsp.buf.signature_help()", desc = "Signature help" }, + { "K", "lua vim.lsp.buf.hover()", desc = "Signature help" }, + }) + end +} diff --git a/.config/nvim/lua/user/telescope.lua b/.config/nvim/lua/user/telescope.lua deleted file mode 100644 index 7d4df9c..0000000 --- a/.config/nvim/lua/user/telescope.lua +++ /dev/null @@ -1,104 +0,0 @@ -local status_ok, telescope = pcall(require, "telescope") -if not status_ok then - return -end - -telescope.load_extension("media_files") - -local actions = require("telescope.actions") - -telescope.setup({ - defaults = { - file_ignore_patterns = { "node_modules", "venv" }, - prompt_prefix = " ", - selection_caret = " ", - path_display = { "smart" }, - - mappings = { - i = { - [""] = actions.cycle_history_next, - [""] = actions.cycle_history_prev, - - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, - - [""] = actions.close, - - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, - - [""] = actions.select_default, - [""] = actions.select_horizontal, - [""] = actions.select_vertical, - [""] = actions.select_tab, - - [""] = actions.preview_scrolling_up, - [""] = actions.preview_scrolling_down, - - [""] = actions.results_scrolling_up, - [""] = actions.results_scrolling_down, - - [""] = actions.toggle_selection + actions.move_selection_worse, - [""] = actions.toggle_selection + actions.move_selection_better, - [""] = actions.send_to_qflist + actions.open_qflist, - [""] = actions.send_selected_to_qflist + actions.open_qflist, - [""] = actions.complete_tag, - [""] = actions.which_key, -- keys from pressing - }, - - n = { - [""] = actions.close, - [""] = actions.select_default, - [""] = actions.select_horizontal, - [""] = actions.select_vertical, - [""] = actions.select_tab, - - [""] = actions.toggle_selection + actions.move_selection_worse, - [""] = actions.toggle_selection + actions.move_selection_better, - [""] = actions.send_to_qflist + actions.open_qflist, - [""] = actions.send_selected_to_qflist + actions.open_qflist, - - ["j"] = actions.move_selection_next, - ["k"] = actions.move_selection_previous, - ["H"] = actions.move_to_top, - ["M"] = actions.move_to_middle, - ["L"] = actions.move_to_bottom, - - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, - ["gg"] = actions.move_to_top, - ["G"] = actions.move_to_bottom, - - [""] = actions.preview_scrolling_up, - [""] = actions.preview_scrolling_down, - - [""] = actions.results_scrolling_up, - [""] = actions.results_scrolling_down, - - ["?"] = actions.which_key, - }, - }, - }, - pickers = { - -- Default configuration for builtin pickers goes here: - -- picker_name = { - -- picker_config_key = value, - -- ... - -- } - -- Now the picker_config_key will be applied every time you call this - -- builtin picker - }, - extensions = { - media_files = { - -- filetypes whitelist - -- defaults to {"png", "jpg", "mp4", "webm", "pdf"} - filetypes = { "png", "webp", "jpg", "jpeg" }, - find_cmd = "rg", -- find command (defaults to `fd`) - }, - -- Your extension configuration goes here: - -- extension_name = { - -- extension_config_key = value, - -- } - -- please take a look at the readme of the extension you want to configure - }, -}) diff --git a/.config/nvim/lua/user/treesitter.lua b/.config/nvim/lua/user/treesitter.lua deleted file mode 100644 index 4d1d337..0000000 --- a/.config/nvim/lua/user/treesitter.lua +++ /dev/null @@ -1,33 +0,0 @@ -local status_ok, configs = pcall(require, "nvim-treesitter.configs") -if not status_ok then - return -end - -configs.setup({ - ensure_installed = { "python", "rust", "javascript" }, -- one of "all" or a list of languages - ignore_install = { "phpdoc", "comment", "rst" }, -- List of parsers to ignore installing - highlight = { - enable = true, - disable = { "css" }, - }, - autopairs = { - enable = true, - }, - indent = { enable = true }, - autotag = { - enable = true, - }, - refactor = { - highlight_definitions = { - enable = false, - -- Set to false if you have an `updatetime` of ~100. - clear_on_cursor_move = true, - }, - smart_rename = { - enable = false, - keymaps = { - smart_rename = "grr", - }, - }, - }, -}) diff --git a/.config/nvim/lua/user/which_key.lua b/.config/nvim/lua/user/which_key.lua deleted file mode 100644 index 146796b..0000000 --- a/.config/nvim/lua/user/which_key.lua +++ /dev/null @@ -1,141 +0,0 @@ -local status_ok, which_key = pcall(require, "which-key") -if not status_ok then - return -end - -local toggle_gitsigns_blame = function() - local function is_filetype_open(filetype) - for _, buf in ipairs(vim.api.nvim_list_bufs()) do - if vim.api.nvim_buf_is_loaded(buf) and vim.bo[buf].filetype == filetype then - return buf - end - end - return nil - end - - -- check if gitsigns-blame buffer is open - local bufnr = is_filetype_open("gitsigns-blame") - - if bufnr then - vim.api.nvim_buf_delete(bufnr, { force = false }) - else - vim.cmd("Gitsigns blame") - end -end - -which_key.setup({ - plugins = { - marks = false, -- shows a list of your marks on ' and ` - registers = false, -- shows your registers on " in NORMAL or in INSERT mode - spelling = { - enabled = true, - suggestions = 20, - }, -- use which-key for spelling hints - -- 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, ... - motions = false, -- adds help for motions - text_objects = false, -- help for text objects triggered after entering an operator - windows = false, -- default bindings on - nav = false, -- misc bindings to work with windows - z = false, -- bindings for folds, spelling and others prefixed with z - g = false, -- bindings for prefixed with g - }, - }, - preset = "classic", - keys = { - scroll_down = "", -- binding to scroll down inside the popup - scroll_up = "", -- binding to scroll up inside the popup - }, - win = { - -- border = "single", -- none, single, double, shadow - padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left] - wo = { - 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 = "left", -- align columns left, center or right - }, - filter = function(mapping) -- enable this to hide mappings for which you didn't specify a label - return mapping.desc - end, - show_help = true, -- show help message on the command line when the popup is visible - show_keys = true, -- show the currently pressed key and its label as a message in the command line - triggers = {}, - -- disable the WhichKey popup for certain buf types and file types. - -- Disabled by default for Telescope - disable = { - buftypes = {}, - filetypes = { "TelescopePrompt" }, - }, -}) - -which_key.add({ - { "", group = "Hotkeys" }, - { "?", ":WhichKey ", desc = "Show keybindings" }, - { "o", ":Oil --float ", desc = "Oil nvim toggle" }, - { "e", ":Neotree toggle position=current ", desc = "File tree toggle" }, - { "F", ":lua vim.lsp.buf.format() ", desc = "Format file" }, -}) - -which_key.add({ - { "f", group = "Find" }, - { "ff", "lua require'telescope.builtin'.find_files(require('telescope.themes').get_dropdown({ previewer = false }))", desc = "Find file" }, - { "fw", "lua require'telescope.builtin'.live_grep()", desc = "Grep file" }, - { "fb", "lua require'telescope.builtin'.buffers()", desc = "Find buffer" }, - { "fh", "lua require'telescope.builtin'.resume()", desc = "Resume last search" }, -}) - -which_key.add({ - { "g", group = "Git" }, - { "gb", toggle_gitsigns_blame, desc = "Toggle git blame view" }, -}) - -which_key.add({ - { "z", ":ZenMode", desc = "Zen mode toggle" }, -}) - -which_key.add({ - { "c", group = "Code actions" }, - { "ca", "lua vim.lsp.buf.code_action()", desc = "Show code actions" }, -}) - -which_key.add({ - { "l", "lua vim.diagnostic.setloclist()", desc = "Show diagnostic list" }, -}) - -which_key.add({ - { "d", group = "Dap" }, - { "dr", "DapContinue", desc = "Continue" }, - { "dj", "DapStepInto", desc = "Step into" }, - { "dl", "DapStepOver", desc = "Step over" }, - { "dk", "DapStepOut", desc = "Step out" }, - { "db", "DapToggleBreakpoint", desc = "Toggle breakpoint" }, - { "ds", "DapTerminate", desc = "Terminate" }, -}) - -which_key.add({ - { "t", group = "Tabs" }, - { "tn", "tabnew", desc = "New tab" }, - { "tq", "tabclose", desc = "Close tab" }, -}) - -which_key.add({ - { "g", group = "LSP Actions" }, - { "gD", "lua vim.lsp.buf.declaration()", desc = "Go to declaration" }, - { "gd", "lua vim.lsp.buf.definition()", desc = "Go to definition" }, - { "gi", "lua vim.lsp.buf.implementation()", desc = "Show implementations" }, - { "grr", "lua vim.lsp.buf.rename()", desc = "Rename" }, - { "gr", "lua vim.lsp.buf.references()", desc = "Show references" }, - { "gl", "lua vim.diagnostic.open_float({ border = 'rounded' })", desc = "Show diagnostic at line" }, -}) - -which_key.add({ - { "", "lua vim.lsp.buf.signature_help()", desc = "Signature help" }, - { "K", "lua vim.lsp.buf.hover()", desc = "Signature help" }, -})