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, +}