From f4bc3252eeb4c8bcd5346b9837b7e1138293148e Mon Sep 17 00:00:00 2001 From: Alexander Navarro Date: Wed, 19 Apr 2023 18:14:25 -0400 Subject: [PATCH 01/17] refactor nvim config --- .gitmodules | 2 +- config/{nvim => AstroNvim} | 0 config/nvim.old/acsii_art.txt | 11 -- config/nvim.old/init.lua.old | 14 -- config/nvim.old/lua/autocommands.lua | 17 -- config/nvim.old/lua/keys.lua | 51 ------ config/nvim.old/lua/options.lua | 63 ------- .../nvim.old/lua/plugins/autocompletion.lua | 50 ------ config/nvim.old/lua/plugins/autopairs.lua | 2 - config/nvim.old/lua/plugins/bufferline.lua | 22 --- config/nvim.old/lua/plugins/colorscheme.lua | 81 --------- config/nvim.old/lua/plugins/dashboard.lua | 33 ---- config/nvim.old/lua/plugins/focus.lua | 72 -------- config/nvim.old/lua/plugins/gitsigns.lua | 91 ---------- config/nvim.old/lua/plugins/harpoon.lua | 27 --- config/nvim.old/lua/plugins/indent-lines.lua | 25 --- config/nvim.old/lua/plugins/init.lua | 62 ------- config/nvim.old/lua/plugins/lsp.lua | 160 ------------------ .../lua/plugins/nvim-comment-frame.lua | 38 ----- .../nvim.old/lua/plugins/nvim-toggleterm.lua | 47 ----- config/nvim.old/lua/plugins/nvim-tree.lua | 53 ------ config/nvim.old/lua/plugins/prettyfolds.lua | 3 - config/nvim.old/lua/plugins/projects.lua | 36 ---- config/nvim.old/lua/plugins/telescope.lua | 80 --------- config/nvim.old/lua/plugins/treesitter.lua | 37 ---- .../nvim.old/lua/plugins/ts-node-action.lua | 3 - config/nvim/LICENSE.md | 19 +++ config/nvim/README.md | 130 ++++++++++++++ config/nvim/init.lua | 127 ++++++++++++++ config/nvim/lazy-lock.json | 26 +++ config/nvim/lua/aleidk/IDE/init.lua | 1 + config/nvim/lua/aleidk/IDE/lsp.lua | 139 +++++++++++++++ config/nvim/lua/aleidk/autocmds.lua | 10 ++ config/nvim/lua/aleidk/keymaps.lua | 9 + config/nvim/lua/aleidk/options.lua | 45 +++++ config/nvim/lua/aleidk/plugins/gitsigns.lua | 14 ++ config/nvim/lua/aleidk/plugins/init.lua | 115 +++++++++++++ config/nvim/lua/custom/plugins/init.lua | 5 + .../nvim/lua/kickstart/plugins/autoformat.lua | 74 ++++++++ config/nvim/lua/kickstart/plugins/debug.lua | 83 +++++++++ 40 files changed, 798 insertions(+), 1079 deletions(-) rename config/{nvim => AstroNvim} (100%) delete mode 100644 config/nvim.old/acsii_art.txt delete mode 100644 config/nvim.old/init.lua.old delete mode 100644 config/nvim.old/lua/autocommands.lua delete mode 100644 config/nvim.old/lua/keys.lua delete mode 100644 config/nvim.old/lua/options.lua delete mode 100644 config/nvim.old/lua/plugins/autocompletion.lua delete mode 100644 config/nvim.old/lua/plugins/autopairs.lua delete mode 100644 config/nvim.old/lua/plugins/bufferline.lua delete mode 100644 config/nvim.old/lua/plugins/colorscheme.lua delete mode 100644 config/nvim.old/lua/plugins/dashboard.lua delete mode 100644 config/nvim.old/lua/plugins/focus.lua delete mode 100644 config/nvim.old/lua/plugins/gitsigns.lua delete mode 100644 config/nvim.old/lua/plugins/harpoon.lua delete mode 100644 config/nvim.old/lua/plugins/indent-lines.lua delete mode 100644 config/nvim.old/lua/plugins/init.lua delete mode 100644 config/nvim.old/lua/plugins/lsp.lua delete mode 100644 config/nvim.old/lua/plugins/nvim-comment-frame.lua delete mode 100644 config/nvim.old/lua/plugins/nvim-toggleterm.lua delete mode 100644 config/nvim.old/lua/plugins/nvim-tree.lua delete mode 100644 config/nvim.old/lua/plugins/prettyfolds.lua delete mode 100644 config/nvim.old/lua/plugins/projects.lua delete mode 100644 config/nvim.old/lua/plugins/telescope.lua delete mode 100644 config/nvim.old/lua/plugins/treesitter.lua delete mode 100644 config/nvim.old/lua/plugins/ts-node-action.lua create mode 100644 config/nvim/LICENSE.md create mode 100644 config/nvim/README.md create mode 100644 config/nvim/init.lua create mode 100644 config/nvim/lazy-lock.json create mode 100644 config/nvim/lua/aleidk/IDE/init.lua create mode 100644 config/nvim/lua/aleidk/IDE/lsp.lua create mode 100644 config/nvim/lua/aleidk/autocmds.lua create mode 100644 config/nvim/lua/aleidk/keymaps.lua create mode 100644 config/nvim/lua/aleidk/options.lua create mode 100644 config/nvim/lua/aleidk/plugins/gitsigns.lua create mode 100644 config/nvim/lua/aleidk/plugins/init.lua create mode 100644 config/nvim/lua/custom/plugins/init.lua create mode 100644 config/nvim/lua/kickstart/plugins/autoformat.lua create mode 100644 config/nvim/lua/kickstart/plugins/debug.lua diff --git a/.gitmodules b/.gitmodules index 8ae5612..eeaa940 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,5 +1,5 @@ [submodule "config/nvim"] - path = config/nvim + path = config/AstroNvim url = https://github.com/AstroNvim/AstroNvim [submodule "config/alacritty/themes/catppuccin"] path = config/alacritty/themes/catppuccin diff --git a/config/nvim b/config/AstroNvim similarity index 100% rename from config/nvim rename to config/AstroNvim diff --git a/config/nvim.old/acsii_art.txt b/config/nvim.old/acsii_art.txt deleted file mode 100644 index 8e199d6..0000000 --- a/config/nvim.old/acsii_art.txt +++ /dev/null @@ -1,11 +0,0 @@ - ████ ███ █████ █████ - ░░███ ░░░ ░░███ ░░███ - ██████ ░███ ██████ ████ ███████ ░███ █████ - ░░░░░███ ░███ ███░░███░░███ ███░░███ ░███░░███ - ███████ ░███ ░███████ ░███ ░███ ░███ ░██████░ - ███░░███ ░███ ░███░░░ ░███ ░███ ░███ ░███░░███ -░░████████ █████░░██████ █████░░████████ ████ █████ - ░░░░░░░░ ░░░░░ ░░░░░░ ░░░░░ ░░░░░░░░ ░░░░ ░░░░░ - - - diff --git a/config/nvim.old/init.lua.old b/config/nvim.old/init.lua.old deleted file mode 100644 index 3622233..0000000 --- a/config/nvim.old/init.lua.old +++ /dev/null @@ -1,14 +0,0 @@ --- Siable netrw -vim.g.loaded = 1 -vim.g.loaded_netrwPlugin = 1 - --- native neovim config -require("options") - --- keybindings config -require("keys") - --- Autocmd config -require("autocommands") - -require("plugins") diff --git a/config/nvim.old/lua/autocommands.lua b/config/nvim.old/lua/autocommands.lua deleted file mode 100644 index 114162c..0000000 --- a/config/nvim.old/lua/autocommands.lua +++ /dev/null @@ -1,17 +0,0 @@ -local cmd = vim.api.nvim_create_autocmd - --- cmd({"BufNewFile", "BufFilePre", "BufRead"}, { --- pattern = {"*.md"}, --- callback = function() vim.opt.filetype = "markdown" end --- }) - -cmd("InsertEnter", - {pattern = "*", command = "norm zz", desc = "Center line on insert mode"}) - --- highlight yank selection -cmd("TextYankPost", { - pattern = "*", - callback = function() vim.highlight.on_yank() end, - desc = "Highligth line on yank" -}) - diff --git a/config/nvim.old/lua/keys.lua b/config/nvim.old/lua/keys.lua deleted file mode 100644 index 016a65f..0000000 --- a/config/nvim.old/lua/keys.lua +++ /dev/null @@ -1,51 +0,0 @@ ---[[ - -Modes: - -| String value | Help page | Affected modes | Vimscript equivalent | -| -------------|------------------|-----------------------------------------------|-----------------------| -| '' | mapmode-nvo | Normal, Visual, Select, Operator-pending | :map | -| 'n' | mapmode-n | Normal | :nmap | -| 'v' | mapmode-v | Visual and Select | :vmap | -| 's' | mapmode-s | Select | :smap | -| 'x' | mapmode-x | Visual | :xmap | -| 'o' | mapmode-o | Operator-pending | :omap | -| '!' | mapmode-ic | Insert and Command-line | :map! | -| 'i' | mapmode-i | Insert | :imap | -| 'l' | mapmode-l | Insert, Command-line, Lang-Arg | :lmap | -| 'c' | mapmode-c | Command-line | :cmap | -| 't' | mapmode-t | Terminal | :tmap | - -Define Mapping with: -vim.keymap.set(mode, keys, action[, options]) - ---]] - --- Leader Key -vim.g.mapleader = ' ' - -vim.keymap.set('n', "", ":noh", { desc = "Remove search Highlight", silent = true }) - --- local function changeComment() --- local table = vim.opt.fo:get() --- local enabled = tagle.c == true && tagle.r == true && tagle.o == true --- end - -vim.keymap.set('', "tc", [[if &fo =~ 'cro' | set fo-=cro | else | set fo+=cro | endif]], { desc = "Toggle autocomments", silent = true }) - -vim.keymap.set('', "ti", ":setlocal autoindent!", { desc = "toggle auto indent"}) - -vim.keymap.set('', "ts", ":setlocal spell!", { desc = "Toggle spell checker", silent = true }) - -vim.keymap.set('t', '', [[]], { desc = "Exit terminal with Esc", silent = true }) - -vim.keymap.set('n', '', ':w', { desc = "Save file", silent = true }) - -vim.keymap.set({ 'n', 'v', 'i' }, '', ':m .+1==', { desc = "Move current line down", silent = true }) - -vim.keymap.set({ 'n', 'v', 'i' }, '', ':m .-2==', { desc = "Move current line up", silent = true }) - - -vim.keymap.set('v', '<', '', '>gv', { desc = "Better indentation in visual mode", silent = true }) diff --git a/config/nvim.old/lua/options.lua b/config/nvim.old/lua/options.lua deleted file mode 100644 index efcb1a7..0000000 --- a/config/nvim.old/lua/options.lua +++ /dev/null @@ -1,63 +0,0 @@ --------------------------------------------------------------------------------- --- Native Neovim Config -- --------------------------------------------------------------------------------- - ---[[ - - vim.opt.{option} -> :set - vim.opt_global.{option} -> :setglobal - vim.opt_local.{option} -> :setlocal - ---]] - - --- Set Shell -vim.opt.shell = "/usr/bin/env bash" - -vim.g.python3_host_prog = "/usr/bin/python3" - --- Keep the cursor centered by X rows from top / bottom -vim.opt.scrolloff = 15 - --- Use System clipboard -vim.opt.clipboard = "unnamedplus" - --- Enable Mouse -vim.opt.mouse = "a" - --- Set Numbers -vim.opt.number = true -vim.opt.relativenumber = true - --- Identation -local indent = 2 -vim.opt.tabstop = indent -vim.opt.shiftwidth = indent -vim.opt.softtabstop = indent - --- Ignore case when searching -vim.opt.ignorecase = true - --- Override the 'ignorecase' option if the search pattern contains case characters. -vim.opt.smartcase = true - --- Wrap Search -vim.opt.wrapscan = true - --- Autocompletion with 'wildchar' -vim.opt.wildmode = "longest,list,full" - --- Fix Sppliting -vim.opt.splitbelow = true -vim.opt.splitright = true - --- Set undofile -vim.opt.undofile = true -vim.opt.undodir = os.getenv("HOME") .. "/.nvim/undo" -vim.opt.undolevels = 1000 - --- Open already open windows -vim.opt.switchbuf = 'usetab' - --- Auto add comments on new line if prev was a comment -vim.opt.fo:append({ cro = true }) diff --git a/config/nvim.old/lua/plugins/autocompletion.lua b/config/nvim.old/lua/plugins/autocompletion.lua deleted file mode 100644 index 7578384..0000000 --- a/config/nvim.old/lua/plugins/autocompletion.lua +++ /dev/null @@ -1,50 +0,0 @@ --- luasnip setup -local luasnip = require 'luasnip' -local cmp = require 'cmp' - -cmp.setup { - snippet = { - expand = function(args) require('luasnip').lsp_expand(args.body) end - }, - mapping = { - [''] = cmp.mapping.select_prev_item(), - [''] = cmp.mapping.select_next_item(), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.close(), - [''] = cmp.mapping.confirm { - behavior = cmp.ConfirmBehavior.Replace, - select = true - }, - [''] = function(fallback) - if vim.fn.pumvisible() == 1 then - vim.fn.feedkeys(vim.api.nvim_replace_termcodes('', true, - true, true), 'n') - elseif luasnip.expand_or_jumpable() then - vim.fn.feedkeys(vim.api.nvim_replace_termcodes( - 'luasnip-expand-or-jump', true, true, - true), '') - else - fallback() - end - end, - [''] = function(fallback) - if vim.fn.pumvisible() == 1 then - vim.fn.feedkeys(vim.api.nvim_replace_termcodes('', true, - true, true), 'n') - elseif luasnip.jumpable(-1) then - vim.fn.feedkeys(vim.api.nvim_replace_termcodes( - 'luasnip-jump-prev', true, true, true), - '') - else - fallback() - end - end - }, - sources = { - {name = 'nvim_lsp'}, {name = 'luasnip'}, {name = "nvim_lua"}, - {name = 'path'}, {name = 'buffer'}, {name = 'calc'}, - {name = 'treesitter'} - } -} diff --git a/config/nvim.old/lua/plugins/autopairs.lua b/config/nvim.old/lua/plugins/autopairs.lua deleted file mode 100644 index deeac60..0000000 --- a/config/nvim.old/lua/plugins/autopairs.lua +++ /dev/null @@ -1,2 +0,0 @@ -require('nvim-autopairs').setup() - diff --git a/config/nvim.old/lua/plugins/bufferline.lua b/config/nvim.old/lua/plugins/bufferline.lua deleted file mode 100644 index 4dc0347..0000000 --- a/config/nvim.old/lua/plugins/bufferline.lua +++ /dev/null @@ -1,22 +0,0 @@ -local function config() - require("bufferline").setup({ - options = { - diagnostics = "nvim_lsp", - diagnostics_update_in_insert = true, - color_icons = true, - show_close_icon = false - } - }) - - vim.keymap.set('n', 'H', ':BufferLineCyclePrev', { desc = "Go to prev buffer", silent = true }) - vim.keymap.set('n', 'L', ':BufferLineCycleNext', { desc = "Go to next buffer", silent = true }) - vim.keymap.set('n', 'c', ':bdelete', { desc = "Close current buffer", silent = true }) - vim.keymap.set('n', 'C', ':bdelete!', { desc = "Close current buffer whitout saving", silent = true }) -end - -return { - 'akinsho/bufferline.nvim', - tag = "v2.*", - requires = 'kyazdani42/nvim-web-devicons', - config = config -} diff --git a/config/nvim.old/lua/plugins/colorscheme.lua b/config/nvim.old/lua/plugins/colorscheme.lua deleted file mode 100644 index 83c6a18..0000000 --- a/config/nvim.old/lua/plugins/colorscheme.lua +++ /dev/null @@ -1,81 +0,0 @@ -local function config() - - local catppuccin = require("catppuccin") - - vim.g.catppuccin_flavour = "mocha" - - vim.cmd [[colorscheme catppuccin]] - - -- configure it - catppuccin.setup({ - transparent_background = true, - term_colors = false, - styles = { - comments = {"italic"}, - conditionals = {"italic"}, - loops = {"italic"}, - functions = {"italic"}, - keywords = {"italic"}, - strings = {"italic"}, - variables = {"italic"}, - numbers = {}, - booleans = {}, - properties = {}, - types = {}, - operators = {} - }, - integrations = { - treesitter = true, - native_lsp = { - enabled = true, - virtual_text = { - errors = {"italic"}, - hints = {"italic"}, - warnings = {"italic"}, - information = {"italic"} - }, - underlines = { - errors = {"underline"}, - hints = {"underline"}, - warnings = {"underline"}, - information = {"underline"} - } - }, - lsp_trouble = true, - cmp = true, - lsp_saga = true, - gitgutter = false, - gitsigns = true, - telescope = true, - nvimtree = { - enabled = true, - show_root = true, - transparent_panel = true - }, - indent_blankline = {enabled = true, colored_indent_levels = true}, - neotree = { - enabled = false, - show_root = true, - transparent_panel = false - }, - dap = {enabled = false, enable_ui = false}, - which_key = true, - dashboard = true, - neogit = false, - vim_sneak = false, - fern = false, - barbar = true, - bufferline = true, - markdown = true, - lightspeed = false, - ts_rainbow = true, - hop = false, - notify = true, - telekasten = true, - symbols_outline = true, - mini = false - } - }) -end - -return {"catppuccin/nvim", as = "catppuccin", config = config} diff --git a/config/nvim.old/lua/plugins/dashboard.lua b/config/nvim.old/lua/plugins/dashboard.lua deleted file mode 100644 index 7299183..0000000 --- a/config/nvim.old/lua/plugins/dashboard.lua +++ /dev/null @@ -1,33 +0,0 @@ --- Default FZF -vim.g.dashboard_default_executive = "telescope" - --- Custom Shortcuts --- TODO: Change this for telescope equivalents -vim.api.nvim_set_keymap('n', 'db', ":DashboardJumpMark", - {silent = true}) -vim.api.nvim_set_keymap('n', 'dh', ":DashboardFindHistory", - {silent = true}) -vim.api.nvim_set_keymap('n', 'df', ":DashboardFindFile", - {silent = true}) -vim.api.nvim_set_keymap('n', 'dn', ":DashboardNewFile", - {silent = true}) -vim.api.nvim_set_keymap('n', 'da', ":DashboardFindWord", - {silent = true}) -vim.api.nvim_set_keymap('n', 'dc', ":DashboardChangeColorscheme", - {silent = true}) - --- Show mappings -vim.g.dashboard_custom_shortcut = { - last_session = 'SPC s l', - book_marks = 'SPC d b', - find_history = 'SPC d h', - find_file = 'SPC d f', - new_file = 'SPC d n', - find_word = 'SPC d a', - change_colorscheme = 'SPC d c' -} - --- Hide tabline on dashboard -vim.cmd([[ - autocmd FileType dashboard set showtabline=0 | autocmd WinLeave set showtabline=2 - ]]) diff --git a/config/nvim.old/lua/plugins/focus.lua b/config/nvim.old/lua/plugins/focus.lua deleted file mode 100644 index e46f903..0000000 --- a/config/nvim.old/lua/plugins/focus.lua +++ /dev/null @@ -1,72 +0,0 @@ -local focus = require("focus") - -local options = { - -- Completely disable this plugin - -- Default: true - enable = true, - - -- Force width for the d window - -- Default: Calculated based on golden ratio - -- width = 120 - - -- Force height for the d window - -- Default: Calculated based on golden ratio - -- height = 40 - - -- Sets the width of directory tree buffers such as NerdTree, NvimTree and CHADTree - -- Default: vim.g.nvim_tree_width or 30 - -- treewidth = 20 - - -- Displays a cursorline in the ed window only - -- Not displayed in uned windows - -- Default: true - -- cursorline = false - - -- Displays a sign column in the ed window only - -- Not displayed in uned windows - -- Default: true - -- signcolumn = false - - -- Displays line numbers in the ed window only - -- Not displayed in uned windows - -- Default: true - number = true, - - -- Displays relative line numbers in the ed window only - -- Not displayed in uned windows - -- See :h relativenumber - -- Default: false - relativenumber = true, - - -- Displays hybrid line numbers in the ed window only - -- Not displayed in uned windows - -- Combination of :h relativenumber, but also displays the line number of the current line only - -- Default: false - -- hybridnumber = true - - -- Enable auto highlighting for ed/unfocussed windows - -- Default: false - winhighlight = true, -} - ----------------------------------------------------------------------- --- Mappings -- ----------------------------------------------------------------------- - -local function focusmap(direction) - vim.keymap.set("n", "", function() - focus.split_command(direction) - end, { desc = "Change or create focused window" }) -end - -focusmap("h") -focusmap("j") -focusmap("k") -focusmap("l") - -return { - "beauwilliams/focus.nvim", - config = function() - require("focus").setup(options) - end, -} diff --git a/config/nvim.old/lua/plugins/gitsigns.lua b/config/nvim.old/lua/plugins/gitsigns.lua deleted file mode 100644 index 123041d..0000000 --- a/config/nvim.old/lua/plugins/gitsigns.lua +++ /dev/null @@ -1,91 +0,0 @@ -local mapper = require("nvim-mapper") - -require('gitsigns').setup { - signs = { - add = { - hl = 'GitSignsAdd', - text = '│', - numhl = 'GitSignsAddNr', - linehl = 'GitSignsAddLn' - }, - change = { - hl = 'GitSignsChange', - text = '│', - numhl = 'GitSignsChangeNr', - linehl = 'GitSignsChangeLn' - }, - delete = { - hl = 'GitSignsDelete', - text = '_', - numhl = 'GitSignsDeleteNr', - linehl = 'GitSignsDeleteLn' - }, - topdelete = { - hl = 'GitSignsDelete', - text = '‾', - numhl = 'GitSignsDeleteNr', - linehl = 'GitSignsDeleteLn' - }, - changedelete = { - hl = 'GitSignsChange', - text = '~', - numhl = 'GitSignsChangeNr', - linehl = 'GitSignsChangeLn' - } - }, - 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` - keymaps = { - -- Default keymap options - noremap = true, - - ['n ]h'] = { - expr = true, - "&diff ? ']c' : 'lua require\"gitsigns.actions\".next_hunk()'" - }, - ['n [h'] = { - expr = true, - "&diff ? '[c' : 'lua require\"gitsigns.actions\".prev_hunk()'" - }, - - ['n gs'] = 'lua require"gitsigns".stage_hunk()', - ['v gs'] = 'lua require"gitsigns".stage_hunk({vim.fn.line("."), vim.fn.line("v")})', - ['n gu'] = 'lua require"gitsigns".undo_stage_hunk()', - ['n gr'] = 'lua require"gitsigns".reset_hunk()', - ['v gr'] = 'lua require"gitsigns".reset_hunk({vim.fn.line("."), vim.fn.line("v")})', - ['n gR'] = 'lua require"gitsigns".reset_buffer()', - ['n gp'] = 'lua require"gitsigns".preview_hunk()', - ['n gb'] = 'lua require"gitsigns".blame_line(true)', - ['n gS'] = 'lua require"gitsigns".stage_buffer()', - ['n gU'] = 'lua require"gitsigns".reset_buffer_index()', - - -- Text objects - ['o ih'] = ':lua require"gitsigns.actions".select_hunk()', - ['x ih'] = ':lua require"gitsigns.actions".select_hunk()' - }, - watch_index = {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 - }, - current_line_blame_formatter_opts = {relative_time = false}, - sign_priority = 6, - update_debounce = 100, - status_formatter = nil, -- Use default - max_file_length = 40000, - preview_config = { - -- Options passed to nvim_open_win - border = 'single', - style = 'minimal', - relative = 'cursor', - row = 0, - col = 1 - }, - diff_opts = {internal = true}, -- If vim.diff or luajit is present - yadm = {enable = false} -} diff --git a/config/nvim.old/lua/plugins/harpoon.lua b/config/nvim.old/lua/plugins/harpoon.lua deleted file mode 100644 index 35e697e..0000000 --- a/config/nvim.old/lua/plugins/harpoon.lua +++ /dev/null @@ -1,27 +0,0 @@ -local mapper = require("nvim-mapper") - -require("harpoon").setup({ - global_settings = {save_on_toggle = false, save_on_change = true} -}) - --- Mark list -mapper.map('n', 'mq', - [[:lua require("harpoon.ui").toggle_quick_menu()]], - {silent = true, noremap = true}, "harpoon", "quick_menu", - "Open list of marked files") - --- Mark File -mapper.map('n', 'ma', [[:lua require("harpoon.mark").add_file()]], - {silent = true, noremap = true}, "harpoon", "add_file", - "Add current file to mark list") - --- Open marked file -mapper.map('n', 'mj', [[:lua require("harpoon.ui").nav_file(1)]], - {silent = true, noremap = true}, "harpoon", "file_navigation_1", - "Go to marked file 1") -mapper.map('n', 'mk', [[:lua require("harpoon.ui").nav_file(2)]], - {silent = true, noremap = true}, "harpoon", "file_navigation_2", - "Go to marked file 2") -mapper.map('n', 'ml', [[:lua require("harpoon.ui").nav_file(3)]], - {silent = true, noremap = true}, "harpoon", "file_navigation_3", - "Go to marked file 3") diff --git a/config/nvim.old/lua/plugins/indent-lines.lua b/config/nvim.old/lua/plugins/indent-lines.lua deleted file mode 100644 index 69e5df1..0000000 --- a/config/nvim.old/lua/plugins/indent-lines.lua +++ /dev/null @@ -1,25 +0,0 @@ -local function config() - - -- vim.opt.list = true - -- vim.opt.listchars:append "space:⋅" - -- vim.opt.listchars:append "eol:↴" - - require("indent_blankline").setup { - space_char_blankline = " ", - show_current_context = true, - show_current_context_start = false - } - - -- vim.g.indent_blankline_char_list = {"│"} - -- vim.g.indentLine_enabled = 1 - vim.g.indent_blankline_show_trailing_blankline_indent = false - vim.g.indent_blankline_filetype_exclude = { - "help", "terminal", "dashboard", "nvim-tree" - } - vim.g.indent_blankline_buftype_exclude = {"terminal"} - vim.g.indent_blankline_show_first_indent_level = false - vim.g.indent_blankline_use_treesitter = true - -end - -return {"lukas-reineke/indent-blankline.nvim", config = config} diff --git a/config/nvim.old/lua/plugins/init.lua b/config/nvim.old/lua/plugins/init.lua deleted file mode 100644 index fd8fd26..0000000 --- a/config/nvim.old/lua/plugins/init.lua +++ /dev/null @@ -1,62 +0,0 @@ -local active_plugins = { - "focus", - "colorscheme", - "nvim-tree", - "bufferline", - "treesitter", - "prettyfolds", - "indent-lines", - "lsp", - "telescope", -} - ---[[ - Auto update plugins from outside neomvim - nvim --headless -c 'autocmd User PackerComplete quitall' -c 'PackerSync' ---]] --- -local ensure_packer = function() - local fn = vim.fn - local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim" - if fn.empty(fn.glob(install_path)) > 0 then - fn.system({ - "git", - "clone", - "--depth", - "1", - "https://github.com/wbthomason/packer.nvim", - install_path, - }) - vim.cmd([[packadd packer.nvim]]) - return true - end - return false -end - -local packer_bootstrap = ensure_packer() - -require("packer").startup({ - function(use) - use("wbthomason/packer.nvim") - - for _, name in ipairs(active_plugins) do - local ok, plugin = pcall(require, "plugins." .. name) - if ok then - use(plugin) - else - print("Error loading " .. name .. "In: " .. plugin) - end - end - - if packer_bootstrap then - require("packer").sync() - end - end, - config = { - display = { - open_fn = function() - return require("packer.util").float({ border = "single" }) - end, - }, - }, -}) diff --git a/config/nvim.old/lua/plugins/lsp.lua b/config/nvim.old/lua/plugins/lsp.lua deleted file mode 100644 index 4cba9fc..0000000 --- a/config/nvim.old/lua/plugins/lsp.lua +++ /dev/null @@ -1,160 +0,0 @@ ---[[ - - LSP Server: code completition, references for variables and other stuff. - Linter: Code rules for consistency. - Formatter: Code style for eye candy. - Debugger: well... a debugger... - ---]] - --- FIXME: Refactor this code so it's more readable - -local function setup() - local lsp = require("lsp-zero") - local cmp = require("cmp") - local null_ls = require("null-ls") - -- local mason_null_ls = require("mason-null-ls") - - lsp.preset("recommended") - - lsp.nvim_workspace({ - library = vim.api.nvim_get_runtime_file("", true), - }) - - local cmp_select = { behavior = cmp.SelectBehavior.Select } - - lsp.setup_nvim_cmp({ - mapping = lsp.defaults.cmp_mappings({ - [""] = cmp.mapping.select_prev_item(cmp_select), - [""] = cmp.mapping.select_next_item(cmp_select), - }), - - sources = { - { name = "path" }, - { name = "nvim_lsp", keyword_length = 3 }, - { name = "luasnip", keyword_length = 2 }, - }, - }) - - lsp.set_preferences({ - set_lsp_keymaps = false, - }) - - vim.keymap.set("n", "K", function() - vim.lsp.buf.hover() - end, { desc = "Show lsp info of the symbol under the cursor", silent = true }) - vim.keymap.set("n", "gd", function() - vim.lsp.buf.definition() - end, { desc = "Go to definition", silent = true }) - vim.keymap.set("n", "gD", function() - vim.lsp.buf.declaration() - end, { desc = "Go to declaration", silent = true }) - vim.keymap.set("n", "gi", function() - vim.lsp.buf.implementation() - end, { desc = "Go to implementation", silent = true }) - vim.keymap.set("n", "go", function() - vim.lsp.buf.type_definition() - end, { desc = "Go to definition of the type", silent = true }) - vim.keymap.set("n", "gr", function() - vim.lsp.buf.references() - end, { desc = "List references in quickfix window", silent = true }) - vim.keymap.set("n", "K", function() - vim.lsp.buf.signature_help() - end, { desc = "Show signature", silent = true }) - vim.keymap.set("n", "lr", function() - vim.lsp.buf.rename() - end, { desc = "Rename all references", silent = true }) - vim.keymap.set("n", "la", function() - vim.lsp.buf.code_action() - end, { desc = "Code action", silent = true }) - vim.keymap.set("n", "lj", function() - vim.diagnostic.goto_next() - end, { desc = "Go to next diagnostics", silent = true }) - vim.keymap.set("n", "lk", function() - vim.diagnostic.goto_prev() - end, { desc = "Go to prev diagnostics", silent = true }) - - lsp.setup() - - local null_linters = null_ls.builtins.diagnostics - local null_formatters = null_ls.builtins.formatting - - local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) - - local lsp_formatting = function(bufnr) - vim.lsp.buf.format({ - filter = function(client) - -- apply whatever logic you want (in this example, we'll only use null-ls) - return client.name == "null-ls" - end, - bufnr = bufnr, - }) - end - - null_ls.setup({ - on_attach = function(client, bufnr) - if client.supports_method("textDocument/formatting") then - vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) - vim.api.nvim_create_autocmd("BufWritePre", { - group = augroup, - buffer = bufnr, - callback = function() - -- TODO: use this when neovim 8.0 comes out - lsp_formatting(bufnr) - -- vim.lsp.buf.formatting_sync() - end, - }) - end - end, - - sources = { - -- Linters -- - null_linters.eslint_d, - null_linters.gitlint, - null_linters.luacheck, - null_linters.markdownlint, - null_linters.shellcheck, - null_linters.yamllint, - null_linters.todo_comments, - - -- Formatters -- - null_formatters.blade_formatter, - null_formatters.blue, - null_formatters.fixjson, - null_formatters.phpcsfixer, - null_formatters.prettierd, - null_formatters.shfmt, - null_formatters.sql_formatter, - null_formatters.stylua, - null_formatters.yamlfmt, - }, - }) -end - -return { - "VonHeikemen/lsp-zero.nvim", - config = setup, - requires = { - -- LSP Support - { "neovim/nvim-lspconfig" }, - { "williamboman/mason.nvim" }, - { "williamboman/mason-lspconfig.nvim" }, - - -- Autocompletion - { "hrsh7th/nvim-cmp" }, - { "hrsh7th/cmp-buffer" }, - { "hrsh7th/cmp-path" }, - { "saadparwaiz1/cmp_luasnip" }, - { "hrsh7th/cmp-nvim-lsp" }, - { "hrsh7th/cmp-nvim-lua" }, - - -- Snippets - { "L3MON4D3/LuaSnip" }, - { "rafamadriz/friendly-snippets" }, - - -- Linters and Formatters - { "jose-elias-alvarez/null-ls.nvim" }, - -- { "jayp0521/mason-null-ls.nvim" }, - { "nvim-lua/plenary.nvim" }, - }, -} diff --git a/config/nvim.old/lua/plugins/nvim-comment-frame.lua b/config/nvim.old/lua/plugins/nvim-comment-frame.lua deleted file mode 100644 index 0c2aff4..0000000 --- a/config/nvim.old/lua/plugins/nvim-comment-frame.lua +++ /dev/null @@ -1,38 +0,0 @@ -local mapper = require("nvim-mapper") - -require('nvim-comment-frame').setup({ - - -- if true, cf keymap will be disabled - disable_default_keymap = true, - - -- width of the comment frame - frame_width = 70, - - -- wrap the line after 'n' characters - line_wrap_len = 50, - - -- automatically indent the comment frame based on the line - auto_indent = true, - - -- add comment above the current line - add_comment_above = true, - - -- configurations for individual language goes here - languages = { - dosini = { - start_str = ';;', - end_str = ';;', - fill_char = '*', - auto_indent = false - } - } -}) - -mapper.map('n', 'ch', - [[:lua require('nvim-comment-frame').add_comment()]], - {silent = true, noremap = true}, "nvim-comment-frame", "one line", - "Add one line header") -mapper.map('n', 'cH', - [[:lua require('nvim-comment-frame').add_multiline_comment()]], - {silent = true, noremap = true}, "nvim-comment-frame", "multi line", - "Add multi line header") diff --git a/config/nvim.old/lua/plugins/nvim-toggleterm.lua b/config/nvim.old/lua/plugins/nvim-toggleterm.lua deleted file mode 100644 index 41e090c..0000000 --- a/config/nvim.old/lua/plugins/nvim-toggleterm.lua +++ /dev/null @@ -1,47 +0,0 @@ -local mapper = require("nvim-mapper") --- don't close terminals on hidden -vim.opt.hidden = true - -require("toggleterm").setup { - -- size can be a number or function which is passed the current terminal - size = function(term) - if term.direction == "horizontal" then - return 15 - elseif term.direction == "vertical" then - return vim.o.columns * 0.4 - end - end, - hide_numbers = true, -- hide the number column in toggleterm buffers - shade_filetypes = {}, - shade_terminals = false, - -- shading_factor = '', -- the degree by which to darken to terminal colour, default: 1 for dark backgrounds, 3 for light - start_in_insert = true, - insert_mappings = true, -- whether or not the open mapping applies in insert mode - persist_size = true, - direction = 'float', -- 'vertical' | 'horizontal' | 'window' | 'float', - close_on_exit = true, -- close the terminal window when the process exits - shell = vim.o.shell, -- change the default shell - -- This field is only relevant if direction is set to 'float' - float_opts = { - -- The border key is *almost* the same as 'nvim_win_open' - -- see :h nvim_win_open for details on borders however - -- the 'curved' border is a custom border type - -- not natively supported but implemented in this plugin. - border = 'single', -- 'single' | 'double' | 'shadow' | 'curved' | ... other options supported by win open - width = math.ceil(vim.o.columns * 0.8), - height = math.ceil(vim.o.lines * 0.6), - winblend = 0, - highlights = {border = "Normal", background = "Normal"} - } -} - --- Toggle Terminals -mapper.map('n', 'mf', [[:1ToggleTerm]], - {silent = true, noremap = true}, "Terminal", "toggle_term_1", - "Toggle terminal 1") -mapper.map('n', 'md', [[:2ToggleTerm]], - {silent = true, noremap = true}, "Terminal", "toggle_term_2", - "Toggle terminal 2") -mapper.map('n', 'ms', [[:3ToggleTerm]], - {silent = true, noremap = true}, "Terminal", "toggle_term_3", - "Toggle terminal 3") diff --git a/config/nvim.old/lua/plugins/nvim-tree.lua b/config/nvim.old/lua/plugins/nvim-tree.lua deleted file mode 100644 index 55430ab..0000000 --- a/config/nvim.old/lua/plugins/nvim-tree.lua +++ /dev/null @@ -1,53 +0,0 @@ -local function tree_config() - local tree = require("nvim-tree") - local tree_cb = require("nvim-tree.config").nvim_tree_callback - - tree.setup({ - hijack_unnamed_buffer_when_opening = true, - disable_netrw = true, - hijack_netrw = true, - hijack_cursor = true, -- cursor at the start of filename - update_focused_file = { - enable = true -- focus curren file - }, - actions = { open_file = { quit_on_open = true } }, - renderer = { - full_name = true, -- show remaining name in floating text - group_empty = true, -- group empty folders - add_trailing = true, -- Trailing slash to folders - highlight_opened_files = "all", - highlight_git = true - }, - view = { - centralize_selection = true, -- center current file on enter - width = 30, -- N° of columns or % - mappings = { - custom_only = false, - -- list of mappings to set on the tree manually - list = { - { key = { "l", "", "o", "<2-LeftMouse>" }, action = "edit" }, - -- {key = {"L", "<2-RightMouse>", ""}, action = "cd"}, - { key = "s", action = "vsplit" }, - { key = "v", action = "split" }, - { key = "t", action = "tabnew" }, - { key = { "h", "" }, action = "close_node" }, - { key = "i", action = "toggle_dotfiles" }, - { key = "I", action = "toggle_ignored" }, - { key = { "", "" }, cb = tree_cb("system_open") } - } - } - } - }) - - -- bindings - vim.keymap.set("n", "e", ":NvimTreeToggle", { desc = "Toggle file tree", silent = true }) - vim.keymap.set("n", "", ":NvimTreeToggle", { desc = "Toggle file tree", silent = true }) -end - -return { - 'kyazdani42/nvim-tree.lua', - config = tree_config, - requires = { - 'kyazdani42/nvim-web-devicons' -- optional, for file icons - } -} diff --git a/config/nvim.old/lua/plugins/prettyfolds.lua b/config/nvim.old/lua/plugins/prettyfolds.lua deleted file mode 100644 index 308e66f..0000000 --- a/config/nvim.old/lua/plugins/prettyfolds.lua +++ /dev/null @@ -1,3 +0,0 @@ -local function config() require('pretty-fold').setup({fill_char = " "}) end - -return {'anuvyklack/pretty-fold.nvim', config = config} diff --git a/config/nvim.old/lua/plugins/projects.lua b/config/nvim.old/lua/plugins/projects.lua deleted file mode 100644 index f87519b..0000000 --- a/config/nvim.old/lua/plugins/projects.lua +++ /dev/null @@ -1,36 +0,0 @@ -require("project_nvim").setup { - -- Manual mode doesn't automatically change your root directory, so you have - -- the option to manually do so using `:ProjectRoot` command. - manual_mode = false, - - -- Methods of detecting the root directory. **"lsp"** uses the native neovim - -- lsp, while **"pattern"** uses vim-rooter like glob pattern matching. Here - -- order matters: if one is not detected, the other is used as fallback. You - -- can also delete or rearangne the detection methods. - detection_methods = {"lsp", "pattern"}, - - -- All the patterns used to detect root dir, when **"pattern"** is in - -- detection_methods - patterns = { - ".git", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json" - }, - - -- Table of lsp clients to ignore by name - -- eg: { "efm", ... } - ignore_lsp = {}, - - -- Don't calculate root dir on specific directories - -- Ex: { "~/.cargo/*", ... } - exclude_dirs = {}, - - -- Show hidden files in telescope - show_hidden = false, - - -- When set to false, you will get a message when project.nvim changes your - -- directory. - silent_chdir = false, - - -- Path where project.nvim will store the project history for use in - -- telescope - datapath = vim.fn.stdpath("data") -} diff --git a/config/nvim.old/lua/plugins/telescope.lua b/config/nvim.old/lua/plugins/telescope.lua deleted file mode 100644 index fcc3abc..0000000 --- a/config/nvim.old/lua/plugins/telescope.lua +++ /dev/null @@ -1,80 +0,0 @@ -local function config() - -- Telescope.nvim - local telescope = require("telescope") - local pickers = require("telescope.builtin") - require("project_nvim").setup() - - -- Extensions - telescope.load_extension("projects") - - -- Open Files - vim.keymap.set("n", "f", function() - pickers.find_files() - end, { silent = true, desc = "Find file" }) - - vim.keymap.set("n", "Fp", function() - telescope.extensions.projects.projects() - end, { silent = true, desc = "Find project" }) - - -- List vim stuff - vim.keymap.set("n", "bf", function() - pickers.buffers() - end, { silent = true, desc = "Find buffers" }) - - -- List LSP Stuff - vim.keymap.set("n", "ld", function() - pickers.diagnostics({ bufnr = 0 }) - end, { silent = true, desc = "Find diagnostics" }) - - vim.keymap.set("n", "lD", function() - pickers.diagnostics() - end, { silent = true, desc = "Find diagnostics in all buffers" }) - - -- Config - local telescope_actions = require("telescope.actions") - telescope.setup({ - defaults = { - entry_prefix = " ", - selection_caret = "* ", - file_ignore_patterns = { "%.env", "cache", ".xlsx" }, - mappings = { - i = { - [""] = telescope_actions.move_selection_next, - [""] = telescope_actions.move_selection_previous, - [""] = telescope_actions.file_vsplit, - [""] = telescope_actions.file_split, - [""] = telescope_actions.close, - }, - n = { - ["gg"] = telescope_actions.move_to_top, - ["G"] = telescope_actions.move_to_bottom, - ["s"] = telescope_actions.file_vsplit, - ["v"] = telescope_actions.file_split, - }, - }, - path_display = { - truncate = 1, - }, - }, - -- Specific config - pickers = { - buffers = { - sort_lastused = true, - mappings = { - i = { ["d"] = require("telescope.actions").delete_buffer }, - n = { [""] = require("telescope.actions").delete_buffer }, - }, - }, - }, - }) -end - -return { - "nvim-telescope/telescope.nvim", - branch = "0.1.x", - requires = { - "nvim-lua/plenary.nvim", - "ahmedkhalf/project.nvim", - }, - config = config, -} diff --git a/config/nvim.old/lua/plugins/treesitter.lua b/config/nvim.old/lua/plugins/treesitter.lua deleted file mode 100644 index 8c0086b..0000000 --- a/config/nvim.old/lua/plugins/treesitter.lua +++ /dev/null @@ -1,37 +0,0 @@ -local function config() - - require('nvim-treesitter.configs').setup({ - ensure_installed = { - "bash", "c", "comment", "cpp", "css", "dockerfile", "html", - "javascript", "jsdoc", "json", "lua", "python", "query", "regex", - "typescript", "yaml", "sql", "http", "php", "rust", "scss", - "markdown", "dart" - }, - highlight = {enable = true}, - indent = {enable = true}, - rainbow = { - enable = true, - extended_mode = true, -- Highlight also non-parentheses delimiters, boolean or table: lang -> boolean - max_file_lines = 1000 -- Do not enable for files with more than 1000 lines, int - } - }) - - -- Treesitter Folding - vim.api.nvim_create_autocmd({ - 'BufEnter', 'BufAdd', 'BufNew', 'BufNewFile', 'BufWinEnter' - }, { - group = vim.api.nvim_create_augroup('TS_FOLD_WORKAROUND', {}), - callback = function() - vim.opt.foldmethod = 'expr' - vim.opt.foldexpr = 'nvim_treesitter#foldexpr()' - end - }) -end - -return { - 'nvim-treesitter/nvim-treesitter', - run = function() - require('nvim-treesitter.install').update({with_sync = true}) - end, - config = config -} diff --git a/config/nvim.old/lua/plugins/ts-node-action.lua b/config/nvim.old/lua/plugins/ts-node-action.lua deleted file mode 100644 index dfd9f63..0000000 --- a/config/nvim.old/lua/plugins/ts-node-action.lua +++ /dev/null @@ -1,3 +0,0 @@ -require("ts-node-action").setup({}) - -vim.keymap.set({ "n" }, "lt", require("ts-node-action").node_action, { desc = "Trigger Node Action" }) diff --git a/config/nvim/LICENSE.md b/config/nvim/LICENSE.md new file mode 100644 index 0000000..9cf1062 --- /dev/null +++ b/config/nvim/LICENSE.md @@ -0,0 +1,19 @@ +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/config/nvim/README.md b/config/nvim/README.md new file mode 100644 index 0000000..21fcab3 --- /dev/null +++ b/config/nvim/README.md @@ -0,0 +1,130 @@ +# kickstart.nvim + +### Introduction + +A starting point for Neovim that is: + +* Small +* Single-file (with examples of moving to multi-file) +* Documented +* Modular + +This repo is meant to be used as by **YOU** to begin your Neovim journey; remove the things you don't use and add what you miss. + +Distribution Alternatives: +- [LazyVim](https://www.lazyvim.org/): A delightful distribution maintained by @folke (the author of lazy.nvim, the package manager used here) + +### Installation + +Kickstart.nvim targets *only* the latest ['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest ['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim. If you are experiencing issues, please make sure you have the latest versions. + +* Backup your previous configuration +* (Recommended) Fork this repo (so that you have your own copy that you can modify). +* Clone the kickstart repo into `$HOME/.config/nvim/` (Linux/Mac) or `~/AppData/Local/nvim/` (Windows) + * If you don't want to include it as a git repo, you can just clone it and then move the files to this location +* Start Neovim (`nvim`) and allow `lazy.nvim` to complete installation. +* Restart Neovim +* **You're ready to go!** + +Additional system requirements: +- Make sure to review the readmes of the plugins if you are experiencing errors. In particular: + - [ripgrep](https://github.com/BurntSushi/ripgrep#installation) is required for multiple [telescope](https://github.com/nvim-telescope/telescope.nvim#suggested-dependencies) pickers. +- See as well [Windows Installation](#Windows-Installation) + +### Configuration And Extension + +* Inside of your fork, feel free to modify any file you like! It's your fork! +* Then there are two primary configuration options available: + * Include the `lua/kickstart/plugins/*` files in your configuration. + * Add new configuration in `lua/custom/plugins/*` files, which will be auto sourced using `lazy.nvim` + * NOTE: To enable this, you need to uncomment `{ import = 'custom.plugins' }` in your `init.lua` + +You can also merge updates/changes from the repo back into your fork, to keep up-to-date with any changes for the default configuration + +#### Example: Adding an autopairs plugin + +In the file: `lua/custom/plugins/autopairs.lua`, add: + +```lua +-- File: lua/custom/plugins/autopairs.lua + +return { + "windwp/nvim-autopairs", + config = function() + require("nvim-autopairs").setup {} + end, +} +``` + + +This will automatically install `nvim-autopairs` and enable it on startup. For more information, see documentation for [lazy.nvim](https://github.com/folke/lazy.nvim). + +#### Example: Adding a file tree plugin + +In the file: `lua/custom/plugins/filetree.lua`, add: + +```lua +-- Unless you are still migrating, remove the deprecated commands from v1.x +vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]]) + +return { + "nvim-neo-tree/neo-tree.nvim", + version = "*", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended + "MunifTanjim/nui.nvim", + }, + config = function () + require('neo-tree').setup {} + end, +} +``` + +This will install the tree plugin and add the command `:Neotree` for you. You can explore the documentation at [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim) for more information. + +#### Example: Adding a file to change default options + +To change default options, you can add a file in the `/after/plugin/` folder (see `:help load-plugins`) to include your own options, keymaps, autogroups, and more. The following is an example `defaults.lua` file (located at `$HOME/.config/nvim/after/plugin/defaults.lua`). + +```lua +vim.opt.relativenumber = true + +vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' }) +``` + +### Contribution + +Pull-requests are welcome. The goal of this repo is not to create a Neovim configuration framework, but to offer a starting template that shows, by example, available features in Neovim. Some things that will not be included: + +* Custom language server configuration (null-ls templates) +* Theming beyond a default colorscheme necessary for LSP highlight groups + +Each PR, especially those which increase the line count, should have a description as to why the PR is necessary. + +### FAQ + +* What should I do if I already have a pre-existing neovim configuration? + * You should back it up, then delete all files associated with it. + * This includes your existing init.lua and the neovim files in `~/.local` which can be deleted with `rm -rf ~/.local/share/nvim/` + * You may also want to look at the [migration guide for lazy.nvim](https://github.com/folke/lazy.nvim#-migration-guide) +* What if I want to "uninstall" this configuration: + * See [lazy.nvim uninstall](https://github.com/folke/lazy.nvim#-uninstalling) information +* Are there any cool videos about this plugin? + * Current iteration of kickstart (coming soon) + * Here is one about the previous iteration of kickstart: [video introduction to Kickstart.nvim](https://youtu.be/stqUbv-5u2s). + +### Windows Installation + +Installation may require installing build tools, and updating the run command for `telescope-fzf-native` + +See `telescope-fzf-native` documentation for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation) + +This requires: + +- Install CMake, and the Microsoft C++ Build Tools on Windows + +```lua +{'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' } +``` + diff --git a/config/nvim/init.lua b/config/nvim/init.lua new file mode 100644 index 0000000..e898172 --- /dev/null +++ b/config/nvim/init.lua @@ -0,0 +1,127 @@ +-- Loadnoptions before anything +require("aleidk.options") + +-- Init PLugins + +-- Install package manager https://github.com/folke/lazy.nvim +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) + +-- Load plugins +require("lazy").setup("aleidk.plugins") + +-- Rest of configuratin + +require("aleidk.keymaps") +require("aleidk.autocmds") +require("aleidk.IDE") + +-- [[ Configure Telescope ]] +-- See `:help telescope` and `:help telescope.setup()` +require("telescope").setup({ + defaults = { + mappings = { + i = { + [""] = false, + [""] = false, + }, + }, + }, +}) + +-- Enable telescope fzf native, if installed +pcall(require("telescope").load_extension, "fzf") + +-- See `:help telescope.builtin` +vim.keymap.set("n", "?", require("telescope.builtin").oldfiles, { desc = "[?] Find recently opened files" }) +vim.keymap.set("n", "", require("telescope.builtin").buffers, { desc = "[ ] Find existing buffers" }) +vim.keymap.set("n", "/", function() + -- You can pass additional configuration to telescope to change theme, layout, etc. + require("telescope.builtin").current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({ + winblend = 10, + previewer = false, + })) +end, { desc = "[/] Fuzzily search in current buffer" }) + +vim.keymap.set("n", "sf", require("telescope.builtin").find_files, { desc = "[S]earch [F]iles" }) +vim.keymap.set("n", "sh", require("telescope.builtin").help_tags, { desc = "[S]earch [H]elp" }) +vim.keymap.set("n", "sw", require("telescope.builtin").grep_string, { desc = "[S]earch current [W]ord" }) +vim.keymap.set("n", "sg", require("telescope.builtin").live_grep, { desc = "[S]earch by [G]rep" }) +vim.keymap.set("n", "sd", require("telescope.builtin").diagnostics, { desc = "[S]earch [D]iagnostics" }) + +-- [[ Configure Treesitter ]] +-- See `:help nvim-treesitter` +require("nvim-treesitter.configs").setup({ + -- Add languages to be installed here that you want installed for treesitter + ensure_installed = { "c", "cpp", "go", "lua", "python", "rust", "tsx", "typescript", "vimdoc", "vim" }, + -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) + auto_install = false, + highlight = { enable = true }, + indent = { enable = true, disable = { "python" } }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "", + node_incremental = "", + scope_incremental = "", + node_decremental = "", + }, + }, + textobjects = { + select = { + enable = true, + lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim + keymaps = { + -- You can use the capture groups defined in textobjects.scm + ["aa"] = "@parameter.outer", + ["ia"] = "@parameter.inner", + ["af"] = "@function.outer", + ["if"] = "@function.inner", + ["ac"] = "@class.outer", + ["ic"] = "@class.inner", + }, + }, + move = { + enable = true, + set_jumps = true, -- whether to set jumps in the jumplist + goto_next_start = { + ["]m"] = "@function.outer", + ["]]"] = "@class.outer", + }, + goto_next_end = { + ["]M"] = "@function.outer", + ["]["] = "@class.outer", + }, + goto_previous_start = { + ["[m"] = "@function.outer", + ["[["] = "@class.outer", + }, + goto_previous_end = { + ["[M"] = "@function.outer", + ["[]"] = "@class.outer", + }, + }, + swap = { + enable = true, + swap_next = { + ["a"] = "@parameter.inner", + }, + swap_previous = { + ["A"] = "@parameter.inner", + }, + }, + }, +}) + +-- The line beneath this is called `modeline`. See `:help modeline` +-- vim: ts=2 sts=2 sw=2 et diff --git a/config/nvim/lazy-lock.json b/config/nvim/lazy-lock.json new file mode 100644 index 0000000..471f97e --- /dev/null +++ b/config/nvim/lazy-lock.json @@ -0,0 +1,26 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "a89339ffbee677ab0521a483b6dac7e2e67c907e" }, + "LuaSnip": { "branch": "master", "commit": "8d6c0a93dec34900577ba725e91c44b8d3ca1f45" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" }, + "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, + "fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" }, + "gitsigns.nvim": { "branch": "main", "commit": "372d5cb485f2062ac74abc5b33054abac21d8b58" }, + "indent-blankline.nvim": { "branch": "master", "commit": "018bd04d80c9a73d399c1061fa0c3b14a7614399" }, + "lazy.nvim": { "branch": "main", "commit": "5c89dc52f42e5058a46b0912d7d9042f564e44e0" }, + "lualine.nvim": { "branch": "master", "commit": "84ffb80e452d95e2c46fa29a98ea11a240f7843e" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "7034065099c1665143091c7282b3b1b8f0b23783" }, + "mason.nvim": { "branch": "main", "commit": "b20a4bd32247411d39d8dd5c94e2e5c87d98556d" }, + "neodev.nvim": { "branch": "main", "commit": "e812f3d0e62e21a164b70f90f642cf30129503e4" }, + "nvim-cmp": { "branch": "main", "commit": "777450fd0ae289463a14481673e26246b5e38bf2" }, + "nvim-lspconfig": { "branch": "master", "commit": "eddaef928c1e1dd79a96f5db45f2fd7f2efe7ea0" }, + "nvim-treesitter": { "branch": "master", "commit": "831f37635df26864a397a5e35450eec97bfe60cd" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "8673926519ea61069f9c1366d1ad1949316d250e" }, + "onedark.nvim": { "branch": "master", "commit": "dd640f6cfb0e370cfd3db389f04b172508848bd3" }, + "plenary.nvim": { "branch": "master", "commit": "9ac3e9541bbabd9d73663d757e4fe48a675bb054" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "580b6c48651cabb63455e97d7e131ed557b8c7e2" }, + "telescope.nvim": { "branch": "master", "commit": "c1a2af0af69e80e14e6b226d3957a064cd080805" }, + "vim-fugitive": { "branch": "master", "commit": "e6651a79facf5cc2b7c554fdc19eb8a9fe89602c" }, + "vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" }, + "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, + "which-key.nvim": { "branch": "main", "commit": "94cb020ff33a1e0e22fac1c41663d2c439741f17" } +} \ No newline at end of file diff --git a/config/nvim/lua/aleidk/IDE/init.lua b/config/nvim/lua/aleidk/IDE/init.lua new file mode 100644 index 0000000..93c4295 --- /dev/null +++ b/config/nvim/lua/aleidk/IDE/init.lua @@ -0,0 +1 @@ +require("aleidk.IDE.lsp") diff --git a/config/nvim/lua/aleidk/IDE/lsp.lua b/config/nvim/lua/aleidk/IDE/lsp.lua new file mode 100644 index 0000000..57b547a --- /dev/null +++ b/config/nvim/lua/aleidk/IDE/lsp.lua @@ -0,0 +1,139 @@ +-- LSP settings. +-- This function gets run when an LSP connects to a particular buffer. +local on_attach = function(_, bufnr) + -- NOTE: Remember that lua is a real programming language, and as such it is possible + -- to define small helper and utility functions so you don't have to repeat yourself + -- many times. + -- + -- In this case, we create a function that lets us more easily define mappings specific + -- for LSP related items. It sets the mode, buffer and description for us each time. + local nmap = function(keys, func, desc) + if desc then + desc = "LSP: " .. desc + end + + vim.keymap.set("n", keys, func, { buffer = bufnr, desc = desc }) + end + + nmap("rn", vim.lsp.buf.rename, "[R]e[n]ame") + nmap("ca", vim.lsp.buf.code_action, "[C]ode [A]ction") + + nmap("gd", vim.lsp.buf.definition, "[G]oto [D]efinition") + nmap("gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences") + nmap("gI", vim.lsp.buf.implementation, "[G]oto [I]mplementation") + nmap("D", vim.lsp.buf.type_definition, "Type [D]efinition") + nmap("ds", require("telescope.builtin").lsp_document_symbols, "[D]ocument [S]ymbols") + nmap("ws", require("telescope.builtin").lsp_dynamic_workspace_symbols, "[W]orkspace [S]ymbols") + + -- See `:help K` for why this keymap + nmap("K", vim.lsp.buf.hover, "Hover Documentation") + nmap("", vim.lsp.buf.signature_help, "Signature Documentation") + + -- Lesser used LSP functionality + nmap("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration") + nmap("wa", vim.lsp.buf.add_workspace_folder, "[W]orkspace [A]dd Folder") + nmap("wr", vim.lsp.buf.remove_workspace_folder, "[W]orkspace [R]emove Folder") + nmap("wl", function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, "[W]orkspace [L]ist Folders") + + -- Create a command `:Format` local to the LSP buffer + vim.api.nvim_buf_create_user_command(bufnr, "Format", function(_) + vim.lsp.buf.format() + end, { desc = "Format current buffer with LSP" }) +end + +-- Enable the following language servers +-- Feel free to add/remove any LSPs that you want here. They will automatically be installed. +-- +-- Add any additional override configuration in the following tables. They will be passed to +-- the `settings` field of the server config. You must look up that documentation yourself. +local servers = { + -- clangd = {}, + -- gopls = {}, + -- pyright = {}, + -- rust_analyzer = {}, + -- tsserver = {}, + + lua_ls = { + Lua = { + workspace = { checkThirdParty = false }, + telemetry = { enable = false }, + }, + }, +} + +-- Diagnostic keymaps +vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, { desc = "Go to previous diagnostic message" }) +vim.keymap.set("n", "]d", vim.diagnostic.goto_next, { desc = "Go to next diagnostic message" }) +vim.keymap.set("n", "e", vim.diagnostic.open_float, { desc = "Open floating diagnostic message" }) +vim.keymap.set("n", "q", vim.diagnostic.setloclist, { desc = "Open diagnostics list" }) + +-- Setup neovim lua configuration +require("neodev").setup() + +-- nvim-cmp supports additional completion capabilities, so broadcast that to servers +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities) + +-- Ensure the servers above are installed +local mason_lspconfig = require("mason-lspconfig") + +mason_lspconfig.setup({ + ensure_installed = vim.tbl_keys(servers), +}) + +mason_lspconfig.setup_handlers({ + function(server_name) + require("lspconfig")[server_name].setup({ + capabilities = capabilities, + on_attach = on_attach, + settings = servers[server_name], + }) + end, +}) + +-- nvim-cmp setup +local cmp = require("cmp") +local luasnip = require("luasnip") + +luasnip.config.setup({}) + +cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete({}), + [""] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + }), + sources = { + { name = "nvim_lsp" }, + { name = "luasnip" }, + }, +}) diff --git a/config/nvim/lua/aleidk/autocmds.lua b/config/nvim/lua/aleidk/autocmds.lua new file mode 100644 index 0000000..8ac6951 --- /dev/null +++ b/config/nvim/lua/aleidk/autocmds.lua @@ -0,0 +1,10 @@ +-- [[ Highlight on yank ]] +-- See `:help vim.highlight.on_yank()` +local highlight_group = vim.api.nvim_create_augroup("YankHighlight", { clear = true }) +vim.api.nvim_create_autocmd("TextYankPost", { + callback = function() + vim.highlight.on_yank() + end, + group = highlight_group, + pattern = "*", +}) diff --git a/config/nvim/lua/aleidk/keymaps.lua b/config/nvim/lua/aleidk/keymaps.lua new file mode 100644 index 0000000..a234a6e --- /dev/null +++ b/config/nvim/lua/aleidk/keymaps.lua @@ -0,0 +1,9 @@ +-- [[ Basic Keymaps ]] + +-- Keymaps for better default experience +-- See `:help vim.keymap.set()` +vim.keymap.set({ "n", "v" }, "", "", { silent = true }) + +-- Remap for dealing with word wrap +vim.keymap.set("n", "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) +vim.keymap.set("n", "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) diff --git a/config/nvim/lua/aleidk/options.lua b/config/nvim/lua/aleidk/options.lua new file mode 100644 index 0000000..e4557c8 --- /dev/null +++ b/config/nvim/lua/aleidk/options.lua @@ -0,0 +1,45 @@ +-- [[ Setting options ]] +-- See `:help vim.o` + +-- Set as the leader key +-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used) +vim.g.mapleader = " " +vim.g.maplocalleader = " " + +-- Set highlight on search +vim.o.hlsearch = false + +-- Make line numbers default +vim.wo.number = true + +-- Enable mouse mode +vim.o.mouse = "a" + +-- Sync clipboard between OS and Neovim. +-- Remove this option if you want your OS clipboard to remain independent. +-- See `:help 'clipboard'` +vim.o.clipboard = "unnamedplus" + +-- Enable break indent +vim.o.breakindent = true + +-- Save undo history +vim.o.undofile = true + +-- Case insensitive searching UNLESS /C or capital in search +vim.o.ignorecase = true +vim.o.smartcase = true + +-- Keep signcolumn on by default +vim.wo.signcolumn = "yes" + +-- Decrease update time +vim.o.updatetime = 250 +vim.o.timeout = true +vim.o.timeoutlen = 300 + +-- Set completeopt to have a better completion experience +vim.o.completeopt = "menuone,noselect" + +-- NOTE: You should make sure your terminal supports this +vim.o.termguicolors = true diff --git a/config/nvim/lua/aleidk/plugins/gitsigns.lua b/config/nvim/lua/aleidk/plugins/gitsigns.lua new file mode 100644 index 0000000..a28c96a --- /dev/null +++ b/config/nvim/lua/aleidk/plugins/gitsigns.lua @@ -0,0 +1,14 @@ +-- Adds git releated signs to the gutter, as well as utilities for managing changes +return { + "lewis6991/gitsigns.nvim", + opts = { + -- See `:help gitsigns.txt` + signs = { + add = { text = "+" }, + change = { text = "~" }, + delete = { text = "_" }, + topdelete = { text = "‾" }, + changedelete = { text = "~" }, + }, + }, +} diff --git a/config/nvim/lua/aleidk/plugins/init.lua b/config/nvim/lua/aleidk/plugins/init.lua new file mode 100644 index 0000000..7390452 --- /dev/null +++ b/config/nvim/lua/aleidk/plugins/init.lua @@ -0,0 +1,115 @@ +return { + -- NOTE: First, some plugins that don't require any configuration + + -- Git related plugins + "tpope/vim-fugitive", + "tpope/vim-rhubarb", + + -- Detect tabstop and shiftwidth automatically + "tpope/vim-sleuth", + + -- NOTE: This is where your plugins related to LSP can be installed. + -- The configuration is done below. Search for lspconfig to find it below. + { + -- LSP Configuration & Plugins + "neovim/nvim-lspconfig", + dependencies = { + -- Automatically install LSPs to stdpath for neovim + { "williamboman/mason.nvim", config = true }, + "williamboman/mason-lspconfig.nvim", + + -- Useful status updates for LSP + -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` + { "j-hui/fidget.nvim", opts = {} }, + + -- Additional lua configuration, makes nvim stuff amazing! + "folke/neodev.nvim", + }, + }, + + { + -- Autocompletion + "hrsh7th/nvim-cmp", + dependencies = { "hrsh7th/cmp-nvim-lsp", "L3MON4D3/LuaSnip", "saadparwaiz1/cmp_luasnip" }, + }, + + -- Useful plugin to show you pending keybinds. + { "folke/which-key.nvim", opts = {} }, + + { + -- Theme inspired by Atom + "navarasu/onedark.nvim", + priority = 1000, + config = function() + vim.cmd.colorscheme("onedark") + end, + }, + + { + -- Set lualine as statusline + "nvim-lualine/lualine.nvim", + -- See `:help lualine.txt` + opts = { + options = { + icons_enabled = false, + theme = "onedark", + component_separators = "|", + section_separators = "", + }, + }, + }, + + { + -- Add indentation guides even on blank lines + "lukas-reineke/indent-blankline.nvim", + -- Enable `lukas-reineke/indent-blankline.nvim` + -- See `:help indent_blankline.txt` + opts = { + char = "┊", + show_trailing_blankline_indent = false, + }, + }, + + -- "gc" to comment visual regions/lines + { "numToStr/Comment.nvim", opts = {} }, + + -- Fuzzy Finder (files, lsp, etc) + { "nvim-telescope/telescope.nvim", version = "*", dependencies = { "nvim-lua/plenary.nvim" } }, + + -- Fuzzy Finder Algorithm which requires local dependencies to be built. + -- Only load if `make` is available. Make sure you have the system + -- requirements installed. + { + "nvim-telescope/telescope-fzf-native.nvim", + -- NOTE: If you are having trouble with this installation, + -- refer to the README for telescope-fzf-native for more instructions. + build = "make", + cond = function() + return vim.fn.executable("make") == 1 + end, + }, + + { + -- Highlight, edit, and navigate code + "nvim-treesitter/nvim-treesitter", + dependencies = { + "nvim-treesitter/nvim-treesitter-textobjects", + }, + build = ":TSUpdate", + }, + + -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart + -- These are some example plugins that I've included in the kickstart repository. + -- Uncomment any of the lines below to enable them. + -- require 'kickstart.plugins.autoformat', + -- require 'kickstart.plugins.debug', + + -- NOTE: The import below automatically adds your own plugins, configuration, etc from `lua/custom/plugins/*.lua` + -- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping + -- up-to-date with whatever is in the kickstart repo. + -- + -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins + -- + -- An additional note is that if you only copied in the `init.lua`, you can just comment this line + -- to get rid of the warning telling you that there are not plugins in `lua/custom/plugins/`. +} diff --git a/config/nvim/lua/custom/plugins/init.lua b/config/nvim/lua/custom/plugins/init.lua new file mode 100644 index 0000000..be0eb9d --- /dev/null +++ b/config/nvim/lua/custom/plugins/init.lua @@ -0,0 +1,5 @@ +-- You can add your own plugins here or in other files in this directory! +-- I promise not to create any merge conflicts in this directory :) +-- +-- See the kickstart.nvim README for more information +return {} diff --git a/config/nvim/lua/kickstart/plugins/autoformat.lua b/config/nvim/lua/kickstart/plugins/autoformat.lua new file mode 100644 index 0000000..bc56b15 --- /dev/null +++ b/config/nvim/lua/kickstart/plugins/autoformat.lua @@ -0,0 +1,74 @@ +-- autoformat.lua +-- +-- Use your language server to automatically format your code on save. +-- Adds additional commands as well to manage the behavior + +return { + 'neovim/nvim-lspconfig', + config = function() + -- Switch for controlling whether you want autoformatting. + -- Use :KickstartFormatToggle to toggle autoformatting on or off + local format_is_enabled = true + vim.api.nvim_create_user_command('KickstartFormatToggle', function() + format_is_enabled = not format_is_enabled + print('Setting autoformatting to: ' .. tostring(format_is_enabled)) + end, {}) + + -- Create an augroup that is used for managing our formatting autocmds. + -- We need one augroup per client to make sure that multiple clients + -- can attach to the same buffer without interfering with each other. + local _augroups = {} + local get_augroup = function(client) + if not _augroups[client.id] then + local group_name = 'kickstart-lsp-format-' .. client.name + local id = vim.api.nvim_create_augroup(group_name, { clear = true }) + _augroups[client.id] = id + end + + return _augroups[client.id] + end + + -- Whenever an LSP attaches to a buffer, we will run this function. + -- + -- See `:help LspAttach` for more information about this autocmd event. + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('kickstart-lsp-attach-format', { clear = true }), + -- This is where we attach the autoformatting for reasonable clients + callback = function(args) + local client_id = args.data.client_id + local client = vim.lsp.get_client_by_id(client_id) + local bufnr = args.buf + + -- Only attach to clients that support document formatting + if not client.server_capabilities.documentFormattingProvider then + return + end + + -- Tsserver usually works poorly. Sorry you work with bad languages + -- You can remove this line if you know what you're doing :) + if client.name == 'tsserver' then + return + end + + -- Create an autocmd that will run *before* we save the buffer. + -- Run the formatting command for the LSP that has just attached. + vim.api.nvim_create_autocmd('BufWritePre', { + group = get_augroup(client), + buffer = bufnr, + callback = function() + if not format_is_enabled then + return + end + + vim.lsp.buf.format { + async = false, + filter = function(c) + return c.id == client.id + end, + } + end, + }) + end, + }) + end, +} diff --git a/config/nvim/lua/kickstart/plugins/debug.lua b/config/nvim/lua/kickstart/plugins/debug.lua new file mode 100644 index 0000000..000bcb8 --- /dev/null +++ b/config/nvim/lua/kickstart/plugins/debug.lua @@ -0,0 +1,83 @@ +-- debug.lua +-- +-- Shows how to use the DAP plugin to debug your code. +-- +-- Primarily focused on configuring the debugger for Go, but can +-- be extended to other languages as well. That's why it's called +-- kickstart.nvim and not kitchen-sink.nvim ;) + +return { + -- NOTE: Yes, you can install new plugins here! + 'mfussenegger/nvim-dap', + -- NOTE: And you can specify dependencies as well + dependencies = { + -- Creates a beautiful debugger UI + 'rcarriga/nvim-dap-ui', + + -- Installs the debug adapters for you + 'williamboman/mason.nvim', + 'jay-babu/mason-nvim-dap.nvim', + + -- Add your own debuggers here + 'leoluz/nvim-dap-go', + }, + config = function() + local dap = require 'dap' + local dapui = require 'dapui' + + require('mason-nvim-dap').setup { + -- Makes a best effort to setup the various debuggers with + -- reasonable debug configurations + automatic_setup = true, + + -- You can provide additional configuration to the handlers, + -- see mason-nvim-dap README for more information + handlers = {}, + + -- You'll need to check that you have the required things installed + -- online, please don't ask me how to install them :) + ensure_installed = { + -- Update this to ensure that you have the debuggers for the langs you want + 'delve', + }, + } + + -- Basic debugging keymaps, feel free to change to your liking! + vim.keymap.set('n', '', dap.continue) + vim.keymap.set('n', '', dap.step_into) + vim.keymap.set('n', '', dap.step_over) + vim.keymap.set('n', '', dap.step_out) + vim.keymap.set('n', 'b', dap.toggle_breakpoint) + vim.keymap.set('n', 'B', function() + dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ') + end) + + -- Dap UI setup + -- For more information, see |:help nvim-dap-ui| + dapui.setup { + -- Set icons to characters that are more likely to work in every terminal. + -- Feel free to remove or use ones that you like more! :) + -- Don't feel like these are good choices. + icons = { expanded = '▾', collapsed = '▸', current_frame = '*' }, + controls = { + icons = { + pause = '⏸', + play = '▶', + step_into = '⏎', + step_over = '⏭', + step_out = '⏮', + step_back = 'b', + run_last = '▶▶', + terminate = '⏹', + }, + }, + } + + dap.listeners.after.event_initialized['dapui_config'] = dapui.open + dap.listeners.before.event_terminated['dapui_config'] = dapui.close + dap.listeners.before.event_exited['dapui_config'] = dapui.close + + -- Install golang specific config + require('dap-go').setup() + end, +} From 5e6c1d45b933325f59f1d6931b1f20da9b657f03 Mon Sep 17 00:00:00 2001 From: Alexander Navarro Date: Thu, 20 Apr 2023 11:38:58 -0400 Subject: [PATCH 02/17] refactor nvim plugins structure --- config/nvim/init.lua | 97 ------------------- config/nvim/lua/aleidk/plugins/blankline.lua | 8 ++ config/nvim/lua/aleidk/plugins/init.lua | 59 +---------- config/nvim/lua/aleidk/plugins/lualine.lua | 13 +++ config/nvim/lua/aleidk/plugins/telescope.lua | 65 +++++++++++++ config/nvim/lua/aleidk/plugins/treesitter.lua | 69 +++++++++++++ 6 files changed, 160 insertions(+), 151 deletions(-) create mode 100644 config/nvim/lua/aleidk/plugins/blankline.lua create mode 100644 config/nvim/lua/aleidk/plugins/lualine.lua create mode 100644 config/nvim/lua/aleidk/plugins/telescope.lua create mode 100644 config/nvim/lua/aleidk/plugins/treesitter.lua diff --git a/config/nvim/init.lua b/config/nvim/init.lua index e898172..ad174bc 100644 --- a/config/nvim/init.lua +++ b/config/nvim/init.lua @@ -26,102 +26,5 @@ require("aleidk.keymaps") require("aleidk.autocmds") require("aleidk.IDE") --- [[ Configure Telescope ]] --- See `:help telescope` and `:help telescope.setup()` -require("telescope").setup({ - defaults = { - mappings = { - i = { - [""] = false, - [""] = false, - }, - }, - }, -}) - --- Enable telescope fzf native, if installed -pcall(require("telescope").load_extension, "fzf") - --- See `:help telescope.builtin` -vim.keymap.set("n", "?", require("telescope.builtin").oldfiles, { desc = "[?] Find recently opened files" }) -vim.keymap.set("n", "", require("telescope.builtin").buffers, { desc = "[ ] Find existing buffers" }) -vim.keymap.set("n", "/", function() - -- You can pass additional configuration to telescope to change theme, layout, etc. - require("telescope.builtin").current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({ - winblend = 10, - previewer = false, - })) -end, { desc = "[/] Fuzzily search in current buffer" }) - -vim.keymap.set("n", "sf", require("telescope.builtin").find_files, { desc = "[S]earch [F]iles" }) -vim.keymap.set("n", "sh", require("telescope.builtin").help_tags, { desc = "[S]earch [H]elp" }) -vim.keymap.set("n", "sw", require("telescope.builtin").grep_string, { desc = "[S]earch current [W]ord" }) -vim.keymap.set("n", "sg", require("telescope.builtin").live_grep, { desc = "[S]earch by [G]rep" }) -vim.keymap.set("n", "sd", require("telescope.builtin").diagnostics, { desc = "[S]earch [D]iagnostics" }) - --- [[ Configure Treesitter ]] --- See `:help nvim-treesitter` -require("nvim-treesitter.configs").setup({ - -- Add languages to be installed here that you want installed for treesitter - ensure_installed = { "c", "cpp", "go", "lua", "python", "rust", "tsx", "typescript", "vimdoc", "vim" }, - -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) - auto_install = false, - highlight = { enable = true }, - indent = { enable = true, disable = { "python" } }, - incremental_selection = { - enable = true, - keymaps = { - init_selection = "", - node_incremental = "", - scope_incremental = "", - node_decremental = "", - }, - }, - textobjects = { - select = { - enable = true, - lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim - keymaps = { - -- You can use the capture groups defined in textobjects.scm - ["aa"] = "@parameter.outer", - ["ia"] = "@parameter.inner", - ["af"] = "@function.outer", - ["if"] = "@function.inner", - ["ac"] = "@class.outer", - ["ic"] = "@class.inner", - }, - }, - move = { - enable = true, - set_jumps = true, -- whether to set jumps in the jumplist - goto_next_start = { - ["]m"] = "@function.outer", - ["]]"] = "@class.outer", - }, - goto_next_end = { - ["]M"] = "@function.outer", - ["]["] = "@class.outer", - }, - goto_previous_start = { - ["[m"] = "@function.outer", - ["[["] = "@class.outer", - }, - goto_previous_end = { - ["[M"] = "@function.outer", - ["[]"] = "@class.outer", - }, - }, - swap = { - enable = true, - swap_next = { - ["a"] = "@parameter.inner", - }, - swap_previous = { - ["A"] = "@parameter.inner", - }, - }, - }, -}) - -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et diff --git a/config/nvim/lua/aleidk/plugins/blankline.lua b/config/nvim/lua/aleidk/plugins/blankline.lua new file mode 100644 index 0000000..6f32c53 --- /dev/null +++ b/config/nvim/lua/aleidk/plugins/blankline.lua @@ -0,0 +1,8 @@ +return { + -- Add indentation guides even on blank lines + "lukas-reineke/indent-blankline.nvim", + opts = { + char = "┊", + show_trailing_blankline_indent = false, + }, +} diff --git a/config/nvim/lua/aleidk/plugins/init.lua b/config/nvim/lua/aleidk/plugins/init.lua index 7390452..8869638 100644 --- a/config/nvim/lua/aleidk/plugins/init.lua +++ b/config/nvim/lua/aleidk/plugins/init.lua @@ -8,8 +8,6 @@ return { -- Detect tabstop and shiftwidth automatically "tpope/vim-sleuth", - -- NOTE: This is where your plugins related to LSP can be installed. - -- The configuration is done below. Search for lspconfig to find it below. { -- LSP Configuration & Plugins "neovim/nvim-lspconfig", @@ -33,8 +31,11 @@ return { dependencies = { "hrsh7th/cmp-nvim-lsp", "L3MON4D3/LuaSnip", "saadparwaiz1/cmp_luasnip" }, }, - -- Useful plugin to show you pending keybinds. - { "folke/which-key.nvim", opts = {} }, + { + -- Useful plugin to show you pending keybinds. + "folke/which-key.nvim", + opts = {}, + }, { -- Theme inspired by Atom @@ -45,59 +46,9 @@ return { end, }, - { - -- Set lualine as statusline - "nvim-lualine/lualine.nvim", - -- See `:help lualine.txt` - opts = { - options = { - icons_enabled = false, - theme = "onedark", - component_separators = "|", - section_separators = "", - }, - }, - }, - - { - -- Add indentation guides even on blank lines - "lukas-reineke/indent-blankline.nvim", - -- Enable `lukas-reineke/indent-blankline.nvim` - -- See `:help indent_blankline.txt` - opts = { - char = "┊", - show_trailing_blankline_indent = false, - }, - }, - -- "gc" to comment visual regions/lines { "numToStr/Comment.nvim", opts = {} }, - -- Fuzzy Finder (files, lsp, etc) - { "nvim-telescope/telescope.nvim", version = "*", dependencies = { "nvim-lua/plenary.nvim" } }, - - -- Fuzzy Finder Algorithm which requires local dependencies to be built. - -- Only load if `make` is available. Make sure you have the system - -- requirements installed. - { - "nvim-telescope/telescope-fzf-native.nvim", - -- NOTE: If you are having trouble with this installation, - -- refer to the README for telescope-fzf-native for more instructions. - build = "make", - cond = function() - return vim.fn.executable("make") == 1 - end, - }, - - { - -- Highlight, edit, and navigate code - "nvim-treesitter/nvim-treesitter", - dependencies = { - "nvim-treesitter/nvim-treesitter-textobjects", - }, - build = ":TSUpdate", - }, - -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart -- These are some example plugins that I've included in the kickstart repository. -- Uncomment any of the lines below to enable them. diff --git a/config/nvim/lua/aleidk/plugins/lualine.lua b/config/nvim/lua/aleidk/plugins/lualine.lua new file mode 100644 index 0000000..f9c97a2 --- /dev/null +++ b/config/nvim/lua/aleidk/plugins/lualine.lua @@ -0,0 +1,13 @@ +return { + -- Set lualine as statusline + "nvim-lualine/lualine.nvim", + -- See `:help lualine.txt` + opts = { + options = { + icons_enabled = false, + theme = "onedark", + component_separators = "|", + section_separators = "", + }, + }, +} diff --git a/config/nvim/lua/aleidk/plugins/telescope.lua b/config/nvim/lua/aleidk/plugins/telescope.lua new file mode 100644 index 0000000..824e45b --- /dev/null +++ b/config/nvim/lua/aleidk/plugins/telescope.lua @@ -0,0 +1,65 @@ +-- Fuzzy Finder (files, lsp, etc) +return { + "nvim-telescope/telescope.nvim", + version = "*", + dependencies = { + { "nvim-lua/plenary.nvim" }, + { + -- Blazingly Fast Fuzzy Finder Algorithm for Telescope + "nvim-telescope/telescope-fzf-native.nvim", + build = "make", + cond = function() + return vim.fn.executable("make") == 1 + end, + }, + }, + opts = { + defaults = { + mappings = { + i = { + [""] = false, + [""] = false, + }, + }, + }, + }, + config = function(_, opts) + local telescope = require("telescope") + telescope.setup(opts) + + -- Enable telescope fzf native, if installed + pcall(telescope.load_extension, "fzf") + + -- See `:help telescope.builtin` + vim.keymap.set( + "n", + "?", + require("telescope.builtin").oldfiles, + { desc = "[?] Find recently opened files" } + ) + vim.keymap.set( + "n", + "", + require("telescope.builtin").buffers, + { desc = "[ ] Find existing buffers" } + ) + vim.keymap.set("n", "/", function() + -- You can pass additional configuration to telescope to change theme, layout, etc. + require("telescope.builtin").current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({ + winblend = 10, + previewer = false, + })) + end, { desc = "[/] Fuzzily search in current buffer" }) + + vim.keymap.set("n", "sf", require("telescope.builtin").find_files, { desc = "[S]earch [F]iles" }) + vim.keymap.set("n", "sh", require("telescope.builtin").help_tags, { desc = "[S]earch [H]elp" }) + vim.keymap.set( + "n", + "sw", + require("telescope.builtin").grep_string, + { desc = "[S]earch current [W]ord" } + ) + vim.keymap.set("n", "sg", require("telescope.builtin").live_grep, { desc = "[S]earch by [G]rep" }) + vim.keymap.set("n", "sd", require("telescope.builtin").diagnostics, { desc = "[S]earch [D]iagnostics" }) + end, +} diff --git a/config/nvim/lua/aleidk/plugins/treesitter.lua b/config/nvim/lua/aleidk/plugins/treesitter.lua new file mode 100644 index 0000000..4f4afc4 --- /dev/null +++ b/config/nvim/lua/aleidk/plugins/treesitter.lua @@ -0,0 +1,69 @@ +return { + -- Highlight, edit, and navigate code + "nvim-treesitter/nvim-treesitter", + dependencies = { + "nvim-treesitter/nvim-treesitter-textobjects", + }, + build = ":TSUpdate", + opts = { + -- Add languages to be installed here that you want installed for treesitter + ensure_installed = { "c", "cpp", "go", "lua", "python", "rust", "tsx", "typescript", "vimdoc", "vim" }, + -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) + auto_install = false, + highlight = { enable = true }, + indent = { enable = true, disable = { "python" } }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "", + node_incremental = "", + scope_incremental = "", + node_decremental = "", + }, + }, + textobjects = { + select = { + enable = true, + lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim + keymaps = { + -- You can use the capture groups defined in textobjects.scm + ["aa"] = "@parameter.outer", + ["ia"] = "@parameter.inner", + ["af"] = "@function.outer", + ["if"] = "@function.inner", + ["ac"] = "@class.outer", + ["ic"] = "@class.inner", + }, + }, + move = { + enable = true, + set_jumps = true, -- whether to set jumps in the jumplist + goto_next_start = { + ["]m"] = "@function.outer", + ["]]"] = "@class.outer", + }, + goto_next_end = { + ["]M"] = "@function.outer", + ["]["] = "@class.outer", + }, + goto_previous_start = { + ["[m"] = "@function.outer", + ["[["] = "@class.outer", + }, + goto_previous_end = { + ["[M"] = "@function.outer", + ["[]"] = "@class.outer", + }, + }, + swap = { + enable = true, + swap_next = { + ["a"] = "@parameter.inner", + }, + swap_previous = { + ["A"] = "@parameter.inner", + }, + }, + }, + }, +} From 3e12ad15ea85e6218d487cff0981a12c20d54652 Mon Sep 17 00:00:00 2001 From: Alexander Navarro Date: Thu, 20 Apr 2023 11:47:46 -0400 Subject: [PATCH 03/17] update --- config/nvim/lazy-lock.json | 26 ------------------------- config/nvim/lua/aleidk/plugins/init.lua | 15 -------------- config/nvim/lua/custom/plugins/init.lua | 5 ----- 3 files changed, 46 deletions(-) delete mode 100644 config/nvim/lazy-lock.json delete mode 100644 config/nvim/lua/custom/plugins/init.lua diff --git a/config/nvim/lazy-lock.json b/config/nvim/lazy-lock.json deleted file mode 100644 index 471f97e..0000000 --- a/config/nvim/lazy-lock.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "Comment.nvim": { "branch": "master", "commit": "a89339ffbee677ab0521a483b6dac7e2e67c907e" }, - "LuaSnip": { "branch": "master", "commit": "8d6c0a93dec34900577ba725e91c44b8d3ca1f45" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" }, - "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, - "fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" }, - "gitsigns.nvim": { "branch": "main", "commit": "372d5cb485f2062ac74abc5b33054abac21d8b58" }, - "indent-blankline.nvim": { "branch": "master", "commit": "018bd04d80c9a73d399c1061fa0c3b14a7614399" }, - "lazy.nvim": { "branch": "main", "commit": "5c89dc52f42e5058a46b0912d7d9042f564e44e0" }, - "lualine.nvim": { "branch": "master", "commit": "84ffb80e452d95e2c46fa29a98ea11a240f7843e" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "7034065099c1665143091c7282b3b1b8f0b23783" }, - "mason.nvim": { "branch": "main", "commit": "b20a4bd32247411d39d8dd5c94e2e5c87d98556d" }, - "neodev.nvim": { "branch": "main", "commit": "e812f3d0e62e21a164b70f90f642cf30129503e4" }, - "nvim-cmp": { "branch": "main", "commit": "777450fd0ae289463a14481673e26246b5e38bf2" }, - "nvim-lspconfig": { "branch": "master", "commit": "eddaef928c1e1dd79a96f5db45f2fd7f2efe7ea0" }, - "nvim-treesitter": { "branch": "master", "commit": "831f37635df26864a397a5e35450eec97bfe60cd" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "8673926519ea61069f9c1366d1ad1949316d250e" }, - "onedark.nvim": { "branch": "master", "commit": "dd640f6cfb0e370cfd3db389f04b172508848bd3" }, - "plenary.nvim": { "branch": "master", "commit": "9ac3e9541bbabd9d73663d757e4fe48a675bb054" }, - "telescope-fzf-native.nvim": { "branch": "main", "commit": "580b6c48651cabb63455e97d7e131ed557b8c7e2" }, - "telescope.nvim": { "branch": "master", "commit": "c1a2af0af69e80e14e6b226d3957a064cd080805" }, - "vim-fugitive": { "branch": "master", "commit": "e6651a79facf5cc2b7c554fdc19eb8a9fe89602c" }, - "vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" }, - "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, - "which-key.nvim": { "branch": "main", "commit": "94cb020ff33a1e0e22fac1c41663d2c439741f17" } -} \ No newline at end of file diff --git a/config/nvim/lua/aleidk/plugins/init.lua b/config/nvim/lua/aleidk/plugins/init.lua index 8869638..1bbbe83 100644 --- a/config/nvim/lua/aleidk/plugins/init.lua +++ b/config/nvim/lua/aleidk/plugins/init.lua @@ -48,19 +48,4 @@ return { -- "gc" to comment visual regions/lines { "numToStr/Comment.nvim", opts = {} }, - - -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart - -- These are some example plugins that I've included in the kickstart repository. - -- Uncomment any of the lines below to enable them. - -- require 'kickstart.plugins.autoformat', - -- require 'kickstart.plugins.debug', - - -- NOTE: The import below automatically adds your own plugins, configuration, etc from `lua/custom/plugins/*.lua` - -- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping - -- up-to-date with whatever is in the kickstart repo. - -- - -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins - -- - -- An additional note is that if you only copied in the `init.lua`, you can just comment this line - -- to get rid of the warning telling you that there are not plugins in `lua/custom/plugins/`. } diff --git a/config/nvim/lua/custom/plugins/init.lua b/config/nvim/lua/custom/plugins/init.lua deleted file mode 100644 index be0eb9d..0000000 --- a/config/nvim/lua/custom/plugins/init.lua +++ /dev/null @@ -1,5 +0,0 @@ --- You can add your own plugins here or in other files in this directory! --- I promise not to create any merge conflicts in this directory :) --- --- See the kickstart.nvim README for more information -return {} From f19df7aec44a45c0a0b56fc2ca0f7b60a82a05c2 Mon Sep 17 00:00:00 2001 From: Alexander Navarro Date: Thu, 20 Apr 2023 11:48:36 -0400 Subject: [PATCH 04/17] add locks.json files to gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 6381fbd..7d69fa7 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,6 @@ config/vifm/Trash config/vifm/vifminfo.json config/lazygit/state.yml config/mpv/shaders + +# locks +**/*-lock.json From d93a4709031f0d358cba399a4201e358c950a42a Mon Sep 17 00:00:00 2001 From: Alexander Navarro Date: Thu, 20 Apr 2023 18:06:12 -0400 Subject: [PATCH 05/17] add dashboard --- config/nvim/lua/aleidk/IDE/completion.lua | 44 ++++++++++++++++++ config/nvim/lua/aleidk/IDE/init.lua | 1 + config/nvim/lua/aleidk/IDE/lsp.lua | 48 -------------------- config/nvim/lua/aleidk/plugins/dashboard.lua | 35 ++++++++++++++ config/nvim/lua/aleidk/plugins/init.lua | 2 +- 5 files changed, 81 insertions(+), 49 deletions(-) create mode 100644 config/nvim/lua/aleidk/IDE/completion.lua create mode 100644 config/nvim/lua/aleidk/plugins/dashboard.lua diff --git a/config/nvim/lua/aleidk/IDE/completion.lua b/config/nvim/lua/aleidk/IDE/completion.lua new file mode 100644 index 0000000..9bed8cd --- /dev/null +++ b/config/nvim/lua/aleidk/IDE/completion.lua @@ -0,0 +1,44 @@ +-- nvim-cmp setup +local cmp = require("cmp") +local luasnip = require("luasnip") + +luasnip.config.setup({}) + +cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete({}), + [""] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + }), + sources = { + { name = "nvim_lsp" }, + { name = "luasnip" }, + }, +}) diff --git a/config/nvim/lua/aleidk/IDE/init.lua b/config/nvim/lua/aleidk/IDE/init.lua index 93c4295..9d905cf 100644 --- a/config/nvim/lua/aleidk/IDE/init.lua +++ b/config/nvim/lua/aleidk/IDE/init.lua @@ -1 +1,2 @@ require("aleidk.IDE.lsp") +require("aleidk.IDE.completion") diff --git a/config/nvim/lua/aleidk/IDE/lsp.lua b/config/nvim/lua/aleidk/IDE/lsp.lua index 57b547a..4d33be2 100644 --- a/config/nvim/lua/aleidk/IDE/lsp.lua +++ b/config/nvim/lua/aleidk/IDE/lsp.lua @@ -69,9 +69,6 @@ vim.keymap.set("n", "]d", vim.diagnostic.goto_next, { desc = "Go to next diagnos vim.keymap.set("n", "e", vim.diagnostic.open_float, { desc = "Open floating diagnostic message" }) vim.keymap.set("n", "q", vim.diagnostic.setloclist, { desc = "Open diagnostics list" }) --- Setup neovim lua configuration -require("neodev").setup() - -- nvim-cmp supports additional completion capabilities, so broadcast that to servers local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities) @@ -92,48 +89,3 @@ mason_lspconfig.setup_handlers({ }) end, }) - --- nvim-cmp setup -local cmp = require("cmp") -local luasnip = require("luasnip") - -luasnip.config.setup({}) - -cmp.setup({ - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.complete({}), - [""] = cmp.mapping.confirm({ - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end, { "i", "s" }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { "i", "s" }), - }), - sources = { - { name = "nvim_lsp" }, - { name = "luasnip" }, - }, -}) diff --git a/config/nvim/lua/aleidk/plugins/dashboard.lua b/config/nvim/lua/aleidk/plugins/dashboard.lua new file mode 100644 index 0000000..08acced --- /dev/null +++ b/config/nvim/lua/aleidk/plugins/dashboard.lua @@ -0,0 +1,35 @@ +return { + "goolord/alpha-nvim", + lazy = false, + opts = function() + local dashboard = require("alpha.themes.dashboard") + + dashboard.section.header.val = { + " ████ ███ █████ █████ ", + " ░░███ ░░░ ░░███ ░░███ ", + " ██████ ░███ ██████ ████ ███████ ░███ █████", + " ░░░░░███ ░███ ███░░███░░███ ███░░███ ░███░░███ ", + " ███████ ░███ ░███████ ░███ ░███ ░███ ░██████░ ", + " ███░░███ ░███ ░███░░░ ░███ ░███ ░███ ░███░░███ ", + "░░████████ █████░░██████ █████░░████████ ████ █████", + " ░░░░░░░░ ░░░░░ ░░░░░░ ░░░░░ ░░░░░░░░ ░░░░ ░░░░░ ", + } + dashboard.section.header.opts.hl = "DashboardHeader" + + dashboard.section.buttons.val = { + dashboard.button("LDR f f", " Find File ", "ff"), + dashboard.button("LDR e", "פּ File Explorer ", "fe"), + dashboard.button("LDR LDR t", " Harpoon", "t"), + } + + dashboard.section.footer.val = + { " ", " ", " ", "Nvim loaded " .. require("lazy").stats().count .. " plugins " } + dashboard.section.footer.opts.hl = "DashboardFooter" + + dashboard.config.layout[1].val = vim.fn.max({ 2, vim.fn.floor(vim.fn.winheight(0) * 0.2) }) + dashboard.config.layout[3].val = 5 + dashboard.config.opts.noautocmd = true + + return dashboard.opts + end, +} diff --git a/config/nvim/lua/aleidk/plugins/init.lua b/config/nvim/lua/aleidk/plugins/init.lua index 1bbbe83..2aed422 100644 --- a/config/nvim/lua/aleidk/plugins/init.lua +++ b/config/nvim/lua/aleidk/plugins/init.lua @@ -21,7 +21,7 @@ return { { "j-hui/fidget.nvim", opts = {} }, -- Additional lua configuration, makes nvim stuff amazing! - "folke/neodev.nvim", + { "folke/neodev.nvim", opts = {} }, }, }, From 0086e99679ad9d76ce3f0f1d2a738cb8227e820f Mon Sep 17 00:00:00 2001 From: Alexander Navarro Date: Thu, 20 Apr 2023 18:06:24 -0400 Subject: [PATCH 06/17] add some stuff --- config/sway/config | 226 ++++++++++++++++++++++++++++++ config/zsh/aliases/flatpak.zsh | 23 +++ config/zsh/aliases/nvim.zsh | 22 +++ config/zsh/aliases/silverblue.zsh | 2 + config/zsh/functions/fedora.zsh | 23 +++ 5 files changed, 296 insertions(+) create mode 100644 config/sway/config create mode 100644 config/zsh/aliases/nvim.zsh create mode 100644 config/zsh/aliases/silverblue.zsh create mode 100644 config/zsh/functions/fedora.zsh diff --git a/config/sway/config b/config/sway/config new file mode 100644 index 0000000..7e98d73 --- /dev/null +++ b/config/sway/config @@ -0,0 +1,226 @@ +# Default config for sway +# +# Copy this to ~/.config/sway/config and edit it to your liking. +# +# Read `man 5 sway` for a complete reference. + +### Variables +# +# Logo key. Use Mod1 for Alt. +set $mod Mod4 + +# Home row direction keys, like vim +set $left h +set $down j +set $up k +set $right l + +# Your preferred terminal emulator +set $term alacritty + +# Your preferred application launcher +# Note: pass the final command to swaymsg so that the resulting window can be opened +# on the original workspace that the command was run on. +set $menu dmenu_path | dmenu | xargs swaymsg exec -- + +### Output configuration +# +# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/) +output * bg ~/Pictures/wallpaper.jpg fill +# +# Example configuration: +# +# output HDMI-A-1 resolution 1920x1080 position 1920,0 +# +# You can get the names of your outputs by running: swaymsg -t get_outputs + +### Idle configuration +# +# Example configuration: +# +# exec swayidle -w \ +# timeout 300 'swaylock -f -c 000000' \ +# timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \ +# before-sleep 'swaylock -f -c 000000' +# +# This will lock your screen after 300 seconds of inactivity, then turn off +# your displays after another 300 seconds, and turn your screens back on when +# resumed. It will also lock your screen before your computer goes to sleep. + +### Input configuration +# +# Example configuration: +# +input "2:14:ETPS/2_Elantech_Touchpad" { + dwt enabled + tap enabled + natural_scroll enabled + middle_emulation enabled +} + +input "type:keyboard" { + xkb_layout latam + xkb_options caps:escape +} +# +# You can get the names of your inputs by running: swaymsg -t get_inputs +# Read `man 5 sway-input` for more information about this section. + +### Key bindings +# +# Basics: +# + # Start a terminal + bindsym $mod+Return exec $term + + # Kill focused window + bindsym $mod+Shift+q kill + + # Start your launcher + bindsym $mod+d exec $menu + + # Drag floating windows by holding down $mod and left mouse button. + # Resize them with right mouse button + $mod. + # Despite the name, also works for non-floating windows. + # Change normal to inverse to use left mouse button for resizing and right + # mouse button for dragging. + floating_modifier $mod normal + + # Reload the configuration file + bindsym $mod+Shift+c reload + + # Exit sway (logs you out of your Wayland session) + bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit' + bindsym $mod+Shift+r reload +# +# Moving around: +# + # Move your focus around + bindsym $mod+$left focus left + bindsym $mod+$down focus down + bindsym $mod+$up focus up + bindsym $mod+$right focus right + # Or use $mod+[up|down|left|right] + bindsym $mod+Left focus left + bindsym $mod+Down focus down + bindsym $mod+Up focus up + bindsym $mod+Right focus right + + # Move the focused window with the same, but add Shift + bindsym $mod+Shift+$left move left + bindsym $mod+Shift+$down move down + bindsym $mod+Shift+$up move up + bindsym $mod+Shift+$right move right + # Ditto, with arrow keys + bindsym $mod+Shift+Left move left + bindsym $mod+Shift+Down move down + bindsym $mod+Shift+Up move up + bindsym $mod+Shift+Right move right +# +# Workspaces: +# + # Switch to workspace + bindsym $mod+1 workspace number 1 + bindsym $mod+2 workspace number 2 + bindsym $mod+3 workspace number 3 + bindsym $mod+4 workspace number 4 + bindsym $mod+5 workspace number 5 + bindsym $mod+6 workspace number 6 + bindsym $mod+7 workspace number 7 + bindsym $mod+8 workspace number 8 + bindsym $mod+9 workspace number 9 + bindsym $mod+0 workspace number 10 + # Move focused container to workspace + bindsym $mod+Shift+1 move container to workspace number 1 + bindsym $mod+Shift+2 move container to workspace number 2 + bindsym $mod+Shift+3 move container to workspace number 3 + bindsym $mod+Shift+4 move container to workspace number 4 + bindsym $mod+Shift+5 move container to workspace number 5 + bindsym $mod+Shift+6 move container to workspace number 6 + bindsym $mod+Shift+7 move container to workspace number 7 + bindsym $mod+Shift+8 move container to workspace number 8 + bindsym $mod+Shift+9 move container to workspace number 9 + bindsym $mod+Shift+0 move container to workspace number 10 + # Note: workspaces can have any name you want, not just numbers. + # We just use 1-10 as the default. +# +# Layout stuff: +# + # You can "split" the current object of your focus with + # $mod+b or $mod+v, for horizontal and vertical splits + # respectively. + bindsym $mod+b splith + bindsym $mod+v splitv + + # Switch the current container between different layout styles + bindsym $mod+s layout stacking + bindsym $mod+w layout tabbed + bindsym $mod+e layout toggle split + + # Make the current focus fullscreen + bindsym $mod+f fullscreen + + # Toggle the current focus between tiling and floating mode + bindsym $mod+Shift+space floating toggle + + # Swap focus between the tiling area and the floating area + bindsym $mod+space focus mode_toggle + + # Move focus to the parent container + bindsym $mod+a focus parent +# +# Scratchpad: +# + # Sway has a "scratchpad", which is a bag of holding for windows. + # You can send windows there and get them back later. + + # Move the currently focused window to the scratchpad + bindsym $mod+Shift+minus move scratchpad + + # Show the next scratchpad window or hide the focused scratchpad window. + # If there are multiple scratchpad windows, this command cycles through them. + bindsym $mod+minus scratchpad show +# +# Resizing containers: +# +mode "resize" { + # left will shrink the containers width + # right will grow the containers width + # up will shrink the containers height + # down will grow the containers height + bindsym $left resize shrink width 10px + bindsym $down resize grow height 10px + bindsym $up resize shrink height 10px + bindsym $right resize grow width 10px + + # Ditto, with arrow keys + bindsym Left resize shrink width 10px + bindsym Down resize grow height 10px + bindsym Up resize shrink height 10px + bindsym Right resize grow width 10px + + # Return to default mode + bindsym Return mode "default" + bindsym Escape mode "default" +} +bindsym $mod+r mode "resize" + +# +# Status Bar: +# +# Read `man 5 sway-bar` for more information about this section. +bar { + position top + + # When the status_command prints a new line to stdout, swaybar updates. + # The default just shows the current date and time. + status_command while date +'%Y-%m-%d %I:%M:%S %p'; do sleep 1; done + + colors { + statusline #ffffff + background #323232 + inactive_workspace #32323200 #32323200 #5c5c5c + } +} + +include /etc/sway/config.d/* diff --git a/config/zsh/aliases/flatpak.zsh b/config/zsh/aliases/flatpak.zsh index 313d894..9133396 100644 --- a/config/zsh/aliases/flatpak.zsh +++ b/config/zsh/aliases/flatpak.zsh @@ -26,3 +26,26 @@ alias obsidian='flatpak run md.obsidian.Obsidian' alias spot='flatpak run dev.alextren.Spot' alias insomnia='flatpak run rest.insomnia.Insomnia' alias sequeler='flatpak run com.github.alecaddd.sequeler' + +# Auto-generated aliases for Flatpak applications + +alias epiphany='flatpak run org.gnome.Epiphany' +alias font-viewer='flatpak run org.gnome.font-viewer' +alias eog='flatpak run org.gnome.eog' +alias clocks='flatpak run org.gnome.clocks' +alias baobab='flatpak run org.gnome.baobab' +alias weather='flatpak run org.gnome.Weather' +alias texteditor='flatpak run org.gnome.TextEditor' +alias nautiluspreviewer='flatpak run org.gnome.NautilusPreviewer' +alias maps='flatpak run org.gnome.Maps' +alias logs='flatpak run org.gnome.Logs' +alias extensions='flatpak run org.gnome.Extensions' +alias evince='flatpak run org.gnome.Evince' +alias contacts='flatpak run org.gnome.Contacts' +alias connections='flatpak run org.gnome.Connections' +alias characters='flatpak run org.gnome.Characters' +alias calendar='flatpak run org.gnome.Calendar' +alias calculator='flatpak run org.gnome.Calculator' +alias mediawriter='flatpak run org.fedoraproject.MediaWriter' +alias pods='flatpak run com.github.marhkb.Pods' +alias podmandesktop='flatpak run io.podman_desktop.PodmanDesktop' diff --git a/config/zsh/aliases/nvim.zsh b/config/zsh/aliases/nvim.zsh new file mode 100644 index 0000000..fc68f59 --- /dev/null +++ b/config/zsh/aliases/nvim.zsh @@ -0,0 +1,22 @@ +alias \ + vi='nvim' \ + vi-astro='NVIM_APPNAME=AstroNvim nvim' + +vis() { + items=( + default + AstroNvim + ) + config=$(printf "%s\n" "${items[@]}" | fzf --prompt=" Neovim Config  " --height=~50% --layout=reverse --border --exit-0) + + if [[ -z $config ]]; then + echo "Nothing selected" + return 0 + elif [[ $config == "default" ]]; then + config="" + fi + + NVIM_APPNAME=$config nvim $@ +} + +bindkey -s ^a "vis\n" diff --git a/config/zsh/aliases/silverblue.zsh b/config/zsh/aliases/silverblue.zsh new file mode 100644 index 0000000..63b1570 --- /dev/null +++ b/config/zsh/aliases/silverblue.zsh @@ -0,0 +1,2 @@ +alias \ + sb-list='ostree remote refs fedora | grep "[0-9]\{2\}\/x86_64\/[a-z]\+$"' diff --git a/config/zsh/functions/fedora.zsh b/config/zsh/functions/fedora.zsh new file mode 100644 index 0000000..7edb325 --- /dev/null +++ b/config/zsh/functions/fedora.zsh @@ -0,0 +1,23 @@ +dnf-save-install() { + file="$DOTS/exports/dnf.txt" + echo "$*" >> "$file" + sort -u -o "$file" "$file" + sudo dnf install -y $(cat "$DOTS/exports/dnf.txt") +} + +upgrade() { + sudo dnf upgrade --refresh -y +} + +mayor-upgrade() { + if [[ $(dnf check-update -q) ]]; then + echo "There are updates pending, update and reboot? [y/N]" + read -r answer + + if [[ $answer == 'y' || $answer == 'Y' ]]; then + upgrade + sc-reboot + + fi + fi +} From 17f496aeba0a503d6be412bebee9edbc44cec5bb Mon Sep 17 00:00:00 2001 From: Alexander Navarro Date: Thu, 20 Apr 2023 18:06:30 -0400 Subject: [PATCH 07/17] add fedora exports --- exports/copr.txt | 1 + exports/dnf.txt | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 exports/copr.txt create mode 100644 exports/dnf.txt diff --git a/exports/copr.txt b/exports/copr.txt new file mode 100644 index 0000000..bcb2188 --- /dev/null +++ b/exports/copr.txt @@ -0,0 +1 @@ +atim/lazygit diff --git a/exports/dnf.txt b/exports/dnf.txt new file mode 100644 index 0000000..c18cf76 --- /dev/null +++ b/exports/dnf.txt @@ -0,0 +1,14 @@ +dnf-plugin-system-upgrade +exa +fd-find +flatpak +fzf +gcc +gcc-c++ +git +gnome-software +neovim +nodejs +remove-retired-packages +tmux +zsh From 9250f5bac9851c3e8fdaa9c6b90f348a39aa787a Mon Sep 17 00:00:00 2001 From: Alexander Navarro Date: Thu, 20 Apr 2023 18:26:10 -0400 Subject: [PATCH 08/17] change colorscheme to rose-pine --- .gitmodules | 3 ++ config/alacritty/alacritty.yml | 2 +- config/alacritty/themes/rose-pine | 1 + .../nvim/lua/aleidk/plugins/colorscheme.lua | 30 +++++++++++++++++++ config/nvim/lua/aleidk/plugins/init.lua | 9 ------ 5 files changed, 35 insertions(+), 10 deletions(-) create mode 160000 config/alacritty/themes/rose-pine create mode 100644 config/nvim/lua/aleidk/plugins/colorscheme.lua diff --git a/.gitmodules b/.gitmodules index eeaa940..85a0369 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "config/foot/themes/catppuccin"] path = config/foot/themes/catppuccin url = https://github.com/catppuccin/foot.git +[submodule "config/alacritty/themes/rose-pine"] + path = config/alacritty/themes/rose-pine + url = https://github.com/rose-pine/alacritty.git diff --git a/config/alacritty/alacritty.yml b/config/alacritty/alacritty.yml index 2ae5c19..1c67d33 100644 --- a/config/alacritty/alacritty.yml +++ b/config/alacritty/alacritty.yml @@ -10,7 +10,7 @@ # to the user's home directory starting with `~/`. import: # - /path/to/alacritty.yml - - ~/.config/alacritty/themes/catppuccin/catppuccin-macchiato.yml + - ~/.config/alacritty/themes/rose-pine/dist/rose-pine-moon.yml # Any items in the `env` entry below will be added as # environment variables. Some entries may override variables # set by alacritty itself. diff --git a/config/alacritty/themes/rose-pine b/config/alacritty/themes/rose-pine new file mode 160000 index 0000000..7c3625f --- /dev/null +++ b/config/alacritty/themes/rose-pine @@ -0,0 +1 @@ +Subproject commit 7c3625f3d0f34359ba114e09b1ba3f3c1bed399a diff --git a/config/nvim/lua/aleidk/plugins/colorscheme.lua b/config/nvim/lua/aleidk/plugins/colorscheme.lua new file mode 100644 index 0000000..eaf0d06 --- /dev/null +++ b/config/nvim/lua/aleidk/plugins/colorscheme.lua @@ -0,0 +1,30 @@ +local colorscheme = "rose-pine" +return { + "rose-pine/neovim", + name = colorscheme, + priority = 1000, + config = function(_, opts) + require(colorscheme).setup(opts) + vim.cmd.colorscheme(colorscheme) + end, + opts = { + --- @usage 'auto'|'main'|'moon'|'dawn' + variant = "moon", + --- @usage 'main'|'moon'|'dawn' + dark_variant = "moon", + --- @usage string hex value or named color from rosepinetheme.com/palette + groups = { + background = "none", + }, + -- Change specific vim highlight groups + -- https://github.com/rose-pine/neovim/wiki/Recipes + highlight_groups = { + TelescopeBorder = { fg = "highlight_high", bg = "none" }, + TelescopeNormal = { bg = "none" }, + TelescopePromptNormal = { bg = "base" }, + TelescopeResultsNormal = { fg = "subtle", bg = "none" }, + TelescopeSelection = { fg = "text", bg = "base" }, + TelescopeSelectionCaret = { fg = "rose", bg = "rose" }, + }, + }, +} diff --git a/config/nvim/lua/aleidk/plugins/init.lua b/config/nvim/lua/aleidk/plugins/init.lua index 2aed422..d82aa80 100644 --- a/config/nvim/lua/aleidk/plugins/init.lua +++ b/config/nvim/lua/aleidk/plugins/init.lua @@ -37,15 +37,6 @@ return { opts = {}, }, - { - -- Theme inspired by Atom - "navarasu/onedark.nvim", - priority = 1000, - config = function() - vim.cmd.colorscheme("onedark") - end, - }, - -- "gc" to comment visual regions/lines { "numToStr/Comment.nvim", opts = {} }, } From 421382f27c0aa60663e5e02d08a5d04a07c101a0 Mon Sep 17 00:00:00 2001 From: Alexander Navarro Date: Thu, 20 Apr 2023 18:36:14 -0400 Subject: [PATCH 09/17] add harpoon.lua --- config/nvim/lua/aleidk/plugins/harpoon.lua | 55 ++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 config/nvim/lua/aleidk/plugins/harpoon.lua diff --git a/config/nvim/lua/aleidk/plugins/harpoon.lua b/config/nvim/lua/aleidk/plugins/harpoon.lua new file mode 100644 index 0000000..7871e57 --- /dev/null +++ b/config/nvim/lua/aleidk/plugins/harpoon.lua @@ -0,0 +1,55 @@ +return { + "ThePrimeagen/harpoon", + -- lazy = false, + opts = { + global_settings = { + -- sets the marks upon calling `toggle` on the ui, instead of require `:w`. + save_on_toggle = true, + -- saves the harpoon file upon every change. disabling is unrecommended. + save_on_change = true, + -- sets harpoon to run the command immediately as it's passed to the terminal when calling `sendCommand`. + enter_on_sendcmd = true, + -- closes any tmux windows harpoon that harpoon creates when you close Neovim. + tmux_autoclose_windows = false, + -- filetypes that you want to prevent from adding to the harpoon list menu. + excluded_filetypes = { "harpoon" }, + -- set marks specific to each git branch inside git repository + mark_branch = false, + }, + }, + config = function(_, opts) + require("harpoon").setup(opts) + + local mark = require("harpoon.mark") + local ui = require("harpoon.ui") + local telescope = require("telescope") + + telescope.load_extension("harpoon") + + local function map(key, func, desc) + vim.keymap.set("n", "" .. key, func, { desc = desc }) + end + + map("n", mark.add_file, "Add mark") + + map("t", ui.toggle_quick_menu, "Toogle UI") + + map("j", function() + ui.nav_file(1) + end, "Navigate to file 1") + + map("k", function() + ui.nav_file(2) + end, "Navigate to file 2") + + map("l", function() + ui.nav_file(3) + end, "Navigate to file 3") + + map("ñ", function() + ui.nav_file(4) + end, "Navigate to file 4") + + map("T", "Telescope harpoon marks", "Open marks in telescope") + end, +} From 01d31542187f3cc76b43464264cc5b40d5edc83f Mon Sep 17 00:00:00 2001 From: Alexander Navarro Date: Thu, 27 Apr 2023 12:28:45 -0400 Subject: [PATCH 10/17] update plugins --- config/nvim/lua/aleidk/IDE/init.lua | 1 + config/nvim/lua/aleidk/IDE/lsp.lua | 16 ++++--- config/nvim/lua/aleidk/IDE/null-ls.lua | 38 +++++++++++++++ .../nvim/lua/aleidk/plugins/colorscheme.lua | 48 ++++++++++--------- config/nvim/lua/aleidk/plugins/init.lua | 9 ++++ .../nvim/lua/aleidk/plugins/lsp_signature.lua | 14 ++++++ .../nvim/lua/aleidk/plugins/nvim-spider.lua | 13 +++++ 7 files changed, 110 insertions(+), 29 deletions(-) create mode 100644 config/nvim/lua/aleidk/IDE/null-ls.lua create mode 100644 config/nvim/lua/aleidk/plugins/lsp_signature.lua create mode 100644 config/nvim/lua/aleidk/plugins/nvim-spider.lua diff --git a/config/nvim/lua/aleidk/IDE/init.lua b/config/nvim/lua/aleidk/IDE/init.lua index 9d905cf..3b6291b 100644 --- a/config/nvim/lua/aleidk/IDE/init.lua +++ b/config/nvim/lua/aleidk/IDE/init.lua @@ -1,2 +1,3 @@ require("aleidk.IDE.lsp") require("aleidk.IDE.completion") +require("aleidk.IDE.null-ls") diff --git a/config/nvim/lua/aleidk/IDE/lsp.lua b/config/nvim/lua/aleidk/IDE/lsp.lua index 4d33be2..42b716f 100644 --- a/config/nvim/lua/aleidk/IDE/lsp.lua +++ b/config/nvim/lua/aleidk/IDE/lsp.lua @@ -49,12 +49,16 @@ end -- Add any additional override configuration in the following tables. They will be passed to -- the `settings` field of the server config. You must look up that documentation yourself. local servers = { - -- clangd = {}, - -- gopls = {}, - -- pyright = {}, - -- rust_analyzer = {}, - -- tsserver = {}, - + bashls = {}, + cssls = {}, + dockerls = {}, + emmet_ls = {}, + html = {}, + pyright = {}, + rust_analyzer = {}, + sqlls = {}, + tsserver = {}, + yamlls = {}, lua_ls = { Lua = { workspace = { checkThirdParty = false }, diff --git a/config/nvim/lua/aleidk/IDE/null-ls.lua b/config/nvim/lua/aleidk/IDE/null-ls.lua new file mode 100644 index 0000000..28f1981 --- /dev/null +++ b/config/nvim/lua/aleidk/IDE/null-ls.lua @@ -0,0 +1,38 @@ +-- Linter and formatter configuration + +require("mason-null-ls").setup({ + handlers = {}, -- this make mason-null-ls to auto setup handlers + ensure_installed = { + "blade_formatter", + "blue", + "eslint_d", + "fixjson", + "gitlint", + "intelephense", + "markdownlint", + "php-cs-fixer", + "prettierd", + "shellcheck", + "shfmt", + "sql-formatter", + "stylua", + "yamlint", + }, +}) + +local null_ls = require("null-ls.builtins") + +require("null-ls").setup({ + sources = { + null_ls.formatting.prettierd.with({ + disabled_filetypes = { "markdown" }, + }), + + null_ls.formatting.phpcsfixer.with({ + extra_args = { + "--config", + "$HOME/.config/php-cs-fixer-conf.php", + }, + }), + }, +}) diff --git a/config/nvim/lua/aleidk/plugins/colorscheme.lua b/config/nvim/lua/aleidk/plugins/colorscheme.lua index eaf0d06..bd10ca9 100644 --- a/config/nvim/lua/aleidk/plugins/colorscheme.lua +++ b/config/nvim/lua/aleidk/plugins/colorscheme.lua @@ -1,30 +1,32 @@ -local colorscheme = "rose-pine" +local colorscheme = "onedark" + return { - "rose-pine/neovim", - name = colorscheme, + "olimorris/onedarkpro.nvim", priority = 1000, - config = function(_, opts) - require(colorscheme).setup(opts) - vim.cmd.colorscheme(colorscheme) - end, opts = { - --- @usage 'auto'|'main'|'moon'|'dawn' - variant = "moon", - --- @usage 'main'|'moon'|'dawn' - dark_variant = "moon", - --- @usage string hex value or named color from rosepinetheme.com/palette - groups = { - background = "none", + options = { + transparency = true, -- Use a transparentbackground? }, - -- Change specific vim highlight groups - -- https://github.com/rose-pine/neovim/wiki/Recipes - highlight_groups = { - TelescopeBorder = { fg = "highlight_high", bg = "none" }, - TelescopeNormal = { bg = "none" }, - TelescopePromptNormal = { bg = "base" }, - TelescopeResultsNormal = { fg = "subtle", bg = "none" }, - TelescopeSelection = { fg = "text", bg = "base" }, - TelescopeSelectionCaret = { fg = "rose", bg = "rose" }, + colors = { + bg = "#000000", + fg = "#abb2bf", + red = "#ef596f", + orange = "#fab387", + yellow = "#e5c07b", + green = "#89ca78", + cyan = "#2bbac5", + blue = "#61afef", + purple = "#d55fde", + white = "#abb2bf", + black = "#000000", + gray = "#434852", + highlight = "#e2be7d", + comment = "#7f848e", + none = "NONE", }, }, + config = function(_, opts) + require("onedarkpro").setup(opts) + vim.cmd.colorscheme(colorscheme) + end, } diff --git a/config/nvim/lua/aleidk/plugins/init.lua b/config/nvim/lua/aleidk/plugins/init.lua index d82aa80..fda9c80 100644 --- a/config/nvim/lua/aleidk/plugins/init.lua +++ b/config/nvim/lua/aleidk/plugins/init.lua @@ -31,6 +31,15 @@ return { dependencies = { "hrsh7th/cmp-nvim-lsp", "L3MON4D3/LuaSnip", "saadparwaiz1/cmp_luasnip" }, }, + { + "jay-babu/mason-null-ls.nvim", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + "williamboman/mason.nvim", + "jose-elias-alvarez/null-ls.nvim", + }, + }, + { -- Useful plugin to show you pending keybinds. "folke/which-key.nvim", diff --git a/config/nvim/lua/aleidk/plugins/lsp_signature.lua b/config/nvim/lua/aleidk/plugins/lsp_signature.lua new file mode 100644 index 0000000..dc2e03a --- /dev/null +++ b/config/nvim/lua/aleidk/plugins/lsp_signature.lua @@ -0,0 +1,14 @@ +return { + "ray-x/lsp_signature.nvim", + lazy = false, -- Doesn't work if lazy loaded + opts = { + hint_enable = false, + }, + keys = { + { + "lk", + vim.lsp.buf.signature_help, + desc = "Toggle signature", + }, + }, +} diff --git a/config/nvim/lua/aleidk/plugins/nvim-spider.lua b/config/nvim/lua/aleidk/plugins/nvim-spider.lua new file mode 100644 index 0000000..2b5b634 --- /dev/null +++ b/config/nvim/lua/aleidk/plugins/nvim-spider.lua @@ -0,0 +1,13 @@ +return { + "chrisgrieser/nvim-spider", + event = "VeryLazy", + config = function() + require("spider").setup({ + skipInsignificantPunctuation = false, + }) + vim.keymap.set({ "n", "o", "x" }, "w", "lua require('spider').motion('w')", { desc = "Spider-w" }) + vim.keymap.set({ "n", "o", "x" }, "e", "lua require('spider').motion('e')", { desc = "Spider-e" }) + vim.keymap.set({ "n", "o", "x" }, "b", "lua require('spider').motion('b')", { desc = "Spider-b" }) + vim.keymap.set({ "n", "o", "x" }, "ge", "lua require('spider').motion('ge')", { desc = "Spider-ge" }) + end, +} From c080f17b085bf6b51ece3764be448986b161a3cb Mon Sep 17 00:00:00 2001 From: Alexander Navarro Date: Thu, 27 Apr 2023 14:43:03 -0400 Subject: [PATCH 11/17] add nvim-tree --- config/nvim/lua/aleidk/IDE/lsp.lua | 8 +- config/nvim/lua/aleidk/plugins/nvim-tree.lua | 88 ++++++++++++++++++++ 2 files changed, 92 insertions(+), 4 deletions(-) create mode 100644 config/nvim/lua/aleidk/plugins/nvim-tree.lua diff --git a/config/nvim/lua/aleidk/IDE/lsp.lua b/config/nvim/lua/aleidk/IDE/lsp.lua index 42b716f..eb0f4411 100644 --- a/config/nvim/lua/aleidk/IDE/lsp.lua +++ b/config/nvim/lua/aleidk/IDE/lsp.lua @@ -68,10 +68,10 @@ local servers = { } -- Diagnostic keymaps -vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, { desc = "Go to previous diagnostic message" }) -vim.keymap.set("n", "]d", vim.diagnostic.goto_next, { desc = "Go to next diagnostic message" }) -vim.keymap.set("n", "e", vim.diagnostic.open_float, { desc = "Open floating diagnostic message" }) -vim.keymap.set("n", "q", vim.diagnostic.setloclist, { desc = "Open diagnostics list" }) +-- vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, { desc = "Go to previous diagnostic message" }) +-- vim.keymap.set("n", "]d", vim.diagnostic.goto_next, { desc = "Go to next diagnostic message" }) +-- vim.keymap.set("n", "e", vim.diagnostic.open_float, { desc = "Open floating diagnostic message" }) +-- vim.keymap.set("n", "q", vim.diagnostic.setloclist, { desc = "Open diagnostics list" }) -- nvim-cmp supports additional completion capabilities, so broadcast that to servers local capabilities = vim.lsp.protocol.make_client_capabilities() diff --git a/config/nvim/lua/aleidk/plugins/nvim-tree.lua b/config/nvim/lua/aleidk/plugins/nvim-tree.lua new file mode 100644 index 0000000..91b003c --- /dev/null +++ b/config/nvim/lua/aleidk/plugins/nvim-tree.lua @@ -0,0 +1,88 @@ +return { + "nvim-tree/nvim-tree.lua", + -- enabled = false, + version = "*", + dependencies = { + "nvim-tree/nvim-web-devicons", + }, + lazy = false, + config = function() + local tree = require("nvim-tree") + local tree_cb = require("nvim-tree.config").nvim_tree_callback + local api = require("nvim-tree.api") + + tree.setup({ + hijack_unnamed_buffer_when_opening = true, + disable_netrw = true, + hijack_netrw = true, + hijack_cursor = true, -- cursor at the start of filename + sync_root_with_cwd = true, + respect_buf_cwd = true, + update_focused_file = { + enable = true, -- focus curren file + update_root = true, + }, + actions = { open_file = { quit_on_open = true } }, + renderer = { + full_name = true, -- show remaining name in floating text + group_empty = true, -- group empty folders + add_trailing = true, -- Trailing slash to folders + highlight_opened_files = "all", + highlight_git = true, + }, + view = { + centralize_selection = true, -- center current file on enter + width = 30, -- N° of columns or % + }, + on_attach = function(bufnr) + local function opts(desc) + return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true } + end + + -- Check defaults here: https://github.com/nvim-tree/nvim-tree.lua/wiki/Migrating-To-on_attach + api.config.mappings.default_on_attach(bufnr) + + vim.keymap.set("n", "l", api.node.open.edit, opts("Open")) + vim.keymap.set("n", "o", api.node.open.edit, opts("Open")) + vim.keymap.set("n", "", api.node.open.edit, opts("Open")) + vim.keymap.set("n", "<2-LeftMouse>", api.node.open.edit, opts("Open")) + vim.keymap.set("n", "s", api.node.open.vertical, opts("Open in vsplit")) + vim.keymap.set("n", "v", api.node.open.horizontal, opts("Open in hsplit")) + vim.keymap.set("n", "t", api.node.open.tab, opts("Open in tab")) + vim.keymap.set("n", "h", api.node.navigate.parent_close, opts("Close dir")) + vim.keymap.set("n", "", api.node.navigate.parent_close, opts("Close dir")) + vim.keymap.set("n", "i", api.tree.toggle_hidden_filter, opts("Toggle Dotfiles")) + vim.keymap.set("n", "I", api.tree.toggle_gitignore_filter, opts("Toggle Git Ignore")) + end, + }) + + -- Auto open when a dir is opened + + local function open_nvim_tree(data) + -- buffer is a directory + local directory = vim.fn.isdirectory(data.file) == 1 + + if not directory then + return + end + + -- create a new, empty buffer + vim.cmd.enew() + + -- wipe the directory buffer + vim.cmd.bw(data.buf) + + -- change to the directory + vim.cmd.cd(data.file) + + -- open the tree + require("nvim-tree.api").tree.open() + end + + vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree }) + + -- bindings + vim.keymap.set("n", "e", ":NvimTreeToggle", { desc = "Toggle file tree", silent = true }) + vim.keymap.set("n", "", ":NvimTreeToggle", { desc = "Toggle file tree", silent = true }) + end, +} From 195fb5d98dad6a958e0df871a5bb97d51f2d4d5e Mon Sep 17 00:00:00 2001 From: Alexander Navarro Date: Wed, 10 May 2023 22:21:53 -0400 Subject: [PATCH 12/17] update plugins --- config/astronvim/lua/user/mappings.lua | 14 ------- config/nvim/init.lua | 19 ++++----- config/nvim/lua/aleidk/keymaps.lua | 39 +++++++++++++++++ config/nvim/lua/aleidk/plugins/heirline.lua | 15 +++++++ config/nvim/lua/aleidk/plugins/init.lua | 18 +++++++- .../nvim/lua/aleidk/plugins/pretty-fold.lua | 42 +++++++++++++++++++ config/nvim/lua/aleidk/plugins/treesitter.lua | 16 ++++++- config/nvim/lua/aleidk/plugins/trouble.lua | 32 ++++++++++++++ .../lua/aleidk/plugins/ts-node-action.lua | 18 ++++++++ config/sway/config | 2 +- config/sway/sway-bar.sh | 13 ++++++ exports/dnf.txt | 3 ++ setup/rust | 5 ++- 13 files changed, 204 insertions(+), 32 deletions(-) create mode 100644 config/nvim/lua/aleidk/plugins/heirline.lua create mode 100644 config/nvim/lua/aleidk/plugins/pretty-fold.lua create mode 100644 config/nvim/lua/aleidk/plugins/trouble.lua create mode 100644 config/nvim/lua/aleidk/plugins/ts-node-action.lua create mode 100755 config/sway/sway-bar.sh diff --git a/config/astronvim/lua/user/mappings.lua b/config/astronvim/lua/user/mappings.lua index 0f0c266..329e76b 100644 --- a/config/astronvim/lua/user/mappings.lua +++ b/config/astronvim/lua/user/mappings.lua @@ -3,17 +3,13 @@ return { --Usefull vanilla remaps ["J"] = { "mzJ`z", desc = "Keep cursor in column while joining lines" }, - -- [""] = { "zz", desc = "Keep cursor centered while junping" }, [""] = { "zz", desc = "Keep cursor centered while junping" }, - -- Keep cursor centered while searching ["n"] = { "nzzzv", desc = "Keep cursor centered while searching" }, ["N"] = { "Nzzzv", desc = "Keep cursor centered while searching" }, - ["Q"] = "", - -- Buffers ["H"] = { function() @@ -27,7 +23,6 @@ return { end, desc = "Next buffer", }, - [""] = { "ToggleTerm", desc = "Toggle terminal" }, ["fn"] = false, ["fo"] = false, @@ -36,7 +31,6 @@ return { [""] = false, [""] = false, [""] = false, - [""] = { function() require("dap").terminate() @@ -91,7 +85,6 @@ return { end, desc = "Debugger: clear breakpoint", }, - ["fp"] = { function() require("telescope").extensions.projects.projects() @@ -110,33 +103,28 @@ return { end, desc = "Go to prev diagnostic", }, - ["Ch"] = { function() require("nvim-comment-frame").add_comment() end, desc = "Add a comment frame", }, - ["CH"] = { function() require("nvim-comment-frame").add_multiline_comment() end, desc = "Add a multiline comment frame", }, - ["Cd"] = { function() require("neogen").generate() end, desc = "Generate comment docstring", }, - ["ft"] = { "TodoTrouble", desc = "Search TODOS", }, - ["r"] = { [[:%s/\<\>//gI]], desc = "Search and replace current word", @@ -151,12 +139,10 @@ return { ":s/", desc = "Search and replace", }, - ["p"] = { [["_dP]], desc = "Paste whitout lossing yanked text", }, - -- move selection up and down ["J"] = ":m '>+1gv=gv", ["K"] = ":m '<-2gv=gv", diff --git a/config/nvim/init.lua b/config/nvim/init.lua index ad174bc..b2b8d91 100644 --- a/config/nvim/init.lua +++ b/config/nvim/init.lua @@ -6,14 +6,14 @@ require("aleidk.options") -- Install package manager https://github.com/folke/lazy.nvim 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, - }) + 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) @@ -25,6 +25,3 @@ require("lazy").setup("aleidk.plugins") require("aleidk.keymaps") require("aleidk.autocmds") require("aleidk.IDE") - --- The line beneath this is called `modeline`. See `:help modeline` --- vim: ts=2 sts=2 sw=2 et diff --git a/config/nvim/lua/aleidk/keymaps.lua b/config/nvim/lua/aleidk/keymaps.lua index a234a6e..20f4ac0 100644 --- a/config/nvim/lua/aleidk/keymaps.lua +++ b/config/nvim/lua/aleidk/keymaps.lua @@ -1,5 +1,12 @@ -- [[ Basic Keymaps ]] +local function default(desc) + return { + silent = true, + desc = desc, + } +end + -- Keymaps for better default experience -- See `:help vim.keymap.set()` vim.keymap.set({ "n", "v" }, "", "", { silent = true }) @@ -7,3 +14,35 @@ vim.keymap.set({ "n", "v" }, "", "", { silent = true }) -- Remap for dealing with word wrap vim.keymap.set("n", "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) vim.keymap.set("n", "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) + +vim.keymap.set("n", "J", "mzJ`z", default("Keep cursor in column while joining lines")) + +vim.keymap.set("n", "", "zz", default("Keep cursor centered while junping")) +vim.keymap.set("n", "", "zz", default("Keep cursor centered while junping")) + +vim.keymap.set("n", "n", "nzzzv", default("Keep cursor centered while searching")) +vim.keymap.set("n", "N", "Nzzzv", default("Keep cursor centered while searching")) + +vim.keymap.set("n", "Q", "", {}) + +vim.keymap.set("n", "lj", function() + vim.diagnostic.goto_next() +end, default("Go to next diagnostic")) +vim.keymap.set("n", "lk", function() + vim.diagnostic.goto_prev() +end, default("Go to prev diagnostic")) + +vim.keymap.set( + "n", + "r", + [[:%s/\<\>//gI]], + default("Search and replace current word") +) + +vim.keymap.set("n", "R", ":%s/", default("Search and replace in the whole file")) +vim.keymap.set("v", "r", ":s/", default("Search and replace in selection")) + +vim.keymap.set("v", "p", [["_dP]], default("Paste whitout lossing yanked text")) + +vim.keymap.set("v", "J", ":m '>+1gv=gv", default("Move selection down")) +vim.keymap.set("v", "K", ":m '<-2gv=gv", default("Move selection up")) diff --git a/config/nvim/lua/aleidk/plugins/heirline.lua b/config/nvim/lua/aleidk/plugins/heirline.lua new file mode 100644 index 0000000..e315e95 --- /dev/null +++ b/config/nvim/lua/aleidk/plugins/heirline.lua @@ -0,0 +1,15 @@ +return { + "rebelot/heirline.nvim", + -- You can optionally lazy-load heirline on UiEnter + -- to make sure all required plugins and colorschemes are loaded before setup + event = "UiEnter", + config = function() + require("heirline").setup({ + statusline = {}, + winbar = {}, + tabline = {}, + statuscolumn = {}, + opts = {}, + }) + end, +} diff --git a/config/nvim/lua/aleidk/plugins/init.lua b/config/nvim/lua/aleidk/plugins/init.lua index fda9c80..dfe6496 100644 --- a/config/nvim/lua/aleidk/plugins/init.lua +++ b/config/nvim/lua/aleidk/plugins/init.lua @@ -18,10 +18,10 @@ return { -- Useful status updates for LSP -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` - { "j-hui/fidget.nvim", opts = {} }, + { "j-hui/fidget.nvim", opts = {} }, -- Additional lua configuration, makes nvim stuff amazing! - { "folke/neodev.nvim", opts = {} }, + { "folke/neodev.nvim", opts = {} }, }, }, @@ -48,4 +48,18 @@ return { -- "gc" to comment visual regions/lines { "numToStr/Comment.nvim", opts = {} }, + + { + "famiu/bufdelete.nvim", + config = nil, + keys = { + { + "c", + function() + require("bufdelete").bufdelete(0, true) + end, + desc = "Close buffer", + }, + }, + }, } diff --git a/config/nvim/lua/aleidk/plugins/pretty-fold.lua b/config/nvim/lua/aleidk/plugins/pretty-fold.lua new file mode 100644 index 0000000..280dbfc --- /dev/null +++ b/config/nvim/lua/aleidk/plugins/pretty-fold.lua @@ -0,0 +1,42 @@ +return { + "anuvyklack/pretty-fold.nvim", + config = { + sections = { + left = { + "+", + function() + return string.rep("-", vim.v.foldlevel) + end, + " ", + "content", + " ", + "number_of_folded_lines", + " ", + function() + return string.rep("-", vim.v.foldlevel) + end, + "+", + }, + }, + fill_char = " ", + + -- Possible values: + -- "delete" : Delete all comment signs from the fold string. + -- "spaces" : Replace all comment signs with equal number of spaces. + -- false : Do nothing with comment signs. + process_comment_signs = "delete", + + -- List of patterns that will be removed from content foldtext section. + stop_words = { + "@brief%s*", -- (for C++) Remove '@brief' and all spaces after. + }, + + matchup_patterns = { + { "{", "}" }, + { "%(", ")" }, -- % to escape lua pattern char + { "%[", "]" }, -- % to escape lua pattern char + }, + + ft_ignore = { "neorg" }, + }, +} diff --git a/config/nvim/lua/aleidk/plugins/treesitter.lua b/config/nvim/lua/aleidk/plugins/treesitter.lua index 4f4afc4..2c81784 100644 --- a/config/nvim/lua/aleidk/plugins/treesitter.lua +++ b/config/nvim/lua/aleidk/plugins/treesitter.lua @@ -3,15 +3,17 @@ return { "nvim-treesitter/nvim-treesitter", dependencies = { "nvim-treesitter/nvim-treesitter-textobjects", + "windwp/nvim-ts-autotag", + "JoosepAlviste/nvim-ts-context-commentstring", }, build = ":TSUpdate", opts = { -- Add languages to be installed here that you want installed for treesitter ensure_installed = { "c", "cpp", "go", "lua", "python", "rust", "tsx", "typescript", "vimdoc", "vim" }, -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) - auto_install = false, + auto_install = true, highlight = { enable = true }, - indent = { enable = true, disable = { "python" } }, + indent = { enable = true }, incremental_selection = { enable = true, keymaps = { @@ -65,5 +67,15 @@ return { }, }, }, + autotag = { enable = true }, + context_commentstring = { enable = true, enable_autocmd = false }, }, + config = function(_, opts) + require("nvim-treesitter.configs").setup(opts) + vim.cmd([[ + set foldmethod=expr + set foldexpr=nvim_treesitter#foldexpr() + set nofoldenable + ]]) + end, } diff --git a/config/nvim/lua/aleidk/plugins/trouble.lua b/config/nvim/lua/aleidk/plugins/trouble.lua new file mode 100644 index 0000000..57271e1 --- /dev/null +++ b/config/nvim/lua/aleidk/plugins/trouble.lua @@ -0,0 +1,32 @@ +return { + "folke/trouble.nvim", + -- dependencies = { "kyazdani42/nvim-web-devicons" }, + config = function() + require("trouble").setup({ + mode = "document_diagnostics", + action_keys = { -- key mappings for actions in the trouble list + -- map to {} to remove a mapping, for example: + -- close = {}, + close = "q", -- close the list + cancel = "", -- cancel the preview and get back to your last window / buffer / cursor + refresh = "r", -- manually refresh + jump = { "", "" }, -- jump to the diagnostic or open / close folds + open_split = { "s" }, -- open buffer in new split + open_vsplit = { "v" }, -- open buffer in new vsplit + open_tab = { "t" }, -- open buffer in new tab + jump_close = { "o" }, -- jump to the diagnostic and close the list + toggle_mode = "m", -- toggle between "workspace" and "document" diagnostics mode + toggle_preview = "P", -- toggle auto_preview + hover = "K", -- opens a small popup with the full multiline message + preview = "p", -- preview the diagnostic location + close_folds = { "zM", "zm" }, -- close all folds + open_folds = { "zR", "zr" }, -- open all folds + toggle_fold = { "zA", "za" }, -- toggle fold of current file + previous = "k", -- previous item + next = "j", -- next item + }, + }) + + vim.keymap.set("n", "fd", "TroubleToggle", { silent = true, desc = "Search diagnostics" }) + end, +} diff --git a/config/nvim/lua/aleidk/plugins/ts-node-action.lua b/config/nvim/lua/aleidk/plugins/ts-node-action.lua new file mode 100644 index 0000000..dc55988 --- /dev/null +++ b/config/nvim/lua/aleidk/plugins/ts-node-action.lua @@ -0,0 +1,18 @@ +return { + "ckolkey/ts-node-action", + dependencies = { "nvim-treesitter", "jose-elias-alvarez/null-ls.nvim" }, + config = function() + require("ts-node-action").setup({}) + + vim.keymap.set({ "n" }, "lA", require("ts-node-action").node_action, { desc = "Trigger Node Action" }) + + require("null-ls").register({ + name = "more_actions", + method = { require("null-ls").methods.CODE_ACTION }, + filetypes = { "_all" }, + generator = { + fn = require("ts-node-action").available_actions, + }, + }) + end, +} diff --git a/config/sway/config b/config/sway/config index 7e98d73..71e8ee1 100644 --- a/config/sway/config +++ b/config/sway/config @@ -214,7 +214,7 @@ bar { # When the status_command prints a new line to stdout, swaybar updates. # The default just shows the current date and time. - status_command while date +'%Y-%m-%d %I:%M:%S %p'; do sleep 1; done + status_command while ~/.config/sway/sway-bar.sh; do sleep 1; done colors { statusline #ffffff diff --git a/config/sway/sway-bar.sh b/config/sway/sway-bar.sh new file mode 100755 index 0000000..ffc6ce1 --- /dev/null +++ b/config/sway/sway-bar.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +# Date +date=$(date "+%a %F %R") + +# Battery +battery=$(cat /sys/class/power_supply/BAT*/capacity) + +# Alsa master volume +volume=$(amixer get Master | grep "Right:" | cut -f 7,8 -d " ") + +# Status bar +echo "Vol: $volume | Bat: ${battery}% | $date" diff --git a/exports/dnf.txt b/exports/dnf.txt index c18cf76..03ba237 100644 --- a/exports/dnf.txt +++ b/exports/dnf.txt @@ -10,5 +10,8 @@ gnome-software neovim nodejs remove-retired-packages +ripgrep +tealdeer tmux +tree-sitter-cli zsh diff --git a/setup/rust b/setup/rust index c276df0..cc9c15b 100644 --- a/setup/rust +++ b/setup/rust @@ -3,7 +3,8 @@ echo -e "\n${BLD}${SUL}${GRN}Setting up ${RED}Rust${GRN}...${RST}\n" if ! command -v cargo >/dev/null; then - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh fi -cargo install tree-sitter-cli +# installed through package-manager +# cargo install tree-sitter-cli From 7b2cfd98dd069aebaa8006d7ab184233ee29b493 Mon Sep 17 00:00:00 2001 From: Alexander Navarro Date: Tue, 16 May 2023 14:23:53 -0400 Subject: [PATCH 13/17] add lazynvim config --- config/LazyVim/.gitignore | 8 + config/LazyVim/.neoconf.json | 15 ++ config/LazyVim/init.lua | 2 + config/LazyVim/lua/config/autocmds.lua | 3 + config/LazyVim/lua/config/keymaps.lua | 3 + config/LazyVim/lua/config/lazy.lua | 46 +++++ config/LazyVim/lua/config/options.lua | 3 + config/LazyVim/lua/plugins/example.lua | 266 +++++++++++++++++++++++++ config/zsh/aliases/nvim.zsh | 28 +-- 9 files changed, 361 insertions(+), 13 deletions(-) create mode 100644 config/LazyVim/.gitignore create mode 100644 config/LazyVim/.neoconf.json create mode 100644 config/LazyVim/init.lua create mode 100644 config/LazyVim/lua/config/autocmds.lua create mode 100644 config/LazyVim/lua/config/keymaps.lua create mode 100644 config/LazyVim/lua/config/lazy.lua create mode 100644 config/LazyVim/lua/config/options.lua create mode 100644 config/LazyVim/lua/plugins/example.lua diff --git a/config/LazyVim/.gitignore b/config/LazyVim/.gitignore new file mode 100644 index 0000000..cc5457a --- /dev/null +++ b/config/LazyVim/.gitignore @@ -0,0 +1,8 @@ +tt.* +.tests +doc/tags +debug +.repro +foo.* +*.log +data diff --git a/config/LazyVim/.neoconf.json b/config/LazyVim/.neoconf.json new file mode 100644 index 0000000..7c48087 --- /dev/null +++ b/config/LazyVim/.neoconf.json @@ -0,0 +1,15 @@ +{ + "neodev": { + "library": { + "enabled": true, + "plugins": true + } + }, + "neoconf": { + "plugins": { + "lua_ls": { + "enabled": true + } + } + } +} diff --git a/config/LazyVim/init.lua b/config/LazyVim/init.lua new file mode 100644 index 0000000..2514f9e --- /dev/null +++ b/config/LazyVim/init.lua @@ -0,0 +1,2 @@ +-- bootstrap lazy.nvim, LazyVim and your plugins +require("config.lazy") diff --git a/config/LazyVim/lua/config/autocmds.lua b/config/LazyVim/lua/config/autocmds.lua new file mode 100644 index 0000000..27e9e06 --- /dev/null +++ b/config/LazyVim/lua/config/autocmds.lua @@ -0,0 +1,3 @@ +-- Autocmds are automatically loaded on the VeryLazy event +-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua +-- Add any additional autocmds here diff --git a/config/LazyVim/lua/config/keymaps.lua b/config/LazyVim/lua/config/keymaps.lua new file mode 100644 index 0000000..2c134f7 --- /dev/null +++ b/config/LazyVim/lua/config/keymaps.lua @@ -0,0 +1,3 @@ +-- Keymaps are automatically loaded on the VeryLazy event +-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua +-- Add any additional keymaps here diff --git a/config/LazyVim/lua/config/lazy.lua b/config/LazyVim/lua/config/lazy.lua new file mode 100644 index 0000000..891b190 --- /dev/null +++ b/config/LazyVim/lua/config/lazy.lua @@ -0,0 +1,46 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + -- bootstrap lazy.nvim + -- stylua: ignore + vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath }) +end +vim.opt.rtp:prepend(vim.env.LAZY or lazypath) + +require("lazy").setup({ + spec = { + -- add LazyVim and import its plugins + { "LazyVim/LazyVim", import = "lazyvim.plugins" }, + -- import any extras modules here + -- { import = "lazyvim.plugins.extras.lang.typescript" }, + -- { import = "lazyvim.plugins.extras.lang.json" }, + -- { import = "lazyvim.plugins.extras.ui.mini-animate" }, + -- import/override with your plugins + { import = "plugins" }, + }, + defaults = { + -- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup. + -- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default. + lazy = false, + -- It's recommended to leave version=false for now, since a lot the plugin that support versioning, + -- have outdated releases, which may break your Neovim install. + version = false, -- always use the latest git commit + -- version = "*", -- try installing the latest stable version for plugins that support semver + }, + install = { colorscheme = { "tokyonight", "habamax" } }, + checker = { enabled = true }, -- automatically check for plugin updates + performance = { + rtp = { + -- disable some rtp plugins + disabled_plugins = { + "gzip", + -- "matchit", + -- "matchparen", + -- "netrwPlugin", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + }, +}) diff --git a/config/LazyVim/lua/config/options.lua b/config/LazyVim/lua/config/options.lua new file mode 100644 index 0000000..3ea1454 --- /dev/null +++ b/config/LazyVim/lua/config/options.lua @@ -0,0 +1,3 @@ +-- Options are automatically loaded before lazy.nvim startup +-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua +-- Add any additional options here diff --git a/config/LazyVim/lua/plugins/example.lua b/config/LazyVim/lua/plugins/example.lua new file mode 100644 index 0000000..ecc9567 --- /dev/null +++ b/config/LazyVim/lua/plugins/example.lua @@ -0,0 +1,266 @@ +-- since this is just an example spec, don't actually load anything here and return an empty spec +-- stylua: ignore +if true then return {} end + +-- every spec file under config.plugins will be loaded automatically by lazy.nvim +-- +-- In your plugin files, you can: +-- * add extra plugins +-- * disable/enabled LazyVim plugins +-- * override the configuration of LazyVim plugins +return { + -- add gruvbox + { "ellisonleao/gruvbox.nvim" }, + + -- Configure LazyVim to load gruvbox + { + "LazyVim/LazyVim", + opts = { + colorscheme = "gruvbox", + }, + }, + + -- change trouble config + { + "folke/trouble.nvim", + -- opts will be merged with the parent spec + opts = { use_diagnostic_signs = true }, + }, + + -- disable trouble + { "folke/trouble.nvim", enabled = false }, + + -- add symbols-outline + { + "simrat39/symbols-outline.nvim", + cmd = "SymbolsOutline", + keys = { { "cs", "SymbolsOutline", desc = "Symbols Outline" } }, + config = true, + }, + + -- override nvim-cmp and add cmp-emoji + { + "hrsh7th/nvim-cmp", + dependencies = { "hrsh7th/cmp-emoji" }, + ---@param opts cmp.ConfigSchema + opts = function(_, opts) + local cmp = require("cmp") + opts.sources = cmp.config.sources(vim.list_extend(opts.sources, { { name = "emoji" } })) + end, + }, + + -- change some telescope options and a keymap to browse plugin files + { + "nvim-telescope/telescope.nvim", + keys = { + -- add a keymap to browse plugin files + -- stylua: ignore + { + "fp", + function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end, + desc = "Find Plugin File", + }, + }, + -- change some options + opts = { + defaults = { + layout_strategy = "horizontal", + layout_config = { prompt_position = "top" }, + sorting_strategy = "ascending", + winblend = 0, + }, + }, + }, + + -- add telescope-fzf-native + { + "telescope.nvim", + dependencies = { + "nvim-telescope/telescope-fzf-native.nvim", + build = "make", + config = function() + require("telescope").load_extension("fzf") + end, + }, + }, + + -- add pyright to lspconfig + { + "neovim/nvim-lspconfig", + ---@class PluginLspOpts + opts = { + ---@type lspconfig.options + servers = { + -- pyright will be automatically installed with mason and loaded with lspconfig + pyright = {}, + }, + }, + }, + + -- add tsserver and setup with typescript.nvim instead of lspconfig + { + "neovim/nvim-lspconfig", + dependencies = { + "jose-elias-alvarez/typescript.nvim", + init = function() + require("lazyvim.util").on_attach(function(_, buffer) + -- stylua: ignore + vim.keymap.set( "n", "co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" }) + vim.keymap.set("n", "cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer }) + end) + end, + }, + ---@class PluginLspOpts + opts = { + ---@type lspconfig.options + servers = { + -- tsserver will be automatically installed with mason and loaded with lspconfig + tsserver = {}, + }, + -- you can do any additional lsp server setup here + -- return true if you don't want this server to be setup with lspconfig + ---@type table + setup = { + -- example to setup with typescript.nvim + tsserver = function(_, opts) + require("typescript").setup({ server = opts }) + return true + end, + -- Specify * to use this function as a fallback for any server + -- ["*"] = function(server, opts) end, + }, + }, + }, + + -- for typescript, LazyVim also includes extra specs to properly setup lspconfig, + -- treesitter, mason and typescript.nvim. So instead of the above, you can use: + { import = "lazyvim.plugins.extras.lang.typescript" }, + + -- add more treesitter parsers + { + "nvim-treesitter/nvim-treesitter", + opts = { + ensure_installed = { + "bash", + "html", + "javascript", + "json", + "lua", + "markdown", + "markdown_inline", + "python", + "query", + "regex", + "tsx", + "typescript", + "vim", + "yaml", + }, + }, + }, + + -- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above + -- would overwrite `ensure_installed` with the new value. + -- If you'd rather extend the default config, use the code below instead: + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + -- add tsx and treesitter + vim.list_extend(opts.ensure_installed, { + "tsx", + "typescript", + }) + end, + }, + + -- the opts function can also be used to change the default opts: + { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + opts = function(_, opts) + table.insert(opts.sections.lualine_x, "😄") + end, + }, + + -- or you can return new options to override all the defaults + { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + opts = function() + return { + --[[add your custom lualine config here]] + } + end, + }, + + -- use mini.starter instead of alpha + { import = "lazyvim.plugins.extras.ui.mini-starter" }, + + -- add jsonls and schemastore ans setup treesitter for json, json5 and jsonc + { import = "lazyvim.plugins.extras.lang.json" }, + + -- add any tools you want to have installed below + { + "williamboman/mason.nvim", + opts = { + ensure_installed = { + "stylua", + "shellcheck", + "shfmt", + "flake8", + }, + }, + }, + + -- Use for completion and snippets (supertab) + -- first: disable default and behavior in LuaSnip + { + "L3MON4D3/LuaSnip", + keys = function() + return {} + end, + }, + -- then: setup supertab in cmp + { + "hrsh7th/nvim-cmp", + dependencies = { + "hrsh7th/cmp-emoji", + }, + ---@param opts cmp.ConfigSchema + opts = function(_, opts) + local has_words_before = function() + unpack = unpack or table.unpack + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil + end + + local luasnip = require("luasnip") + local cmp = require("cmp") + + opts.mapping = vim.tbl_extend("force", opts.mapping, { + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() + -- they way you will only jump inside the snippet region + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + }) + end, + }, +} diff --git a/config/zsh/aliases/nvim.zsh b/config/zsh/aliases/nvim.zsh index fc68f59..b2ff3c2 100644 --- a/config/zsh/aliases/nvim.zsh +++ b/config/zsh/aliases/nvim.zsh @@ -1,22 +1,24 @@ alias \ - vi='nvim' \ - vi-astro='NVIM_APPNAME=AstroNvim nvim' + vi='nvim' \ + vi-astro='NVIM_APPNAME=AstroNvim nvim' \ + vi-lazy='NVIM_APPNAME=LazyVim nvim' vis() { - items=( - default - AstroNvim + items=( + default + AstroNvim + LazyVim ) - config=$(printf "%s\n" "${items[@]}" | fzf --prompt=" Neovim Config  " --height=~50% --layout=reverse --border --exit-0) + config=$(printf "%s\n" "${items[@]}" | fzf --prompt=" Neovim Config  " --height=~50% --layout=reverse --border --exit-0) - if [[ -z $config ]]; then - echo "Nothing selected" - return 0 - elif [[ $config == "default" ]]; then - config="" - fi + if [[ -z $config ]]; then + echo "Nothing selected" + return 0 + elif [[ $config == "default" ]]; then + config="" + fi - NVIM_APPNAME=$config nvim $@ + NVIM_APPNAME=$config nvim $@ } bindkey -s ^a "vis\n" From e647e33d8fb9b66bd027adf142df772940981b13 Mon Sep 17 00:00:00 2001 From: Alexander Navarro Date: Tue, 16 May 2023 14:24:17 -0400 Subject: [PATCH 14/17] add bufferline --- config/nvim/lua/aleidk/constants.lua | 62 +++++++++++++++++++ config/nvim/lua/aleidk/plugins/bufferline.lua | 57 +++++++++++++++++ config/nvim/lua/aleidk/plugins/heirline.lua | 15 ----- config/nvim/lua/aleidk/plugins/nvim-tree.lua | 3 +- 4 files changed, 120 insertions(+), 17 deletions(-) create mode 100644 config/nvim/lua/aleidk/constants.lua create mode 100644 config/nvim/lua/aleidk/plugins/bufferline.lua delete mode 100644 config/nvim/lua/aleidk/plugins/heirline.lua diff --git a/config/nvim/lua/aleidk/constants.lua b/config/nvim/lua/aleidk/constants.lua new file mode 100644 index 0000000..2575ba6 --- /dev/null +++ b/config/nvim/lua/aleidk/constants.lua @@ -0,0 +1,62 @@ +return { + icons = { + misc = { + pint = " ", + }, + dap = { + Stopped = { "󰁕 ", "DiagnosticWarn", "DapStoppedLine" }, + Breakpoint = " ", + BreakpointCondition = " ", + BreakpointRejected = { " ", "DiagnosticError" }, + LogPoint = ".>", + }, + diagnostics = { + Error = " ", + Warn = " ", + Hint = " ", + Info = " ", + }, + git = { + added = " ", + modified = " ", + removed = " ", + }, + kinds = { + Array = " ", + Boolean = " ", + Class = " ", + Color = " ", + Constant = " ", + Constructor = " ", + Copilot = " ", + Enum = " ", + EnumMember = " ", + Event = " ", + Field = " ", + File = " ", + Folder = " ", + Function = " ", + Interface = " ", + Key = " ", + Keyword = " ", + Method = " ", + Module = " ", + Namespace = " ", + Null = " ", + Number = " ", + Object = " ", + Operator = " ", + Package = " ", + Property = " ", + Reference = " ", + Snippet = " ", + String = " ", + Struct = " ", + Text = " ", + TypeParameter = " ", + Unit = " ", + Value = " ", + Variable = " ", + }, + }, +} diff --git a/config/nvim/lua/aleidk/plugins/bufferline.lua b/config/nvim/lua/aleidk/plugins/bufferline.lua new file mode 100644 index 0000000..bc3afde --- /dev/null +++ b/config/nvim/lua/aleidk/plugins/bufferline.lua @@ -0,0 +1,57 @@ +return { + "akinsho/bufferline.nvim", + event = "VeryLazy", + after = "onedark", + keys = { + { "bp", "BufferLineTogglePin", desc = "Toggle pin" }, + { "bP", "BufferLineGroupClose ungrouped", desc = "Delete non-pinned buffers" }, + { "", "BufferLineCyclePrev", desc = "Prev buffer" }, + { "", "BufferLineCycleNext", desc = "Next buffer" }, + }, + dependencies = { + { + "echasnovski/mini.bufremove", + -- stylua: ignore + keys = { + { "bd", function() require("mini.bufremove").delete(0, false) end, desc = "Delete Buffer" }, + { "bD", function() require("mini.bufremove").delete(0, true) end, desc = "Delete Buffer (Force)" }, + }, + }, + }, + config = function() + opts = { + highlights = { separator = { bg = "NONE" } }, + options = { + -- FIXME: Doesn't work with onedark pro colorscheme + -- separator_style = "padded_slant", + -- themable = true, + close_command = function(n) + require("mini.bufremove").delete(n, false) + end, + -- stylua: ignore + right_mouse_command = function(n) require("mini.bufremove").delete(n, false) end, + diagnostics = "nvim_lsp", + diagnostics_indicator = function(_, _, diag) + local icons = require("aleidk.constants").icons.diagnostics + local ret = (diag.error and icons.Error .. diag.error .. " " or "") + .. (diag.warning and icons.Warn .. diag.warning or "") + return vim.trim(ret) + end, + offsets = { + { + filetype = "NvimTree", + -- text = "nvim-tree", + highlight = "Directory", + text_align = "left", + }, + }, + groups = { + items = { + require("bufferline.groups").builtin.pinned:with({ icon = "" }), + }, + }, + }, + } + require("bufferline").setup(opts) + end, +} diff --git a/config/nvim/lua/aleidk/plugins/heirline.lua b/config/nvim/lua/aleidk/plugins/heirline.lua deleted file mode 100644 index e315e95..0000000 --- a/config/nvim/lua/aleidk/plugins/heirline.lua +++ /dev/null @@ -1,15 +0,0 @@ -return { - "rebelot/heirline.nvim", - -- You can optionally lazy-load heirline on UiEnter - -- to make sure all required plugins and colorschemes are loaded before setup - event = "UiEnter", - config = function() - require("heirline").setup({ - statusline = {}, - winbar = {}, - tabline = {}, - statuscolumn = {}, - opts = {}, - }) - end, -} diff --git a/config/nvim/lua/aleidk/plugins/nvim-tree.lua b/config/nvim/lua/aleidk/plugins/nvim-tree.lua index 91b003c..ecbd607 100644 --- a/config/nvim/lua/aleidk/plugins/nvim-tree.lua +++ b/config/nvim/lua/aleidk/plugins/nvim-tree.lua @@ -8,7 +8,6 @@ return { lazy = false, config = function() local tree = require("nvim-tree") - local tree_cb = require("nvim-tree.config").nvim_tree_callback local api = require("nvim-tree.api") tree.setup({ @@ -32,7 +31,7 @@ return { }, view = { centralize_selection = true, -- center current file on enter - width = 30, -- N° of columns or % + width = 30, -- N° of columns or % }, on_attach = function(bufnr) local function opts(desc) From e8381f415b26eb9f180330834e03e7ca8bb34709 Mon Sep 17 00:00:00 2001 From: Alexander Navarro Date: Tue, 16 May 2023 17:21:42 -0400 Subject: [PATCH 15/17] update which key --- config/nvim/lua/aleidk/plugins/which-key.lua | 26 ++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 config/nvim/lua/aleidk/plugins/which-key.lua diff --git a/config/nvim/lua/aleidk/plugins/which-key.lua b/config/nvim/lua/aleidk/plugins/which-key.lua new file mode 100644 index 0000000..664bf00 --- /dev/null +++ b/config/nvim/lua/aleidk/plugins/which-key.lua @@ -0,0 +1,26 @@ +return { + "folke/which-key.nvim", + event = "VeryLazy", + opts = { + plugins = { spelling = true }, + defaults = { + mode = { "n", "v" }, + ["g"] = { name = "+goto" }, + ["gz"] = { name = "+surround" }, + ["b"] = { name = "+buffer" }, + ["c"] = { name = "+comments" }, + ["f"] = { name = "+file/find" }, + ["g"] = { name = "+git" }, + ["q"] = { name = "+quit/session" }, + ["s"] = { name = "+search" }, + ["u"] = { name = "+ui" }, + ["w"] = { name = "+windows" }, + ["l"] = { name = "+diagnostics/quickfix" }, + }, + }, + config = function(_, opts) + local wk = require("which-key") + wk.setup(opts) + wk.register(opts.defaults) + end, +} From d03bdf4cc0ae48bece8cffdff627fcfdf7e6285c Mon Sep 17 00:00:00 2001 From: Alexander Navarro Date: Wed, 17 May 2023 12:47:08 -0400 Subject: [PATCH 16/17] add telescope config --- config/nvim/lua/aleidk/plugins/init.lua | 10 +-- config/nvim/lua/aleidk/plugins/telescope.lua | 81 ++++++++++---------- 2 files changed, 43 insertions(+), 48 deletions(-) diff --git a/config/nvim/lua/aleidk/plugins/init.lua b/config/nvim/lua/aleidk/plugins/init.lua index dfe6496..b5ec46e 100644 --- a/config/nvim/lua/aleidk/plugins/init.lua +++ b/config/nvim/lua/aleidk/plugins/init.lua @@ -18,10 +18,10 @@ return { -- Useful status updates for LSP -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` - { "j-hui/fidget.nvim", opts = {} }, + { "j-hui/fidget.nvim", opts = {} }, -- Additional lua configuration, makes nvim stuff amazing! - { "folke/neodev.nvim", opts = {} }, + { "folke/neodev.nvim", opts = {} }, }, }, @@ -40,12 +40,6 @@ return { }, }, - { - -- Useful plugin to show you pending keybinds. - "folke/which-key.nvim", - opts = {}, - }, - -- "gc" to comment visual regions/lines { "numToStr/Comment.nvim", opts = {} }, diff --git a/config/nvim/lua/aleidk/plugins/telescope.lua b/config/nvim/lua/aleidk/plugins/telescope.lua index 824e45b..34e3875 100644 --- a/config/nvim/lua/aleidk/plugins/telescope.lua +++ b/config/nvim/lua/aleidk/plugins/telescope.lua @@ -2,6 +2,7 @@ return { "nvim-telescope/telescope.nvim", version = "*", + event = "VeryLazy", dependencies = { { "nvim-lua/plenary.nvim" }, { @@ -13,53 +14,53 @@ return { end, }, }, - opts = { - defaults = { - mappings = { - i = { - [""] = false, - [""] = false, + config = function() + local actions = require("telescope.actions") + local telescope = require("telescope") + local builtin = require("telescope.builtin") + + local opts = { + defaults = { + prompt_prefix = " ", + selection_caret = " ", + mappings = { + i = { + [""] = false, + [""] = false, + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + [""] = actions.file_vsplit, + [""] = actions.file_split, + [""] = actions.close, + [""] = function(...) + return require("trouble.providers.telescope").open_with_trouble(...) + end, + [""] = function(...) + return require("trouble.providers.telescope").open_selected_with_trouble(...) + end, + }, }, }, - }, - }, - config = function(_, opts) - local telescope = require("telescope") + } telescope.setup(opts) -- Enable telescope fzf native, if installed pcall(telescope.load_extension, "fzf") - -- See `:help telescope.builtin` - vim.keymap.set( - "n", - "?", - require("telescope.builtin").oldfiles, - { desc = "[?] Find recently opened files" } - ) - vim.keymap.set( - "n", - "", - require("telescope.builtin").buffers, - { desc = "[ ] Find existing buffers" } - ) - vim.keymap.set("n", "/", function() - -- You can pass additional configuration to telescope to change theme, layout, etc. - require("telescope.builtin").current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({ - winblend = 10, - previewer = false, - })) - end, { desc = "[/] Fuzzily search in current buffer" }) + -- Find files + vim.keymap.set("n", "fb", builtin.buffers, { desc = "[F]ind existing [B]uffers" }) + vim.keymap.set("n", "ff", builtin.find_files, { desc = "[F]ind [F]iles" }) - vim.keymap.set("n", "sf", require("telescope.builtin").find_files, { desc = "[S]earch [F]iles" }) - vim.keymap.set("n", "sh", require("telescope.builtin").help_tags, { desc = "[S]earch [H]elp" }) - vim.keymap.set( - "n", - "sw", - require("telescope.builtin").grep_string, - { desc = "[S]earch current [W]ord" } - ) - vim.keymap.set("n", "sg", require("telescope.builtin").live_grep, { desc = "[S]earch by [G]rep" }) - vim.keymap.set("n", "sd", require("telescope.builtin").diagnostics, { desc = "[S]earch [D]iagnostics" }) + -- Search stuff + vim.keymap.set("n", "sh", builtin.help_tags, { desc = "[S]earch [H]elp" }) + vim.keymap.set("n", "sk", builtin.keymaps, { desc = "[S]earch [K]eymaps" }) + vim.keymap.set("n", "sw", builtin.grep_string, { desc = "[S]earch current [W]ord" }) + vim.keymap.set("n", "sg", builtin.live_grep, { desc = "[S]earch by [G]rep" }) + vim.keymap.set("n", "sD", function() + builtin.commands({ bufnr = 0 }) + end, { desc = "[S]earch Workspace [D]iagnostics" }) + vim.keymap.set("n", "sd", builtin.diagnostics, { desc = "[S]earch Document [D]iagnostics" }) + vim.keymap.set("n", "sc", builtin.command_history, { desc = "[S]earch [C]ommand History" }) + vim.keymap.set("n", "sC", builtin.commands, { desc = "[S]earch [C]ommands" }) end, } From 5d0272790f92869da6c5376e63b840bea68beef6 Mon Sep 17 00:00:00 2001 From: Alexander Navarro Date: Wed, 17 May 2023 21:03:56 -0400 Subject: [PATCH 17/17] update gitsigns --- config/nvim/lua/aleidk/plugins/gitsigns.lua | 31 ++++++++++++++++---- config/nvim/lua/aleidk/plugins/which-key.lua | 22 +++++++------- 2 files changed, 37 insertions(+), 16 deletions(-) diff --git a/config/nvim/lua/aleidk/plugins/gitsigns.lua b/config/nvim/lua/aleidk/plugins/gitsigns.lua index a28c96a..5b668ac 100644 --- a/config/nvim/lua/aleidk/plugins/gitsigns.lua +++ b/config/nvim/lua/aleidk/plugins/gitsigns.lua @@ -1,14 +1,35 @@ -- Adds git releated signs to the gutter, as well as utilities for managing changes return { "lewis6991/gitsigns.nvim", + event = { "BufReadPre", "BufNewFile" }, opts = { -- See `:help gitsigns.txt` signs = { - add = { text = "+" }, - change = { text = "~" }, - delete = { text = "_" }, - topdelete = { text = "‾" }, - changedelete = { text = "~" }, + add = { text = "▎" }, + change = { text = "▎" }, + delete = { text = "" }, + topdelete = { text = "" }, + changedelete = { text = "▎" }, + untracked = { text = "▎" }, }, + on_attach = function(buffer) + local gs = package.loaded.gitsigns + + local function map(mode, l, r, desc) + vim.keymap.set(mode, "g" .. l, r, { buffer = buffer, desc = desc }) + end + + -- stylua: ignore start + map("n", "j", gs.next_hunk, "Next Hunk") + map("n", "k", gs.prev_hunk, "Prev Hunk") + map({ "n", "v" }, "s", ":Gitsigns stage_hunk", "Stage Hunk") + map({ "n", "v" }, "r", ":Gitsigns reset_hunk", "Reset Hunk") + map("n", "u", gs.undo_stage_hunk, "Undo Stage Hunk") + map("n", "R", gs.reset_buffer, "Reset Buffer") + map("n", "p", gs.preview_hunk, "Preview Hunk") + map("n", "l", function() gs.blame_line({ full = true }) end, "Blame Line") + map("n", "d", gs.diffthis, "Diff This") + map("n", "D", function() gs.diffthis("~") end, "Diff This ~") + end, }, } diff --git a/config/nvim/lua/aleidk/plugins/which-key.lua b/config/nvim/lua/aleidk/plugins/which-key.lua index 664bf00..4707fad 100644 --- a/config/nvim/lua/aleidk/plugins/which-key.lua +++ b/config/nvim/lua/aleidk/plugins/which-key.lua @@ -5,17 +5,17 @@ return { plugins = { spelling = true }, defaults = { mode = { "n", "v" }, - ["g"] = { name = "+goto" }, - ["gz"] = { name = "+surround" }, - ["b"] = { name = "+buffer" }, - ["c"] = { name = "+comments" }, - ["f"] = { name = "+file/find" }, - ["g"] = { name = "+git" }, - ["q"] = { name = "+quit/session" }, - ["s"] = { name = "+search" }, - ["u"] = { name = "+ui" }, - ["w"] = { name = "+windows" }, - ["l"] = { name = "+diagnostics/quickfix" }, + ["g"] = { name = "+Goto" }, + ["gz"] = { name = "+Surround" }, + ["b"] = { name = "+Buffer" }, + ["c"] = { name = "+Comments" }, + ["f"] = { name = "+File/Find" }, + ["g"] = { name = "+Git" }, + ["q"] = { name = "+Quit/Session" }, + ["s"] = { name = "+Search" }, + ["u"] = { name = "+UI" }, + ["w"] = { name = "+Windows" }, + ["l"] = { name = "+Diagnostics/Quickfix" }, }, }, config = function(_, opts)