diff --git a/stow/.config/nvim/init.lua b/stow/.config/nvim/init.lua new file mode 100644 index 0000000..3c223c2 --- /dev/null +++ b/stow/.config/nvim/init.lua @@ -0,0 +1 @@ +require("nico") diff --git a/stow/.config/nvim/lazy-lock.json b/stow/.config/nvim/lazy-lock.json new file mode 100644 index 0000000..298a6d9 --- /dev/null +++ b/stow/.config/nvim/lazy-lock.json @@ -0,0 +1,26 @@ +{ + "LuaSnip": { "branch": "master", "commit": "b84eeb3641b08324287587b426ec974b888390d9" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, + "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, + "fidget.nvim": { "branch": "main", "commit": "d855eed8a06531a7e8fd0684889b2943f373c469" }, + "fzf-lua": { "branch": "main", "commit": "780899604e0ce490d0d8e402a2fcdbad1cd7c9b8" }, + "gitsigns.nvim": { "branch": "main", "commit": "562dc47189ad3c8696dbf460d38603a74d544849" }, + "lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" }, + "lualine.nvim": { "branch": "master", "commit": "544dd1583f9bb27b393f598475c89809c4d5e86b" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "62360f061d45177dda8afc1b0fd1327328540301" }, + "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, + "mini.pick": { "branch": "main", "commit": "6d66ae9eb0b75261f1842788dda611285b6f065f" }, + "neogit": { "branch": "master", "commit": "2b74a777b963dfdeeabfabf84d5ba611666adab4" }, + "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, + "nvim-lspconfig": { "branch": "master", "commit": "652386deae739e38fa1bcf2f06e3e7de9b3436ba" }, + "nvim-treesitter": { "branch": "master", "commit": "3e0feeb062b29bb7d6d6df1e32ba28111c2bb734" }, + "nvim-web-devicons": { "branch": "master", "commit": "3722e3d1fb5fe1896a104eb489e8f8651260b520" }, + "oil.nvim": { "branch": "master", "commit": "fcca212c2e966fc3dec1d4baf888e670631d25d1" }, + "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, + "telescope.nvim": { "branch": "master", "commit": "3b1600d0fd5172ad9fae00987362ca0ef3d8895d" }, + "tokyonight.nvim": { "branch": "main", "commit": "b0e7c7382a7e8f6456f2a95655983993ffda745e" } +} diff --git a/stow/.config/nvim/lua/nico/bind.lua b/stow/.config/nvim/lua/nico/bind.lua new file mode 100644 index 0000000..660ea9b --- /dev/null +++ b/stow/.config/nvim/lua/nico/bind.lua @@ -0,0 +1,7 @@ +vim.g.mapleader = ' ' + +vim.keymap.set("v", "p", '"_dp') +vim.keymap.set("v", "P", '"_dP') + +vim.keymap.set("n", "w", "w") +vim.keymap.set("i", "", "") diff --git a/stow/.config/nvim/lua/nico/init.lua b/stow/.config/nvim/lua/nico/init.lua new file mode 100644 index 0000000..d849b36 --- /dev/null +++ b/stow/.config/nvim/lua/nico/init.lua @@ -0,0 +1,4 @@ +require("nico.opts") +require("nico.bind") +require("nico.txt.init") +require("nico.lazy_init") diff --git a/stow/.config/nvim/lua/nico/lazy/gitsigns.lua b/stow/.config/nvim/lua/nico/lazy/gitsigns.lua new file mode 100644 index 0000000..52d69cd --- /dev/null +++ b/stow/.config/nvim/lua/nico/lazy/gitsigns.lua @@ -0,0 +1,55 @@ +return { + "lewis6991/gitsigns.nvim", + config = function() + require('gitsigns').setup { + signs = { + add = { text = '┃' }, + change = { text = '┃' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + untracked = { text = '┆' }, + }, + signs_staged = { + add = { text = '┃' }, + change = { text = '┃' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + untracked = { text = '┆' }, + }, + signs_staged_enable = true, + signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` + numhl = false, -- Toggle with `:Gitsigns toggle_numhl` + linehl = false, -- Toggle with `:Gitsigns toggle_linehl` + word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` + watch_gitdir = { + follow_files = true + }, + auto_attach = true, + attach_to_untracked = false, + current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame` + current_line_blame_opts = { + virt_text = true, + virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align' + delay = 1000, + ignore_whitespace = false, + virt_text_priority = 100, + use_focus = true, + }, + current_line_blame_formatter = ', - ', + sign_priority = 6, + update_debounce = 100, + status_formatter = nil, -- Use default + max_file_length = 40000, -- Disable if file is longer than this (in lines) + preview_config = { + -- Options passed to nvim_open_win + border = 'single', + style = 'minimal', + relative = 'cursor', + row = 0, + col = 1 + }, + } + end +} diff --git a/stow/.config/nvim/lua/nico/lazy/lsp.lua b/stow/.config/nvim/lua/nico/lazy/lsp.lua new file mode 100644 index 0000000..8e3620c --- /dev/null +++ b/stow/.config/nvim/lua/nico/lazy/lsp.lua @@ -0,0 +1,95 @@ +return { + "neovim/nvim-lspconfig", + dependencies = { + "williamboman/mason.nvim", + "williamboman/mason-lspconfig.nvim", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + "hrsh7th/nvim-cmp", + "L3MON4D3/LuaSnip", + "saadparwaiz1/cmp_luasnip", + "j-hui/fidget.nvim", + }, + + config = function() + local cmp = require('cmp') + local cmp_lsp = require("cmp_nvim_lsp") + local capabilities = vim.tbl_deep_extend( + "force", + {}, + vim.lsp.protocol.make_client_capabilities(), + cmp_lsp.default_capabilities()) + + require("fidget").setup({}) + require("mason").setup() + require("mason-lspconfig").setup({ + ensure_installed = { + "gopls", + "pyright", + "bashls", + "cssls", + "html", + }, + handlers = { + function(server_name) -- default handler (optional) + + require("lspconfig")[server_name].setup { + capabilities = capabilities + } + end, + + ["lua_ls"] = function() + local lspconfig = require("lspconfig") + lspconfig.lua_ls.setup { + capabilities = capabilities, + settings = { + Lua = { + diagnostics = { + globals = { "vim", "it", "describe", "before_each", "after_each" }, + } + } + } + } + end, + } + }) + + local cmp_select = { behavior = cmp.SelectBehavior.Select } + + cmp.setup({ + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) -- For `luasnip` users. + end, + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.select_prev_item(cmp_select), + [''] = cmp.mapping.select_next_item(cmp_select), + [''] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping.complete(), + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'luasnip' }, -- For luasnip users. + }, { + { name = 'buffer' }, + }) + }) + + vim.diagnostic.config({ + -- update_in_insert = true, + float = { + focusable = false, + style = "minimal", + border = "rounded", + source = "always", + header = "", + prefix = "", + }, + }) + end +} diff --git a/stow/.config/nvim/lua/nico/lazy/lualine.lua b/stow/.config/nvim/lua/nico/lazy/lualine.lua new file mode 100644 index 0000000..69b5dcc --- /dev/null +++ b/stow/.config/nvim/lua/nico/lazy/lualine.lua @@ -0,0 +1,46 @@ +return { + 'nvim-lualine/lualine.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = function() + require('lualine').setup { + options = { + icons_enabled = true, + theme = 'auto', + component_separators = { left = '', right = ''}, + section_separators = { left = ' ', right = ' '}, + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + ignore_focus = {}, + always_divide_middle = true, + globalstatus = false, + refresh = { + statusline = 1000, + tabline = 1000, + winbar = 1000, + } + }, + sections = { + lualine_a = {'mode'}, + lualine_b = {}, + lualine_c = {'filename', 'filetype'}, + lualine_x = {'diff', 'diagnostics'}, + lualine_y = {'branch'}, + lualine_z = {'progress'} + }, + inactive_sections = { + lualine_a = {'mode'}, + lualine_b = {'branch'}, + lualine_c = {'filename'}, + lualine_x = {'fileformat', 'encoding', 'location'}, + lualine_y = {}, + lualine_z = {'progress'} + }, + tabline = {}, + winbar = {}, + inactive_winbar = {}, + extensions = {} + } + end +} diff --git a/stow/.config/nvim/lua/nico/lazy/neogit.lua b/stow/.config/nvim/lua/nico/lazy/neogit.lua new file mode 100644 index 0000000..49a5a7f --- /dev/null +++ b/stow/.config/nvim/lua/nico/lazy/neogit.lua @@ -0,0 +1,17 @@ +return { + "NeogitOrg/neogit", + dependencies = { + "nvim-lua/plenary.nvim", -- required + "sindrets/diffview.nvim", -- optional - Diff integration + + -- Only one of these is needed. + "nvim-telescope/telescope.nvim", -- optional + "ibhagwan/fzf-lua", -- optional + "echasnovski/mini.pick", -- optional + }, + + config = function(_, opts) + vim.keymap.set('n', 'g', 'Neogit') + require('neogit').setup(opts) -- this works idk how + end +} diff --git a/stow/.config/nvim/lua/nico/lazy/oil.lua b/stow/.config/nvim/lua/nico/lazy/oil.lua new file mode 100644 index 0000000..2fe42ed --- /dev/null +++ b/stow/.config/nvim/lua/nico/lazy/oil.lua @@ -0,0 +1,199 @@ +return { + 'stevearc/oil.nvim', + ---@module 'oil' + ---@type oil.SetupOpts + opts = {}, + -- Optional dependencies + -- dependencies = { { "echasnovski/mini.icons", opts = {} } }, + dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if prefer nvim-web-devicons + + + config = function() + require("oil").setup({ + -- Oil will take over directory buffers (e.g. `vim .` or `:e src/`) + -- Set to false if you want some other plugin (e.g. netrw) to open when you edit directories. + default_file_explorer = true, + -- Id is automatically added at the beginning, and name at the end + -- See :help oil-columns + columns = { + "icon", + -- "permissions", + -- "size", + -- "mtime", + }, + -- Buffer-local options to use for oil buffers + buf_options = { + buflisted = false, + bufhidden = "hide", + }, + -- Window-local options to use for oil buffers + win_options = { + wrap = false, + signcolumn = "no", + cursorcolumn = false, + foldcolumn = "0", + spell = false, + list = false, + conceallevel = 3, + concealcursor = "nvic", + }, + -- Send deleted files to the trash instead of permanently deleting them (:help oil-trash) + delete_to_trash = false, + -- Skip the confirmation popup for simple operations (:help oil.skip_confirm_for_simple_edits) + skip_confirm_for_simple_edits = false, + -- Selecting a new/moved/renamed file or directory will prompt you to save changes first + -- (:help prompt_save_on_select_new_entry) + prompt_save_on_select_new_entry = true, + -- Oil will automatically delete hidden buffers after this delay + -- You can set the delay to false to disable cleanup entirely + -- Note that the cleanup process only starts when none of the oil buffers are currently displayed + cleanup_delay_ms = 2000, + lsp_file_methods = { + -- Enable or disable LSP file operations + enabled = true, + -- Time to wait for LSP file operations to complete before skipping + timeout_ms = 1000, + -- Set to true to autosave buffers that are updated with LSP willRenameFiles + -- Set to "unmodified" to only save unmodified buffers + autosave_changes = false, + }, + -- Constrain the cursor to the editable parts of the oil buffer + -- Set to `false` to disable, or "name" to keep it on the file names + constrain_cursor = "editable", + -- Set to true to watch the filesystem for changes and reload oil + watch_for_changes = false, + -- Keymaps in oil buffer. Can be any value that `vim.keymap.set` accepts OR a table of keymap + -- options with a `callback` (e.g. { callback = function() ... end, desc = "", mode = "n" }) + -- Additionally, if it is a string that matches "actions.", + -- it will use the mapping at require("oil.actions"). + -- Set to `false` to remove a keymap + -- See :help oil-actions for a list of all available actions + keymaps = { + ["g?"] = "actions.show_help", + [""] = "actions.select", + [""] = { "actions.select", opts = { vertical = true }, desc = "Open the entry in a vertical split" }, + [""] = { "actions.select", opts = { horizontal = true }, desc = "Open the entry in a horizontal split" }, + [""] = { "actions.select", opts = { tab = true }, desc = "Open the entry in new tab" }, + [""] = "actions.preview", + [""] = "actions.close", + [""] = "actions.refresh", + ["-"] = "actions.parent", + ["_"] = "actions.open_cwd", + ["`"] = "actions.cd", + ["~"] = { "actions.cd", opts = { scope = "tab" }, desc = ":tcd to the current oil directory" }, + ["gs"] = "actions.change_sort", + ["gx"] = "actions.open_external", + ["g."] = "actions.toggle_hidden", + ["g\\"] = "actions.toggle_trash", + }, + -- Set to false to disable all of the above keymaps + use_default_keymaps = true, + view_options = { + -- Show files and directories that start with "." + show_hidden = true, + -- This function defines what is considered a "hidden" file + is_hidden_file = function(name, bufnr) + return vim.startswith(name, ".") + end, + -- This function defines what will never be shown, even when `show_hidden` is set + is_always_hidden = function(name, bufnr) + return false + end, + -- Sort file names in a more intuitive order for humans. Is less performant, + -- so you may want to set to false if you work with large directories. + natural_order = true, + -- Sort file and directory names case insensitive + case_insensitive = false, + sort = { + -- sort order can be "asc" or "desc" + -- see :help oil-columns to see which columns are sortable + { "type", "asc" }, + { "name", "asc" }, + }, + }, + -- Extra arguments to pass to SCP when moving/copying files over SSH + extra_scp_args = {}, + -- EXPERIMENTAL support for performing file operations with git + git = { + -- Return true to automatically git add/mv/rm files + add = function(path) + return false + end, + mv = function(src_path, dest_path) + return false + end, + rm = function(path) + return false + end, + }, + -- Configuration for the floating window in oil.open_float + float = { + -- Padding around the floating window + padding = 2, + max_width = 0, + max_height = 0, + border = "rounded", + win_options = { + winblend = 0, + }, + -- preview_split: Split direction: "auto", "left", "right", "above", "below". + preview_split = "auto", + -- This is the config that will be passed to nvim_open_win. + -- Change values here to customize the layout + override = function(conf) + return conf + end, + }, + -- Configuration for the actions floating preview window + preview = { + -- Width dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) + -- min_width and max_width can be a single value or a list of mixed integer/float types. + -- max_width = {100, 0.8} means "the lesser of 100 columns or 80% of total" + max_width = 0.9, + -- min_width = {40, 0.4} means "the greater of 40 columns or 40% of total" + min_width = { 40, 0.4 }, + -- optionally define an integer/float for the exact width of the preview window + width = nil, + -- Height dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) + -- min_height and max_height can be a single value or a list of mixed integer/float types. + -- max_height = {80, 0.9} means "the lesser of 80 columns or 90% of total" + max_height = 0.9, + -- min_height = {5, 0.1} means "the greater of 5 columns or 10% of total" + min_height = { 5, 0.1 }, + -- optionally define an integer/float for the exact height of the preview window + height = nil, + border = "rounded", + win_options = { + winblend = 0, + }, + -- Whether the preview window is automatically updated when the cursor is moved + update_on_cursor_moved = true, + }, + -- Configuration for the floating progress window + progress = { + max_width = 0.9, + min_width = { 40, 0.4 }, + width = nil, + max_height = { 10, 0.9 }, + min_height = { 5, 0.1 }, + height = nil, + border = "rounded", + minimized_border = "none", + win_options = { + winblend = 0, + }, + }, + -- Configuration for the floating SSH window + ssh = { + border = "rounded", + }, + -- Configuration for the floating keymaps help window + keymaps_help = { + border = "rounded", + }, + }) + + + vim.keymap.set("n", "d", "Oil") + end +} diff --git a/stow/.config/nvim/lua/nico/lazy/telescope.lua b/stow/.config/nvim/lua/nico/lazy/telescope.lua new file mode 100644 index 0000000..fcbe2e3 --- /dev/null +++ b/stow/.config/nvim/lua/nico/lazy/telescope.lua @@ -0,0 +1,23 @@ +return { + 'nvim-telescope/telescope.nvim', + tag = '0.1.8', + dependencies = { 'nvim-lua/plenary.nvim' }, + config = function() + require('telescope').setup({ + defaults = { + mappings = { + i = { + [''] = require("telescope.actions").move_selection_next, + [''] = require("telescope.actions").move_selection_previous, + }, + }, + }, + }) + + local builtin = require('telescope.builtin') + + vim.keymap.set('n', 'ff', builtin.find_files, {}) + vim.keymap.set('n', 'fg', builtin.git_files, {}) + vim.keymap.set('n', 'fs', builtin.grep_string, {}) + end +} diff --git a/stow/.config/nvim/lua/nico/lazy/theme.lua b/stow/.config/nvim/lua/nico/lazy/theme.lua new file mode 100644 index 0000000..0d288dc --- /dev/null +++ b/stow/.config/nvim/lua/nico/lazy/theme.lua @@ -0,0 +1,11 @@ +return { + { + "folke/tokyonight.nvim", + lazy = false, + priority = 1000, + opts = {}, + config = function() + vim.cmd.colorscheme("tokyonight-night") + end + }, +} diff --git a/stow/.config/nvim/lua/nico/lazy/treesitter.lua b/stow/.config/nvim/lua/nico/lazy/treesitter.lua new file mode 100644 index 0000000..e8ff4f6 --- /dev/null +++ b/stow/.config/nvim/lua/nico/lazy/treesitter.lua @@ -0,0 +1,14 @@ +return { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + config = function () + local configs = require("nvim-treesitter.configs") + + configs.setup({ + ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "elixir", "heex", "javascript", "html", "markdown" }, + sync_install = false, + highlight = { enable = true }, + indent = { enable = true }, + }) + end +} diff --git a/stow/.config/nvim/lua/nico/lazy_init.lua b/stow/.config/nvim/lua/nico/lazy_init.lua new file mode 100644 index 0000000..d2e2e40 --- /dev/null +++ b/stow/.config/nvim/lua/nico/lazy_init.lua @@ -0,0 +1,17 @@ +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) + +require("lazy").setup({ + spec = "nico.lazy", + change_detection = { notify = false } +}) diff --git a/stow/.config/nvim/lua/nico/opts.lua b/stow/.config/nvim/lua/nico/opts.lua new file mode 100644 index 0000000..fb41910 --- /dev/null +++ b/stow/.config/nvim/lua/nico/opts.lua @@ -0,0 +1,17 @@ +vim.opt.termguicolors = true + +vim.opt.number = true +vim.opt.relativenumber = true + +vim.opt.clipboard = "unnamedplus" +vim.opt.mouse = "a" +vim.opt.cursorline = true + +vim.opt.tabstop = 2 +vim.opt.softtabstop = 2 +vim.opt.shiftwidth = 2 +vim.opt.expandtab = true +vim.opt.scrolloff = 4 + +vim.opt.hlsearch = false +vim.opt.incsearch = true diff --git a/stow/.config/nvim/lua/nico/txt/enter.lua b/stow/.config/nvim/lua/nico/txt/enter.lua new file mode 100644 index 0000000..f181d9c --- /dev/null +++ b/stow/.config/nvim/lua/nico/txt/enter.lua @@ -0,0 +1,21 @@ +-- opts +vim.opt.wrap = true +vim.opt.linebreak = true +vim.opt.textwidth = 80 +vim.opt.formatoptions:append("t") + +-- ai slop that gets the job done +-- redo formatting when leaving the insert mode +vim.api.nvim_create_augroup("FormatText", { clear = true }) + +vim.api.nvim_create_autocmd("FileType", { + pattern = { "markdown", "txt" }, + callback = function() + vim.api.nvim_create_autocmd("InsertLeave", { + buffer = 0, + callback = function() + vim.cmd("normal! gggqG") + end, + }) + end, +}) diff --git a/stow/.config/nvim/lua/nico/txt/init.lua b/stow/.config/nvim/lua/nico/txt/init.lua new file mode 100644 index 0000000..f83ccec --- /dev/null +++ b/stow/.config/nvim/lua/nico/txt/init.lua @@ -0,0 +1,16 @@ +-- another slopination by ai +vim.api.nvim_create_augroup("LoadLuaOnMarkdownOrTxt", { clear = true }) +vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, { + pattern = {"*.md", "*.txt"}, + callback = function() + require("nico.txt.enter") + end +}) + +vim.api.nvim_create_autocmd("BufLeave", { + pattern = {"*.md", "*.txt"}, + callback = function() + require("nico.txt.leave") + require("nico.opts") + end +}) diff --git a/stow/.config/nvim/lua/nico/txt/leave.lua b/stow/.config/nvim/lua/nico/txt/leave.lua new file mode 100644 index 0000000..e2bc41d --- /dev/null +++ b/stow/.config/nvim/lua/nico/txt/leave.lua @@ -0,0 +1,10 @@ +-- opts +-- neovim defaults +vim.opt.wrap = true +vim.opt.linebreak = false +vim.opt.textwidth = 0 +vim.opt.formatoptions = "tcqj" + +-- ai slop that gets the job done +-- disables redo formatting when leaving the insert mode +vim.api.nvim_create_augroup("FormatText", { clear = true })