aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/nvim
diff options
context:
space:
mode:
Diffstat (limited to 'nvim')
-rw-r--r--nvim/.config/nvim/init.lua10
-rw-r--r--nvim/.config/nvim/lua/autocommands.lua61
-rw-r--r--nvim/.config/nvim/lua/mappings.lua170
-rw-r--r--nvim/.config/nvim/lua/options.lua74
-rw-r--r--nvim/.config/nvim/lua/plugins.lua288
-rw-r--r--nvim/.config/nvim/lua/plugins/dap.lua89
-rw-r--r--nvim/.config/nvim/lua/plugins/gitsigns.lua48
-rw-r--r--nvim/.config/nvim/lua/plugins/lsp-signature.lua56
-rw-r--r--nvim/.config/nvim/lua/plugins/lspconfig.lua105
-rw-r--r--nvim/.config/nvim/lua/plugins/luasnip.lua18
-rw-r--r--nvim/.config/nvim/lua/plugins/neogit.lua6
-rw-r--r--nvim/.config/nvim/lua/plugins/null-ls.lua31
-rw-r--r--nvim/.config/nvim/lua/plugins/telescope.lua82
-rw-r--r--nvim/.config/nvim/lua/plugins/treesitter.lua14
-rw-r--r--nvim/.config/nvim/lua/plugins/which-key.lua34
-rw-r--r--nvim/.config/nvim/lua/tobyvin/autocommands.lua88
-rw-r--r--nvim/.config/nvim/lua/tobyvin/init.lua20
-rw-r--r--nvim/.config/nvim/lua/tobyvin/lsp/formatting.lua53
-rw-r--r--nvim/.config/nvim/lua/tobyvin/lsp/handlers.lua93
-rw-r--r--nvim/.config/nvim/lua/tobyvin/lsp/highlighting.lua25
-rw-r--r--nvim/.config/nvim/lua/tobyvin/lsp/init.lua48
-rw-r--r--nvim/.config/nvim/lua/tobyvin/lsp/utils.lua45
-rw-r--r--nvim/.config/nvim/lua/tobyvin/mappings.lua72
-rw-r--r--nvim/.config/nvim/lua/tobyvin/options.lua70
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins.lua331
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/blankline.lua (renamed from nvim/.config/nvim/lua/plugins/blankline.lua)0
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/bufdelete.lua44
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/bufferline.lua (renamed from nvim/.config/nvim/lua/plugins/bufferline.lua)0
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/cmp.lua (renamed from nvim/.config/nvim/lua/plugins/cmp.lua)4
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/colorbuddy.lua56
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/dap.lua113
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/git-blame.lua (renamed from nvim/.config/nvim/lua/plugins/git-blame.lua)0
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/git-worktree.lua (renamed from nvim/.config/nvim/lua/plugins/git-worktree.lua)0
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/gitsigns.lua34
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/gruvbox-baby.lua10
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/gruvbox-flat.lua12
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/lsp-signature.lua17
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/lspconfig.lua62
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/lspkind.lua (renamed from nvim/.config/nvim/lua/plugins/lspkind.lua)0
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/lspstatus.lua (renamed from nvim/.config/nvim/lua/plugins/lspstatus.lua)0
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/lua-dev.lua30
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/lualine.lua (renamed from nvim/.config/nvim/lua/plugins/lualine.lua)7
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/luasnip.lua24
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/neo-tree.lua (renamed from nvim/.config/nvim/lua/plugins/neo-tree.lua)0
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/neoclip.lua17
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/neogen.lua17
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/neogit.lua18
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/notify.lua17
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/null-ls.lua37
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/nvim-tree.lua (renamed from nvim/.config/nvim/lua/plugins/nvim-tree.lua)0
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/refactoring.lua39
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/renamer.lua (renamed from nvim/.config/nvim/lua/plugins/renamer.lua)0
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/rust-tools.lua60
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/session-lens.lua (renamed from nvim/.config/nvim/lua/plugins/session-lens.lua)0
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/telescope.lua113
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/treesitter.lua40
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/which-key.lua26
-rw-r--r--nvim/.config/nvim/lua/tobyvin/utils.lua70
-rw-r--r--nvim/.config/nvim/lua/utils.lua11
59 files changed, 1708 insertions, 1101 deletions
diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua
index ae1baaf..99bea89 100644
--- a/nvim/.config/nvim/init.lua
+++ b/nvim/.config/nvim/init.lua
@@ -1,7 +1,3 @@
--- https://github.com/mikebarkmin/.dotfiles/tree/main/nvim/.config/nvim
--- https://github.com/ThePrimeagen/.dotfiles/tree/master/nvim
--- https://github.com/ChristianChiarulli/nvim
-require("plugins")
-require("options")
-require("autocommands")
-require("mappings")
+
+require("tobyvin").setup()
+
diff --git a/nvim/.config/nvim/lua/autocommands.lua b/nvim/.config/nvim/lua/autocommands.lua
deleted file mode 100644
index 2be9023..0000000
--- a/nvim/.config/nvim/lua/autocommands.lua
+++ /dev/null
@@ -1,61 +0,0 @@
--- to Show whitespace, MUST be inserted BEFORE the colorscheme command
-vim.cmd([[
- augroup general_settings
- autocmd!
- autocmd FileType qf,help,man,lspinfo,spectre_panel nnoremap <silent> <buffer> q :close<CR>
- autocmd TextYankPost * silent!lua require('vim.highlight').on_yank({higroup = 'Visual', timeout = 200})
- autocmd BufWritePre * :%s/\s\+$//e
- autocmd BufWinEnter * :set formatoptions-=cro
- autocmd BufEnter * set fo-=c fo-=r fo-=o
- autocmd FileType qf set nobuflisted
- autocmd CmdWinEnter * quit
- autocmd FileType xml,html,xhtml,css,scss,javascript,lua,dart setlocal shiftwidth=2 tabstop=2
- autocmd BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
- augroup end
-
- augroup format_on_save
- autocmd!
- autocmd BufWritePre * lua vim.lsp.buf.formatting()
- augroup end
-
- augroup auto_search_highlighting
- autocmd!
- autocmd CmdlineEnter /,\? set hlsearch
- autocmd CmdlineLeave /,\? set nohlsearch
- augroup END
-
- augroup _git
- autocmd!
- autocmd FileType gitcommit setlocal wrap
- autocmd FileType gitcommit setlocal spell
- augroup end
-
- augroup _markdown
- autocmd!
- autocmd FileType markdown setlocal wrap
- autocmd FileType markdown setlocal spell
- autocmd BufNewFile,BufRead *.mdx set filetype=markdown
- augroup end
-
- augroup _latex
- autocmd!
- autocmd FileType latex,tex,plaintex setlocal wrap
- autocmd FileType latex,tex,plaintex setlocal spell
- autocmd FileType latex,tex,plaintex setlocal linebreak
- augroup end
-
- augroup _json
- autocmd!
- autocmd BufEnter *.json set ai expandtab shiftwidth=2 tabstop=2 sta fo=croql
- augroup end
-
- augroup _auto_resize
- autocmd!
- autocmd VimResized * tabdo wincmd =
- augroup end
-
- augroup _alpha
- autocmd!
- autocmd User AlphaReady set showtabline=0 | autocmd BufUnload <buffer> set showtabline=2
- augroup end
-]])
diff --git a/nvim/.config/nvim/lua/mappings.lua b/nvim/.config/nvim/lua/mappings.lua
deleted file mode 100644
index b2d398a..0000000
--- a/nvim/.config/nvim/lua/mappings.lua
+++ /dev/null
@@ -1,170 +0,0 @@
-local mappings = {
- {
- -- NORMAL mode
- opts = {},
- mappings = {
- ["<C-s>"] = { "<cmd>w!<CR>", "Save" },
- ["<C-/>"] = { "<cmd>lua require('Comment.api').toggle_current_linewise()<CR>", "Comment" },
- ["<leader>"] = {
- c = { "<cmd>Bdelete!<CR>", "Close Buffer" },
- q = { "<cmd>q!<CR>", "Quit" },
- R = { "<cmd>lua require('renamer').rename()<cr>", "Rename" },
- w = { "<cmd>w!<CR>", "Save" },
- W = { ":set wrap! linebreak!<CR>", "Toggle Line Wrap" },
- z = { "<cmd>ZenMode<cr>", "Zen" },
- ["/"] = { "<cmd>lua require('Comment.api').toggle_current_linewise()<CR>", "Comment" },
-
- f = {
- name = "Find",
- b = { "<cmd>Telescope buffers show_all_buffers=true<cr>", "Buffers" },
- c = { "<cmd>Telescope colorscheme<cr>", "Colorscheme" },
- C = { "<cmd>Telescope commands<cr>", "Commands" },
- e = { "<cmd>Telescope frecency theme=get_dropdown<cr>", "Frecency" },
- f = { "<cmd>Telescope find_files theme=get_dropdown<cr>", "Find files" },
- g = { "<cmd>Telescope live_grep theme=ivy<cr>", "Find Text" },
- h = { "<cmd>Telescope help_tags<cr>", "Help" },
- i = { "<cmd>lua require('telescope').extensions.media_files.media_files()<cr>", "Media" },
- k = { "<cmd>Telescope keymaps<cr>", "Keymaps" },
- l = { "<cmd>Telescope resume<cr>", "Last Search" },
- m = { "<cmd>Telescope man_pages<cr>", "Man Pages" },
- r = { "<cmd>Telescope oldfiles<cr>", "Recent File" },
- R = { "<cmd>Telescope registers<cr>", "Registers" },
- s = { "<cmd>Telescope session-lens search_session<cr>", "Sessions" },
- },
-
- g = {
- name = "Git",
- b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
- c = { "<cmd>Telescope git_commits<cr>", "Checkout commit" },
- d = { "<cmd>Gitsigns diffthis HEAD<cr>", "Diff" },
- g = { "<cmd>LazyGit<CR>", "Lazygit" },
- j = { "<cmd>lua require 'gitsigns'.next_hunk()<cr>", "Next Hunk" },
- k = { "<cmd>lua require 'gitsigns'.prev_hunk()<cr>", "Prev Hunk" },
- l = { "<cmd>GitBlameToggle<cr>", "Blame" },
- o = { "<cmd>Telescope git_status<cr>", "Open changed file" },
- p = { "<cmd>lua require 'gitsigns'.preview_hunk()<cr>", "Preview Hunk" },
- r = { "<cmd>lua require 'gitsigns'.reset_hunk()<cr>", "Reset Hunk" },
- R = { "<cmd>lua require 'gitsigns'.reset_buffer()<cr>", "Reset Buffer" },
- s = { "<cmd>lua require 'gitsigns'.stage_hunk()<cr>", "Stage Hunk" },
- u = { "<cmd>lua require 'gitsigns'.undo_stage_hunk()<cr>", "Undo Stage Hunk" },
- w = {
- name = "Worktree",
- s = {
- [[<Cmd>lua require('telescope').extensions.git_worktree.git_worktrees()<CR>]],
- "Switch",
- },
- c = {
- [[<Cmd>lua require('telescope').extensions.git_worktree.create_git_worktree()<CR>]],
- "Create",
- },
- },
- },
-
- l = {
- name = "LSP",
- a = { "<cmd>lua vim.lsp.buf.code_action()<cr>", "Code Action" },
- d = { "<cmd>TroubleToggle document_diagnostics<cr>", "Document Diagnostics" },
- D = { "<cmd>TroubleToggle workspace_diagnostics<cr>", "Workspace Diagnostics" },
- f = { "<cmd>lua vim.lsp.buf.formatting()<cr>", "Format" },
- -- F = { "<cmd>LspToggleAutoFormat<cr>", "Toggle Autoformat" },
- g = {
- name = "Goto",
- d = { "<cmd>lua vim.lsp.buf.definition()<CR>", "Definition" },
- D = { "<cmd>lua vim.lsp.buf.declaration()<CR>", "Declaration" },
- i = { "<cmd>lua vim.lsp.buf.implementation()<CR>", "Implementation" },
- r = { "<cmd>lua vim.lsp.buf.references()<CR>", "References" },
- },
- h = { "<Cmd>lua vim.lsp.buf.hover()<CR>", "Hover" },
- H = { "<Cmd>lua vim.lsp.buf.signature_help()<CR>", "Signature Help" },
- i = { "<cmd>LspInfo<cr>", "Info" },
- I = { "<cmd>LspInstallInfo<cr>", "Installer Info" },
- j = { "<cmd>lua vim.diagnostic.goto_next({buffer=0})<CR>", "Next Diagnostic" },
- k = { "<cmd>lua vim.diagnostic.goto_prev({buffer=0})<cr>", "Prev Diagnostic" },
- l = { "<cmd>lua vim.lsp.codelens.run()<cr>", "CodeLens Action" },
- o = { "<cmd>SymbolsOutline<cr>", "Outline" },
- q = { "<cmd>lua vim.lsp.diagnostic.set_loclist()<cr>", "Quickfix" },
- r = { "<cmd>lua vim.lsp.buf.rename()<cr>", "Rename" },
- R = { "<cmd>TroubleToggle lsp_references<cr>", "References" },
- s = { "<cmd>Telescope lsp_document_symbols<cr>", "Document Symbols" },
- S = { "<cmd>Telescope lsp_dynamic_workspace_symbols<cr>", "Workspace Symbols" },
- w = { "<cmd>Telescope lsp_workspace_diagnostics<cr>", "Workspace Diagnostics" },
- },
- m = {
- name = "Markers",
- a = { "<cmd>BookmarkAnnotate<cr>", "Annotate" },
- c = { "<cmd>BookmarkClear<cr>", "Clear" },
- h = { '<cmd>lua require("harpoon.mark").add_file()<cr>', "Harpoon" },
- j = { "<cmd>BookmarkNext<cr>", "Next" },
- k = { "<cmd>BookmarkPrev<cr>", "Prev" },
- m = { "<cmd>BookmarkToggle<cr>", "Toggle" },
- s = {
- "<cmd>lua require('telescope').extensions.vim_bookmarks.all({ hide_filename=false, prompt_title=\"bookmarks\", shorten_path=false })<cr>",
- "Show",
- },
- u = { '<cmd>lua require("harpoon.ui").toggle_quick_menu()<cr>', "Harpoon UI" },
- x = { "<cmd>BookmarkClearAll<cr>", "Clear All" },
- },
- p = {
- name = "Packer",
- c = { "<cmd>PackerCompile<cr>", "Compile" },
- C = { "<cmd>PackerClean<cr>", "Clean" },
- i = { "<cmd>PackerInstall<cr>", "Install" },
- s = { "<cmd>PackerSync<cr>", "Sync" },
- S = { "<cmd>PackerStatus<cr>", "Status" },
- u = { "<cmd>PackerUpdate<cr>", "Update" },
- },
- r = {
- name = "Replace",
- f = { "<cmd>lua require('spectre').open_file_search()<cr>", "Replace Buffer" },
- r = { "<cmd>lua require('spectre').open()<cr>", "Replace" },
- w = { "<cmd>lua require('spectre').open_visual({select_word=true})<cr>", "Replace Word" },
- },
- },
- },
- },
- {
- -- VISUAL mode
- opts = {
- mode = "v",
- },
- mappings = {
- -- Ctrl maps
- ["<C-/>"] = {
- "<ESC><CMD>lua require('Comment.api').toggle_linewise_op(vim.fn.visualmode())<CR>",
- "Comment",
- },
-
- -- Prefix "<leader>"
- ["<leader>"] = {
- ["/"] = {
- "<ESC><CMD>lua require('Comment.api').toggle_linewise_op(vim.fn.visualmode())<CR>",
- "Comment",
- },
- },
- },
- },
- {
- -- INSERT mode
- opts = {
- mode = "i",
- },
- mappings = {
- ["<C-h>"] = { "<left>", "Left" },
- ["<C-j>"] = { "<up>", "Up" },
- ["<C-k>"] = { "<down>", "Down" },
- ["<C-l>"] = { "<right>", "Right" },
- },
- },
-}
-
-local ok, legendary = pcall(require, "legendary")
-if ok then
- legendary.setup()
-end
-
-local ok, which_key = pcall(require, "which-key")
-if ok then
- for i, m in ipairs(mappings) do
- which_key.register(m.mappings, m.opts)
- end
-end
diff --git a/nvim/.config/nvim/lua/options.lua b/nvim/.config/nvim/lua/options.lua
deleted file mode 100644
index 4852f08..0000000
--- a/nvim/.config/nvim/lua/options.lua
+++ /dev/null
@@ -1,74 +0,0 @@
-local g = vim.g -- global variables
-local opt = vim.opt -- vim options
-local exec = vim.api.nvim_exec -- execute Vimscript
-
-g.mapleader = " "
-
-vim.g.gruvbox_colors = { bg_statusline = "#3c3836" }
-vim.g.gruvbox_flat_style = "hard"
-vim.g.gruvbox_transparent = true
-vim.cmd([[colorscheme gruvbox-flat]])
-
-g.tex_flavor = "latex"
-
--- global options
-local options = {
- background = "dark",
- termguicolors = true, -- Enable GUI colors for the terminal to get truecolor
- list = false, -- show whitespace
- listchars = {
- nbsp = "⦸", -- CIRCLED REVERSE SOLIDUS (U+29B8, UTF-8: E2 A6 B8)
- extends = "»", -- RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK (U+00BB, UTF-8: C2 BB)
- precedes = "«", -- LEFT-POINTING DOUBLE ANGLE QUOTATION MARK (U+00AB, UTF-8: C2 AB)
- tab = "▷─", -- WHITE RIGHT-POINTING TRIANGLE (U+25B7, UTF-8: E2 96 B7) + BOX DRAWINGS HEAVY TRIPLE DASH HORIZONTAL (U+2505, UTF-8: E2 94 85)
- trail = "•", -- BULLET (U+2022, UTF-8: E2 80 A2)
- space = " ",
- },
- fillchars = {
- diff = "∙", -- BULLET OPERATOR (U+2219, UTF-8: E2 88 99)
- eob = " ", -- NO-BREAK SPACE (U+00A0, UTF-8: C2 A0) to suppress ~ at EndOfBuffer
- fold = "·", -- MIDDLE DOT (U+00B7, UTF-8: C2 B7)
- vert = " ", -- remove ugly vertical lines on window division
- },
- undofile = true,
- undodir = vim.fn.stdpath("config") .. "/undo",
- clipboard = opt.clipboard + "unnamedplus", -- copy & paste
- shortmess = opt.shortmess + "c",
- wrap = false, -- don't automatically wrap on load
- showmatch = true, -- show the matching part of the pair for [] {} and ()
- cursorline = true, -- highlight current line
- number = true, -- show line numbers
- relativenumber = true, -- show relative line number
- incsearch = true, -- incremental search
- hlsearch = true, -- highlighted search results
- ignorecase = true, -- ignore case sensetive while searching
- smartcase = true,
- scrolloff = 1, -- when scrolling, keep cursor 1 lines away from screen border
- sidescrolloff = 2, -- keep 30 columns visible left and right of the cursor at all times
- backspace = "indent,start,eol", -- make backspace behave like normal again
- mouse = "a", -- turn on mouse interaction
- updatetime = 500, -- CursorHold interval
- expandtab = true,
- softtabstop = 4,
- textwidth = 100,
- shiftwidth = 4, -- spaces per tab (when shifting), when using the >> or << commands, shift lines by 4 spaces
- tabstop = 4, -- spaces per tab
- smarttab = true, -- <tab>/<BS> indent/dedent in leading whitespace
- autoindent = true, -- maintain indent of current line
- shiftround = true,
- splitbelow = true, -- open horizontal splits below current window
- splitright = true, -- open vertical splits to the right of the current window
- laststatus = 2, -- always show status line
- colorcolumn = "100", -- vertical word limit line
- hidden = true, -- allows you to hide buffers with unsaved changes without being prompted
- inccommand = "split", -- live preview of :s results
- shell = "zsh", -- shell to use for `!`, `:!`, `system()` etc.
- wildignore = opt.wildignore + "*.o,*.rej,*.so",
- lazyredraw = true,
- completeopt = "menuone,noselect,noinsert",
- sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal",
-}
-
-for k, v in pairs(options) do
- vim.opt[k] = v
-end
diff --git a/nvim/.config/nvim/lua/plugins.lua b/nvim/.config/nvim/lua/plugins.lua
deleted file mode 100644
index 94e0215..0000000
--- a/nvim/.config/nvim/lua/plugins.lua
+++ /dev/null
@@ -1,288 +0,0 @@
-local fn = vim.fn
-
--- Automatically install packer
-local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
-if fn.empty(fn.glob(install_path)) > 0 then
- packer_bootstrap = fn.system({
- "git",
- "clone",
- "--depth",
- "1",
- "https://github.com/wbthomason/packer.nvim",
- install_path,
- })
- print("Installing packer close and reopen Neovim...")
- vim.cmd([[packadd packer.nvim]])
-end
-
--- Autocommand that reloads neovim whenever you save the plugins.lua file
-vim.cmd([[
- augroup packer_user_config
- autocmd!
- autocmd BufWritePost plugins.lua source <afile> | PackerSync
- augroup end
-]])
-
--- Use a protected call so we don't error out on first use
-local status_ok, packer = pcall(require, "packer")
-if not status_ok then
- return
-end
-
--- Have packer use a popup window
-packer.init({
- display = {
- open_fn = function()
- return require("packer.util").float({ border = "rounded" })
- end,
- },
-})
-
--- Install your plugins here
-return packer.startup(function(use)
- -- My plugins here
-
- -- Have packer manage itself
-
- use("wbthomason/packer.nvim")
-
- use({
- "dstein64/vim-startuptime",
- cmd = "StartupTime",
- config = [[vim.g.startuptime_tries = 3]],
- })
-
- use("lewis6991/impatient.nvim")
- use("andweeb/presence.nvim")
- use("eddyekofo94/gruvbox-flat.nvim")
-
- use({
- "rmagatti/auto-session",
- config = [[require('auto-session').setup()]],
- })
-
- use({
- "rmagatti/session-lens",
- requires = { "rmagatti/auto-session", "nvim-telescope/telescope.nvim" },
- config = [[require("plugins/session-lens").setup()]],
- })
-
- use({
- "tpope/vim-dispatch",
- cmd = {
- "Dispatch",
- "Make",
- "Focus",
- "Start",
- },
- })
-
- use({
- "neovim/nvim-lspconfig",
- config = [[require('plugins/lspconfig')]],
- })
- use("williamboman/nvim-lsp-installer")
-
- use("nvim-lua/lsp_extensions.nvim")
- use({ "simrat39/rust-tools.nvim", branch = "modularize_and_inlay_rewrite" })
- use("simrat39/symbols-outline.nvim")
-
- use({
- "folke/trouble.nvim",
- cmd = "TroubleToggle",
- })
-
- use({
- "hrsh7th/nvim-cmp",
- requires = {
- { "onsails/lspkind-nvim", config = [[require('plugins/lspkind')]] }, -- vscode-like pictograms for cmp
- "ray-x/lsp_signature.nvim",
- "hrsh7th/cmp-nvim-lsp", -- nvim-cmp source for neovim builtin LSP client
- "hrsh7th/cmp-nvim-lua", -- nvim-cmp source for nvim lua
- "hrsh7th/cmp-buffer", -- nvim-cmp source for buffer words.
- "hrsh7th/cmp-path", -- nvim-cmp source for filesystem paths.
- "hrsh7th/cmp-calc", -- nvim-cmp source for math calculation.
- "saadparwaiz1/cmp_luasnip", -- luasnip completion source for nvim-cmp
- "hrsh7th/cmp-nvim-lsp-signature-help", -- luasnip completion source for lsp_signature
- },
- config = [[require('plugins/cmp')]],
- })
-
- use({
- "nvim-telescope/telescope.nvim",
- requires = {
- "nvim-lua/plenary.nvim",
- "BurntSushi/ripgrep",
- "nvim-telescope/telescope-dap.nvim",
- { "nvim-telescope/telescope-fzf-native.nvim", run = "make" },
- { "nvim-telescope/telescope-frecency.nvim", requires = "tami5/sqlite.lua" },
- },
- config = [[require('plugins/telescope').setup()]],
- })
-
- use({
- "jose-elias-alvarez/null-ls.nvim",
- requires = "nvim-lua/plenary.nvim",
- config = [[require('plugins/null-ls')]],
- })
-
- use({
- "L3MON4D3/LuaSnip",
- requires = "rafamadriz/friendly-snippets",
- config = [[require('plugins/luasnip')]],
- })
-
- use({
- "nvim-treesitter/nvim-treesitter",
- run = ":TSUpdate",
- requires = {
- "nvim-treesitter/nvim-treesitter-refactor",
- "RRethy/nvim-treesitter-textsubjects",
- },
- config = [[require('plugins/treesitter')]],
- })
-
- use({
- "lukas-reineke/indent-blankline.nvim",
- config = [[require('plugins/blankline')]],
- })
-
- use({ "lukas-reineke/virt-column.nvim", config = [[require("virt-column").setup()]] })
- use("tpope/vim-eunuch")
-
- use({
- "nvim-lualine/lualine.nvim",
- requires = {
- { "kyazdani42/nvim-web-devicons" },
- },
- config = [[require('plugins/lualine')]],
- })
-
- use({
- "tpope/vim-fugitive",
- cmd = {
- "Git",
- "Gstatus",
- "Gblame",
- "Gpush",
- "Gpull",
- },
- })
-
- use({
- "lewis6991/gitsigns.nvim",
- requires = "nvim-lua/plenary.nvim",
- config = [[require('plugins/gitsigns')]],
- })
-
- use({
- "TimUntersberger/neogit",
- cmd = "Neogit",
- config = [[require('neogit').setup {disable_commit_confirmation = true, disable_signs = true}]],
- })
-
- use("kdheepak/lazygit.nvim")
-
- use({
- "f-person/git-blame.nvim",
- config = [[require('plugins/git-blame')]],
- })
-
- use({
- "mbbill/undotree",
- cmd = "UndotreeToggle",
- config = [[vim.g.undotree_SetFocusWhenToggle = 1]],
- })
-
- use({
- "ThePrimeagen/git-worktree.nvim",
- config = [[require('plugins/git-worktree')]],
- })
-
- use({
- "ThePrimeagen/refactoring.nvim",
- opt = true,
- })
-
- use({
- "folke/which-key.nvim",
- config = [[require('plugins/which-key')]],
- })
-
- use({
- "mfussenegger/nvim-dap",
- requires = {
- "theHamsta/nvim-dap-virtual-text",
- "rcarriga/nvim-dap-ui",
- "Pocco81/DAPInstall.nvim",
- },
- config = [[require('plugins/dap')]],
- })
-
- use("rcarriga/nvim-notify")
- use("antoinemadec/FixCursorHold.nvim")
- use("nacro90/numb.nvim")
- use("ThePrimeagen/harpoon")
- use("b0o/SchemaStore.nvim")
- use("windwp/nvim-spectre")
-
- use({
- "filipdutescu/renamer.nvim",
- config = [[require('plugins/renamer')]],
- })
-
- use("ur4ltz/surround.nvim")
-
- use({
- "numToStr/Comment.nvim",
- config = [[require('Comment').setup()]],
- })
-
- use({
- "norcalli/nvim-colorizer.lua",
- ft = {
- "css",
- "javascript",
- "vim",
- "html",
- },
- config = [[require('colorizer').setup {'css', 'javascript', 'vim', 'html'}]],
- })
-
- use({
- "akinsho/nvim-bufferline.lua",
- requires = "kyazdani42/nvim-web-devicons",
- config = [[require('plugins/bufferline')]],
- })
-
- use("moll/vim-bbye")
- use("SmiteshP/nvim-gps")
-
- -- use({
- -- "nvim-neo-tree/neo-tree.nvim",
- -- branch = "v2.x",
- -- requires = {
- -- "nvim-lua/plenary.nvim",
- -- "kyazdani42/nvim-web-devicons",
- -- "MunifTanjim/nui.nvim",
- -- },
- -- config = [[require('plugins/neo-tree')]],
- -- })
-
- -- use({
- -- "kyazdani42/nvim-tree.lua",
- -- requires = {
- -- {
- -- "yamatsum/nvim-nonicons",
- -- requires = "kyazdani42/nvim-web-devicons",
- -- },
- -- },
- -- config = [[require('plugins/nvim-tree')]],
- -- })
-
- -- Automatically set up your configuration after cloning packer.nvim
- -- Put this at the end after all plugins
- if packer_bootstrap then
- require("packer").sync()
- end
-end)
diff --git a/nvim/.config/nvim/lua/plugins/dap.lua b/nvim/.config/nvim/lua/plugins/dap.lua
deleted file mode 100644
index 2b4bfcc..0000000
--- a/nvim/.config/nvim/lua/plugins/dap.lua
+++ /dev/null
@@ -1,89 +0,0 @@
-local status_ok, dap = pcall(require, "dap")
-if not status_ok then
- return
-end
-
--- Debugpy
-dap.adapters.python = {
- type = "executable",
- command = "python",
- args = { "-m", "debugpy.adapter" },
-}
-
-dap.configurations.python = {
- {
- type = "python",
- request = "launch",
- name = "Launch file",
- program = "${file}",
- pythonPath = function()
- local venv_path = vim.fn.getenv("VIRTUAL_ENVIRONMENT")
- if venv_path ~= vim.NIL and venv_path ~= "" then
- return venv_path .. "/bin/python"
- else
- return "/usr/bin/python"
- end
- end,
- },
-}
-
--- Neovim Lua
-dap.adapters.nlua = function(callback, config)
- callback({ type = "server", host = config.host, port = config.port })
-end
-
-dap.configurations.lua = {
- {
- type = "nlua",
- request = "attach",
- name = "Attach to running Neovim instance",
- host = function()
- local value = vim.fn.input("Host [127.0.0.1]: ")
- if value ~= "" then
- return value
- end
- return "127.0.0.1"
- end,
- port = function()
- local val = tonumber(vim.fn.input("Port: "))
- assert(val, "Please provide a port number")
- return val
- end,
- },
-}
-
--- lldb
-dap.adapters.lldb = {
- type = "executable",
- command = "/usr/bin/lldb-vscode",
- name = "lldb",
-}
-
-dap.configurations.cpp = {
- {
- name = "Launch",
- type = "lldb",
- request = "launch",
- program = function()
- return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
- end,
- cwd = "${workspaceFolder}",
- stopOnEntry = false,
- args = {},
- runInTerminal = false,
- },
-}
-
-dap.configurations.c = dap.configurations.cpp
-dap.configurations.rust = dap.configurations.cpp
-
-vim.cmd([[command! BreakpointToggle lua require('dap').toggle_breakpoint()]])
-vim.cmd([[command! Debug lua require('dap').continue()]])
-vim.cmd([[command! DapREPL lua require('dap').repl.open()]])
-
-local tele_status_ok, telescope = pcall(require, "telescope")
-if not tele_status_ok then
- return
-end
-
-telescope.load_extension("dap")
diff --git a/nvim/.config/nvim/lua/plugins/gitsigns.lua b/nvim/.config/nvim/lua/plugins/gitsigns.lua
deleted file mode 100644
index 49de31e..0000000
--- a/nvim/.config/nvim/lua/plugins/gitsigns.lua
+++ /dev/null
@@ -1,48 +0,0 @@
-local status_ok, gitsigns = pcall(require, "gitsigns")
-if not status_ok then
- return
-end
-
-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`
- watch_gitdir = {
- interval = 1000,
- follow_files = true,
- },
- attach_to_untracked = true,
- current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
- current_line_blame_opts = {
- virt_text = true,
- virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align'
- delay = 1000,
- ignore_whitespace = false,
- },
- current_line_blame_formatter_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 = "rounded",
- style = "minimal",
- relative = "cursor",
- row = 0,
- col = 1,
- },
- yadm = {
- enable = false,
- },
-})
diff --git a/nvim/.config/nvim/lua/plugins/lsp-signature.lua b/nvim/.config/nvim/lua/plugins/lsp-signature.lua
deleted file mode 100644
index 4790366..0000000
--- a/nvim/.config/nvim/lua/plugins/lsp-signature.lua
+++ /dev/null
@@ -1,56 +0,0 @@
-local status_ok, signature = pcall(require, "lsp_signature")
-if not status_ok then
- return
-end
-
-local cfg = {
- debug = false, -- set to true to enable debug logging
- log_path = "debug_log_file_path", -- debug log path
- verbose = false, -- show debug line number
-
- bind = true, -- This is mandatory, otherwise border config won't get registered.
- -- If you want to hook lspsaga or other signature handler, pls set to false
- doc_lines = 0, -- will show two lines of comment/doc(if there are more than two lines in doc, will be truncated);
- -- set to 0 if you DO NOT want any API comments be shown
- -- This setting only take effect in insert mode, it does not affect signature help in normal
- -- mode, 10 by default
-
- floating_window = false, -- show hint in a floating window, set to false for virtual text only mode
-
- floating_window_above_cur_line = true, -- try to place the floating above the current line when possible Note:
- -- will set to true when fully tested, set to false will use whichever side has more space
- -- this setting will be helpful if you do not want the PUM and floating win overlap
- fix_pos = false, -- set to true, the floating window will not auto-close until finish all parameters
- hint_enable = true, -- virtual hint enable
- hint_scheme = "Comment",
- use_lspsaga = false, -- set to true if you want to use lspsaga popup
- hi_parameter = "LspSignatureActiveParameter", -- how your parameter will be highlight
- max_height = 12, -- max height of signature floating_window, if content is more than max_height, you can scroll down
- -- to view the hiding contents
- max_width = 120, -- max_width of signature floating_window, line will be wrapped if exceed max_width
- handler_opts = {
- border = "rounded", -- double, rounded, single, shadow, none
- },
-
- always_trigger = false, -- sometime show signature on new line or in middle of parameter can be confusing, set it to false for #58
-
- auto_close_after = nil, -- autoclose signature float win after x sec, disabled if nil.
- extra_trigger_chars = {}, -- Array of extra characters that will trigger signature completion, e.g., {"(", ","}
- zindex = 200, -- by default it will be on top of all floating windows, set to <= 50 send it to bottom
-
- padding = "", -- character to pad on left and right of signature can be ' ', or '|' etc
-
- transparency = nil, -- disabled by default, allow floating win transparent value 1~100
- shadow_blend = 36, -- if you using shadow as border use this set the opacity
- shadow_guibg = "Black", -- if you using shadow as border use this set the color e.g. 'Green' or '#121315'
- timer_interval = 200, -- default timer check interval set to lower value if you want to reduce latency
- toggle_key = nil, -- toggle signature on and off in insert mode, e.g. toggle_key = '<M-x>'
-}
-
--- recommanded:
-signature.setup(cfg) -- no need to specify bufnr if you don't use toggle_key
-
--- You can also do this inside lsp on_attach
--- note: on_attach deprecated
--- require("lsp_signature").on_attach(cfg, bufnr) -- no need to specify bufnr if you don't use toggle_key
-signature.on_attach(cfg) -- no need to specify bufnr if you don't use toggle_key
diff --git a/nvim/.config/nvim/lua/plugins/lspconfig.lua b/nvim/.config/nvim/lua/plugins/lspconfig.lua
deleted file mode 100644
index 7e152b9..0000000
--- a/nvim/.config/nvim/lua/plugins/lspconfig.lua
+++ /dev/null
@@ -1,105 +0,0 @@
-local status_ok, lspconfig = pcall(require, "lspconfig")
-if not status_ok then
- return
-end
-
-local installer_ok, installer = pcall(require, "nvim-lsp-installer")
-if installer_ok then
- require("nvim-lsp-installer").setup({
- automatic_installation = true, -- automatically detect which servers to install (based on which servers are set up via lspconfig)
- })
-end
-
-local capabilities = vim.lsp.protocol.make_client_capabilities()
-capabilities.textDocument.completion.completionItem.snippetSupport = true
-
-vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
- underline = true,
- signs = true,
- update_in_insert = true,
- virtual_text = {
- true,
- spacing = 6,
- severity_limit = "Error", -- Only show virtual text on error
- },
-})
-
-local function config(_config)
- return vim.tbl_deep_extend("force", {
- capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()),
- }, _config or {})
-end
-
-lspconfig.tsserver.setup(config())
-
-lspconfig.ccls.setup(config())
-
-lspconfig.gopls.setup(config({
- cmd = { "gopls", "serve" },
- settings = {
- gopls = {
- analyses = {
- unusedparams = true,
- },
- staticcheck = true,
- },
- },
-}))
-
-lspconfig.sumneko_lua.setup({
- settings = {
- Lua = {
- diagnostics = {
- globals = { "vim" },
- },
- format = {
- enable = false,
- },
- },
- },
- on_attach = function(client)
- client.resolved_capabilities.document_formatting = false
- client.resolved_capabilities.document_range_formatting = false
- end,
-})
-
-require("rust-tools").setup({
- tools = {
- autoSetHints = true,
- hover_with_actions = true,
- runnables = {
- use_telescope = true,
- },
- inlay_hints = {
- show_parameter_hints = false,
- parameter_hints_prefix = "",
- other_hints_prefix = "",
- },
- },
- server = {
- settings = {
- ["rust-analyzer"] = {
- cargo = {
- allFeatures = true,
- },
- checkOnSave = {
- command = "clippy",
- },
- },
- },
- },
-})
-
-local opts = {
- -- whether to highlight the currently hovered symbol
- -- disable if your cpu usage is higher than you want it
- -- or you just hate the highlight
- -- default: true
- highlight_hovered_item = true,
-
- -- whether to show outline guides
- -- default: true
- show_guides = true,
-}
-
-require("symbols-outline").setup(opts)
diff --git a/nvim/.config/nvim/lua/plugins/luasnip.lua b/nvim/.config/nvim/lua/plugins/luasnip.lua
deleted file mode 100644
index 4ea5725..0000000
--- a/nvim/.config/nvim/lua/plugins/luasnip.lua
+++ /dev/null
@@ -1,18 +0,0 @@
-local status_ok, luasnip = pcall(require, "luasnip")
-if not status_ok then
- return
-end
-
-luasnip.config.set_config({
- history = true,
- updateevents = "TextChanged,TextChangedI",
-})
-
-luasnip.snippets = { all = {}, html = {} }
-
-luasnip.snippets.javascript = luasnip.snippets.html
-luasnip.snippets.javascriptreact = luasnip.snippets.html
-luasnip.snippets.typescriptreact = luasnip.snippets.html
-require("luasnip.loaders.from_vscode").load({ include = { "html" } })
-
-require("luasnip.loaders.from_vscode").lazy_load()
diff --git a/nvim/.config/nvim/lua/plugins/neogit.lua b/nvim/.config/nvim/lua/plugins/neogit.lua
deleted file mode 100644
index 15fafde..0000000
--- a/nvim/.config/nvim/lua/plugins/neogit.lua
+++ /dev/null
@@ -1,6 +0,0 @@
-local status_ok, neogit = pcall(require, "neogit")
-if not status_ok then
- return
-end
-
-neogit.setup({})
diff --git a/nvim/.config/nvim/lua/plugins/null-ls.lua b/nvim/.config/nvim/lua/plugins/null-ls.lua
deleted file mode 100644
index aec9e8c..0000000
--- a/nvim/.config/nvim/lua/plugins/null-ls.lua
+++ /dev/null
@@ -1,31 +0,0 @@
-local status_ok, null_ls = pcall(require, "null-ls")
-if not status_ok then
- return
-end
-
-local code_actions = null_ls.builtins.code_actions
-local diagnostics = null_ls.builtins.diagnostics
-local formatting = null_ls.builtins.formatting
-
-null_ls.setup({
- sources = {
-
- -- Code Actions
- code_actions.gitsigns,
- code_actions.shellcheck,
-
- -- Diagnostics
- -- diagnostics.codespell,
- -- diagnostics.luacheck,
- -- diagnostics.markdownlint,
- diagnostics.shellcheck,
-
- -- Formatting
- formatting.prettier,
- formatting.black,
- formatting.latexindent,
- formatting.markdownlint,
- formatting.stylua,
- formatting.shfmt,
- },
-})
diff --git a/nvim/.config/nvim/lua/plugins/telescope.lua b/nvim/.config/nvim/lua/plugins/telescope.lua
deleted file mode 100644
index 6e272ec..0000000
--- a/nvim/.config/nvim/lua/plugins/telescope.lua
+++ /dev/null
@@ -1,82 +0,0 @@
-local M = {}
-
-M.setup = function()
- local status_ok, telescope = pcall(require, "telescope")
- if not status_ok then
- return
- end
-
- local actions = require("telescope.actions")
-
- telescope.setup({
- defaults = {
- mappings = {
- i = {
- ["<esc>"] = actions.close,
- ["<C-h>"] = "which_key",
- },
- },
- file_ignore_patterns = { "node_modules", ".git", "dist" },
- vimgrep_arguments = {
- "rg",
- "--color=never",
- "--no-heading",
- "--with-filename",
- "--line-number",
- "--column",
- "--hidden",
- "--smart-case",
- "--trim",
- "-u",
- },
- layout_strategy = "flex",
- scroll_strategy = "cycle",
- },
- extensions = {
- project = {
- base_dirs = {
- { path = "~/src", max_depth = 1 },
- },
- hidden_files = true,
- },
- fzf = {
- fuzzy = true,
- override_generic_sorter = true,
- override_file_sorter = true,
- case_mode = "smart_case",
- },
- frecency = {
- default_workspace = "CWD",
- workspaces = {
- ["src"] = "~/src",
- },
- },
- },
- pickers = {
- find_files = {
- find_command = { "rg", "--files", "--hidden" },
- },
- lsp_references = { theme = "dropdown" },
- lsp_code_actions = { theme = "dropdown" },
- lsp_definitions = { theme = "dropdown" },
- lsp_implementations = { theme = "dropdown" },
- buffers = {
- sort_lastused = true,
- },
- },
- })
-
- -- Extensions
- telescope.load_extension("frecency")
- telescope.load_extension("fzf")
-end
-
-M.project_files = function()
- local opts = {} -- define here if you want to define something
- local ok = pcall(require("telescope.builtin").git_files, opts)
- if not ok then
- require("telescope.builtin").find_files(opts)
- end
-end
-
-return M
diff --git a/nvim/.config/nvim/lua/plugins/treesitter.lua b/nvim/.config/nvim/lua/plugins/treesitter.lua
deleted file mode 100644
index 04dd3d1..0000000
--- a/nvim/.config/nvim/lua/plugins/treesitter.lua
+++ /dev/null
@@ -1,14 +0,0 @@
-local status_ok, treesitter = pcall(require, "nvim-treesitter.configs")
-if not status_ok then
- return
-end
-
-treesitter.setup({
- indent = {
- enable = true,
- },
- highlight = {
- enable = true,
- additional_vim_regex_highlighting = false,
- },
-})
diff --git a/nvim/.config/nvim/lua/plugins/which-key.lua b/nvim/.config/nvim/lua/plugins/which-key.lua
deleted file mode 100644
index f45cb52..0000000
--- a/nvim/.config/nvim/lua/plugins/which-key.lua
+++ /dev/null
@@ -1,34 +0,0 @@
-local status_ok, which_key = pcall(require, "which-key")
-if not status_ok then
- return
-end
-
-local setup = {
- plugins = {
- spelling = {
- enabled = true, -- enabling this will show WhichKey when pressing z= to select spelling suggestions
- suggestions = 20, -- how many suggestions should be shown in the list?
- },
- },
- window = {
- border = "rounded", -- none, single, double, shadow
- position = "bottom", -- bottom, top
- margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left]
- padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left]
- winblend = 0,
- },
- layout = {
- height = { min = 4, max = 25 }, -- min and max height of the columns
- width = { min = 20, max = 50 }, -- min and max width of the columns
- spacing = 3, -- spacing between columns
- align = "center", -- align columns left, center or right
- },
-}
-local opts = {
- buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
- silent = true, -- use `silent` when creating keymaps
- noremap = true, -- use `noremap` when creating keymaps
- nowait = true, -- use `nowait` when creating keymaps
-}
-
-which_key.setup(setup)
diff --git a/nvim/.config/nvim/lua/tobyvin/autocommands.lua b/nvim/.config/nvim/lua/tobyvin/autocommands.lua
new file mode 100644
index 0000000..c82796f
--- /dev/null
+++ b/nvim/.config/nvim/lua/tobyvin/autocommands.lua
@@ -0,0 +1,88 @@
+local augroup_default = vim.api.nvim_create_augroup("Default", { clear = true })
+
+vim.api.nvim_create_autocmd("TextYankPost", {
+ group = augroup_default,
+ pattern = "*",
+ callback = function()
+ vim.highlight.on_yank()
+ end,
+ desc = "Highlight yank",
+})
+
+vim.api.nvim_create_autocmd("BufWritePre", {
+ group = augroup_default,
+ pattern = "*",
+ callback = function()
+ local cursor = vim.api.nvim_win_get_cursor(0)
+ vim.cmd("%s/\\s\\+$//e")
+ vim.api.nvim_win_set_cursor(0, cursor)
+ end,
+ desc = "Trim whitespace on write",
+})
+
+vim.api.nvim_create_autocmd("FileType", {
+ group = augroup_default,
+ pattern = "help",
+ callback = function()
+ vim.opt_local.wrap = true
+ vim.opt_local.textwidth = 120
+ vim.cmd("wincmd L")
+ vim.cmd("vertical resize " .. vim.opt.textwidth:get())
+ end,
+ desc = "Resize help window",
+})
+
+vim.api.nvim_create_autocmd("FileType", {
+ group = augroup_default,
+ pattern = "qf",
+ callback = function()
+ vim.opt_local.buflisted = false
+ end,
+ desc = "Hide filetype from buffer list",
+})
+
+vim.api.nvim_create_autocmd("FileType", {
+ group = augroup_default,
+ pattern = { "xml", "html", "xhtml", "css", "scss", "javascript", "lua", "dart" },
+ callback = function()
+ vim.opt_local.shiftwidth = 2
+ vim.opt_local.tabstop = 2
+ end,
+ desc = "Set file specific tabstop",
+})
+
+local augroup_search_highlighting = vim.api.nvim_create_augroup("SearchHighlighting", { clear = true })
+
+vim.api.nvim_create_autocmd("CmdlineEnter", {
+ group = augroup_search_highlighting,
+ pattern = "/,?",
+ callback = function()
+ vim.opt.hlsearch = true
+ end,
+ desc = "Enable hlsearch on input",
+})
+
+vim.api.nvim_create_autocmd("CmdlineLeave", {
+ group = augroup_search_highlighting,
+ pattern = "/,?",
+ callback = function()
+ vim.opt.hlsearch = false
+ end,
+ desc = "Disable hlsearch on exit",
+})
+
+-- TODO: figure out how to do this correctly
+-- config reloading
+-- local configs = vim.api.nvim_create_augroup("Configs", { clear = true })
+--
+-- vim.api.nvim_create_autocmd("BufWritePost", {
+-- group = configs,
+-- pattern = ".nvimrc.lua",
+-- command = "source <afile>",
+-- })
+--
+-- vim.api.nvim_create_autocmd("BufWritePost", {
+-- group = configs,
+-- pattern = os.getenv("HOME") .. "/.config/nvim/*/*.lua",
+-- command = "source $MYVIMRC",
+-- })
diff --git a/nvim/.config/nvim/lua/tobyvin/init.lua b/nvim/.config/nvim/lua/tobyvin/init.lua
new file mode 100644
index 0000000..89ba8e2
--- /dev/null
+++ b/nvim/.config/nvim/lua/tobyvin/init.lua
@@ -0,0 +1,20 @@
+local M = {}
+
+M.setup = function()
+ -- load = function(module)
+ -- package.loaded[module] = nil
+ -- return require(module)
+ -- end
+
+ require("tobyvin.options").setup()
+ require("tobyvin.plugins").setup()
+ require("tobyvin.lsp").setup()
+
+ -- deferred execution makes the editor feel more responsive
+ vim.defer_fn(function()
+ require("tobyvin.autocommands")
+ require("tobyvin.mappings")
+ end, 0)
+end
+
+return M
diff --git a/nvim/.config/nvim/lua/tobyvin/lsp/formatting.lua b/nvim/.config/nvim/lua/tobyvin/lsp/formatting.lua
new file mode 100644
index 0000000..4bdb487
--- /dev/null
+++ b/nvim/.config/nvim/lua/tobyvin/lsp/formatting.lua
@@ -0,0 +1,53 @@
+local M = {
+ augroup_format = vim.api.nvim_create_augroup("Format", { clear = true }),
+}
+
+M.toggle_format = function()
+ vim.b.auto_format = not vim.b.auto_format
+ vim.notify("Auto-formatter " .. (vim.b.auto_format and "en" or "dis") .. "abled", "Info")
+end
+
+M.on_attach = function(client, bufnr)
+ local nmap = require("tobyvin.utils").create_map_group("n", "<leader>l", "LSP", { buffer = bufnr })
+ local vmap = require("tobyvin.utils").create_map_group("v", "<leader>l", "LSP", { buffer = bufnr })
+
+ if client.server_capabilities.documentFormattingProvider then
+ vim.b.auto_format = true
+
+ vim.api.nvim_buf_create_user_command(
+ bufnr,
+ "ToggleAutoFormat",
+ M.toggle_format,
+ { desc = "Toggle auto-format" }
+ )
+ vim.api.nvim_buf_create_user_command(bufnr, "Format", vim.lsp.buf.format, { nargs = "*", desc = "Format" })
+
+ nmap("f", vim.lsp.buf.format, { desc = "Format" })
+ nmap("F", M.toggle_format, { desc = "Toggle auto-format" })
+
+ vim.api.nvim_clear_autocmds({ group = M.augroup_format, buffer = bufnr })
+ vim.api.nvim_create_autocmd("BufWritePre", {
+ group = M.augroup_format,
+ buffer = bufnr,
+ callback = function()
+ if M.auto_format_enabled then
+ vim.lsp.buf.format()
+ end
+ end,
+ desc = "Auto-format",
+ })
+ end
+
+ if client.server_capabilities.documentRangeFormattingProvider then
+ vim.api.nvim_buf_create_user_command(
+ bufnr,
+ "FormatRange",
+ vim.lsp.buf.range_formatting,
+ { nargs = "*", desc = "Format range" }
+ )
+
+ vmap("f", vim.lsp.buf.range_formatting, { desc = "Format range" })
+ end
+end
+
+return M
diff --git a/nvim/.config/nvim/lua/tobyvin/lsp/handlers.lua b/nvim/.config/nvim/lua/tobyvin/lsp/handlers.lua
new file mode 100644
index 0000000..ada5afc
--- /dev/null
+++ b/nvim/.config/nvim/lua/tobyvin/lsp/handlers.lua
@@ -0,0 +1,93 @@
+local M = {}
+
+M.setup = function()
+ vim.lsp.handlers["textDocument/definition"] = function(_, result)
+ if not result or vim.tbl_isempty(result) then
+ vim.notify("[LSP] Could not find definition", "info")
+ return
+ end
+
+ if vim.tbl_islist(result) then
+ vim.lsp.util.jump_to_location(result[1], "utf-8")
+ else
+ vim.lsp.util.jump_to_location(result, "utf-8")
+ end
+ end
+
+ vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
+ vim.lsp.handlers["textDocument/publishDiagnostics"],
+ {
+ signs = {
+ severity_limit = "Error",
+ },
+ underline = {
+ severity_limit = "Warning",
+ },
+ update_in_insert = true,
+ virtual_text = true,
+ }
+ )
+
+ vim.lsp.handlers["$/progress"] = function(_, result, ctx)
+ local utils = require("tobyvin.lsp.utils")
+ local client_id = ctx.client_id
+ local val = result.value
+
+ if not val.kind then
+ return
+ end
+
+ local notif_data = utils.get_notif_data(client_id, result.token)
+
+ if val.kind == "begin" then
+ local message = utils.format_message(val.message, val.percentage)
+
+ notif_data.notification = vim.notify(message, "info", {
+ title = utils.format_title(val.title, vim.lsp.get_client_by_id(client_id).name),
+ icon = utils.spinner_frames[1],
+ timeout = false,
+ hide_from_history = false,
+ })
+
+ notif_data.spinner = 1
+ utils.update_spinner(client_id, result.token)
+ elseif val.kind == "report" and notif_data then
+ notif_data.notification = vim.notify(utils.format_message(val.message, val.percentage), "info", {
+ replace = notif_data.notification,
+ hide_from_history = false,
+ })
+ elseif val.kind == "end" and notif_data then
+ notif_data.notification = vim.notify(
+ val.message and utils.format_message(val.message) or "Complete",
+ "info",
+ {
+ icon = "",
+ replace = notif_data.notification,
+ timeout = 3000,
+ }
+ )
+
+ notif_data.spinner = nil
+ end
+ end
+
+ vim.lsp.handlers["window/showMessage"] = function(_, result, ctx)
+ local client = vim.lsp.get_client_by_id(ctx.client_id)
+ local lvl = ({
+ "ERROR",
+ "WARN",
+ "INFO",
+ "DEBUG",
+ })[result.type]
+
+ vim.notify({ result.message }, lvl, {
+ title = "LSP | " .. client.name,
+ timeout = 10000,
+ keep = function()
+ return lvl == "ERROR" or lvl == "WARN"
+ end,
+ })
+ end
+end
+
+return M
diff --git a/nvim/.config/nvim/lua/tobyvin/lsp/highlighting.lua b/nvim/.config/nvim/lua/tobyvin/lsp/highlighting.lua
new file mode 100644
index 0000000..055e735
--- /dev/null
+++ b/nvim/.config/nvim/lua/tobyvin/lsp/highlighting.lua
@@ -0,0 +1,25 @@
+local M = {
+ augroup_highlight = vim.api.nvim_create_augroup("Highlight", { clear = true }),
+}
+
+M.on_attach = function(client, bufnr)
+ if client.server_capabilities.documentHighlightProvider then
+ vim.api.nvim_clear_autocmds({ group = M.augroup_highlight, buffer = bufnr })
+
+ vim.api.nvim_create_autocmd("CursorHold", {
+ group = M.augroup_highlight,
+ buffer = bufnr,
+ callback = vim.lsp.buf.document_highlight,
+ desc = "Highlight lsp references",
+ })
+
+ vim.api.nvim_create_autocmd("CursorMoved", {
+ group = M.augroup_highlight,
+ buffer = bufnr,
+ callback = vim.lsp.buf.clear_references,
+ desc = "Clear highlighted references",
+ })
+ end
+end
+
+return M
diff --git a/nvim/.config/nvim/lua/tobyvin/lsp/init.lua b/nvim/.config/nvim/lua/tobyvin/lsp/init.lua
new file mode 100644
index 0000000..48332e4
--- /dev/null
+++ b/nvim/.config/nvim/lua/tobyvin/lsp/init.lua
@@ -0,0 +1,48 @@
+local M = {}
+
+M.on_attach = function(client, bufnr)
+ local nmap = require("tobyvin.utils").create_map_group("n", "<leader>l", "LSP", { buffer = bufnr })
+ local nmap_goto = require("tobyvin.utils").create_map_group("n", "<leader>lg", "Goto", { buffer = bufnr })
+
+ nmap("a", vim.lsp.buf.code_action, { desc = "Code Action" })
+ nmap("d", "<cmd>TroubleToggle document_diagnostics<cr>", { desc = "Document Diagnostics" })
+ nmap("D", "<cmd>TroubleToggle workspace_diagnostics<cr>", { desc = "Workspace Diagnostics" })
+ nmap("h", vim.lsp.buf.hover, { desc = "Hover" })
+ nmap("H", vim.lsp.buf.signature_help, { desc = "Signature Help" })
+ nmap("j", vim.diagnostic.goto_next, { desc = "Next Diagnostic" })
+ nmap("k", vim.diagnostic.goto_prev, { desc = "Prev Diagnostic" })
+ nmap("l", vim.lsp.codelens.run, { desc = "CodeLens Action" })
+ nmap("o", "<cmd>SymbolsOutline<cr>", { desc = "Outline" })
+ -- nmap("q", vim.lsp.diagnostic.setloclist, { desc = "Quickfix" })
+ nmap("r", vim.lsp.buf.rename, { desc = "Rename" })
+ nmap("R", "<cmd>TroubleToggle lsp_references<cr>", { desc = "References" })
+ nmap("s", "<cmd>Telescope lsp_document_symbols<cr>", { desc = "Document Symbols" })
+ nmap("S", "<cmd>Telescope lsp_dynamic_workspace_symbols<cr>", { desc = "Workspace Symbols" })
+ nmap("w", "<cmd>Telescope lsp_workspace_diagnostics<cr>", { desc = "Workspace Diagnostics" })
+ nmap_goto("d", vim.lsp.buf.definition, { desc = "Definition" })
+ nmap_goto("D", vim.lsp.buf.declaration, { desc = "Declaration" })
+ nmap_goto("i", vim.lsp.buf.implementation, { desc = "Implementation" })
+ nmap_goto("r", vim.lsp.buf.references, { desc = "References" })
+
+ -- disabled in favor of https://github.com/nvim-treesitter/nvim-treesitter-refactor#highlight-definitions
+ -- require("tobyvin.lsp.highlighting").on_attach(client, bufnr)
+ require("tobyvin.lsp.formatting").on_attach(client, bufnr)
+ require("lsp_signature").on_attach()
+end
+
+M.config = function(config)
+ local capabilities = vim.lsp.protocol.make_client_capabilities()
+ capabilities.textDocument.completion.completionItem.snippetSupport = true
+ capabilities = require("cmp_nvim_lsp").update_capabilities(capabilities)
+
+ return vim.tbl_deep_extend("force", {
+ capabilities = capabilities,
+ on_attach = M.on_attach,
+ }, config or {})
+end
+
+M.setup = function()
+ require("tobyvin.lsp.handlers").setup()
+end
+
+return M
diff --git a/nvim/.config/nvim/lua/tobyvin/lsp/utils.lua b/nvim/.config/nvim/lua/tobyvin/lsp/utils.lua
new file mode 100644
index 0000000..8b5f292
--- /dev/null
+++ b/nvim/.config/nvim/lua/tobyvin/lsp/utils.lua
@@ -0,0 +1,45 @@
+local M = {
+ client_notifs = {},
+ spinner_frames = { "⣾", "⣽", "⣻", "⢿", "⡿", "⣟", "⣯", "⣷" },
+}
+
+M.get_notif_data = function(client_id, token)
+ if not M.client_notifs[client_id] then
+ M.client_notifs[client_id] = {}
+ end
+
+ if not M.client_notifs[client_id][token] then
+ M.client_notifs[client_id][token] = {}
+ end
+
+ return M.client_notifs[client_id][token]
+end
+
+M.update_spinner = function(client_id, token)
+ local notif_data = M.get_notif_data(client_id, token)
+
+ if notif_data.spinner then
+ local new_spinner = (notif_data.spinner + 1) % #M.spinner_frames
+ notif_data.spinner = new_spinner
+
+ notif_data.notification = vim.notify(nil, nil, {
+ hide_from_history = true,
+ icon = M.spinner_frames[new_spinner],
+ replace = notif_data.notification,
+ })
+
+ vim.defer_fn(function()
+ M.update_spinner(client_id, token)
+ end, 100)
+ end
+end
+
+M.format_title = function(title, client_name)
+ return client_name .. (#title > 0 and ": " .. title or "")
+end
+
+M.format_message = function(message, percentage)
+ return (percentage and percentage .. "%\t" or "") .. (message or "")
+end
+
+return M
diff --git a/nvim/.config/nvim/lua/tobyvin/mappings.lua b/nvim/.config/nvim/lua/tobyvin/mappings.lua
new file mode 100644
index 0000000..1dc10c8
--- /dev/null
+++ b/nvim/.config/nvim/lua/tobyvin/mappings.lua
@@ -0,0 +1,72 @@
+local mappings = {
+ {
+ -- NORMAL mode
+ opts = {},
+ mappings = {
+ ["<leader>"] = {
+ c = { "<cmd>Bdelete!<CR>", "Close Buffer" },
+ q = { "<cmd>q<CR>", "Quit" },
+ w = { "<cmd>w!<CR>", "Save" },
+ -- W = { ":set wrap! linebreak!<CR>", "Toggle Line Wrap" },
+ ["/"] = { "<cmd>lua require('Comment.api').toggle_current_linewise()<CR>", "Comment" },
+
+ f = {
+ name = "Find",
+ s = { "<cmd>Telescope session-lens search_session<cr>", "Sessions" },
+ },
+
+ m = {
+ name = "Markers",
+ h = { '<cmd>lua require("harpoon.mark").add_file()<cr>', "Harpoon" },
+ u = { '<cmd>lua require("harpoon.ui").toggle_quick_menu()<cr>', "Harpoon UI" },
+ },
+ -- r = {
+ -- name = "Replace",
+ -- f = { "<cmd>lua require('spectre').open_file_search()<cr>", "Replace Buffer" },
+ -- r = { "<cmd>lua require('spectre').open()<cr>", "Replace" },
+ -- w = { "<cmd>lua require('spectre').open_visual({select_word=true})<cr>", "Replace Word" },
+ -- },
+ },
+ },
+ },
+ {
+ -- VISUAL mode
+ opts = {
+ mode = "v",
+ },
+ mappings = {
+ -- Ctrl maps
+ ["<C-/>"] = {
+ "<ESC><CMD>lua require('Comment.api').toggle_linewise_op(vim.fn.visualmode())<CR>",
+ "Comment",
+ },
+
+ -- Prefix "<leader>"
+ ["<leader>"] = {
+ ["/"] = {
+ "<ESC><CMD>lua require('Comment.api').toggle_linewise_op(vim.fn.visualmode())<CR>",
+ "Comment",
+ },
+ },
+ },
+ },
+ {
+ -- INSERT mode
+ opts = {
+ mode = "i",
+ },
+ mappings = {
+ ["<C-h>"] = { "<left>", "Left" },
+ ["<C-j>"] = { "<up>", "Up" },
+ ["<C-k>"] = { "<down>", "Down" },
+ ["<C-l>"] = { "<right>", "Right" },
+ },
+ },
+}
+
+local ok, which_key = pcall(require, "which-key")
+if ok then
+ for i, m in ipairs(mappings) do
+ which_key.register(m.mappings, m.opts)
+ end
+end
diff --git a/nvim/.config/nvim/lua/tobyvin/options.lua b/nvim/.config/nvim/lua/tobyvin/options.lua
new file mode 100644
index 0000000..f1bff16
--- /dev/null
+++ b/nvim/.config/nvim/lua/tobyvin/options.lua
@@ -0,0 +1,70 @@
+local M = {}
+
+M.setup = function()
+ vim.g.mapleader = " "
+
+ vim.opt.termguicolors = true
+ vim.opt.laststatus = 3
+ vim.opt.undofile = true
+ vim.opt.swapfile = false
+ vim.opt.clipboard = vim.opt.clipboard + "unnamedplus"
+ vim.opt.shortmess = vim.opt.shortmess + "c"
+ vim.opt.wrap = false
+ vim.opt.showmatch = true
+ vim.opt.cursorline = true
+ vim.opt.number = true
+ vim.opt.relativenumber = true
+ vim.opt.incsearch = true
+ vim.opt.hlsearch = true
+ vim.opt.ignorecase = true
+ vim.opt.smartcase = true
+ vim.opt.scrolloff = 10
+ vim.opt.sidescrolloff = 2
+ vim.opt.backspace = { "indent", "start", "eol" }
+ vim.opt.mouse = "a"
+ vim.opt.updatetime = 500
+ vim.opt.expandtab = true
+ vim.opt.softtabstop = 4
+ vim.opt.textwidth = 120
+ vim.opt.shiftwidth = 4
+ vim.opt.tabstop = 4
+ vim.opt.smarttab = true
+ vim.opt.autoindent = true
+ vim.opt.breakindent = true
+ vim.opt.showbreak = string.rep(" ", 3) -- Make it so that long lines wrap smartly
+ vim.opt.linebreak = true
+ vim.opt.shiftround = true
+ vim.opt.splitbelow = true
+ vim.opt.splitright = true
+ vim.opt.laststatus = 2
+ vim.opt.colorcolumn = "+0"
+ vim.opt.hidden = true
+ vim.opt.inccommand = "split"
+ vim.opt.shell = "zsh"
+ vim.opt.wildignore = vim.opt.wildignore + { "*.o", "*.rej", "*.so" }
+ vim.opt.lazyredraw = true
+ vim.opt.completeopt = { "menuone", "noselect", "noinsert" }
+ vim.opt.sessionoptions = {
+ "blank",
+ "buffers",
+ "curdir",
+ "folds",
+ "help",
+ "tabpages",
+ "winsize",
+ "winpos",
+ "terminal",
+ }
+ vim.opt.formatoptions = vim.opt.formatoptions
+ - "a" -- Auto formatting is BAD.
+ - "t" -- Don't auto format my code. I got linters for that.
+ + "c" -- In general, I like it when comments respect textwidth
+ + "q" -- Allow formatting comments w/ gq
+ - "o" -- O and o, don't continue comments
+ + "r" -- But do continue when pressing enter.
+ + "n" -- Indent past the formatlistpat, not underneath it.
+ + "j" -- Auto-remove comments if possible.
+ - "2" -- I'm not in gradeschool anymore
+end
+
+return M
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins.lua b/nvim/.config/nvim/lua/tobyvin/plugins.lua
new file mode 100644
index 0000000..18b6354
--- /dev/null
+++ b/nvim/.config/nvim/lua/tobyvin/plugins.lua
@@ -0,0 +1,331 @@
+local utils = require("tobyvin.utils")
+local M = {}
+
+M.plugins = function(use)
+ use("wbthomason/packer.nvim")
+
+ use({
+ "dstein64/vim-startuptime",
+ cmd = "StartupTime",
+ config = [[vim.g.startuptime_tries = 3]],
+ })
+
+ use("lewis6991/impatient.nvim")
+
+ use({ "rcarriga/nvim-notify", config = [[require("tobyvin.plugins.notify").setup()]] })
+ use("stevearc/dressing.nvim")
+
+ use("andweeb/presence.nvim")
+
+ use({ "eddyekofo94/gruvbox-flat.nvim", config = [[require("tobyvin.plugins.gruvbox-flat").setup()]] })
+
+ use({
+ "rmagatti/auto-session",
+ config = [[require("auto-session").setup()]],
+ })
+
+ use({
+ "rmagatti/session-lens",
+ requires = { "rmagatti/auto-session", "nvim-telescope/telescope.nvim" },
+ config = [[require("tobyvin.plugins.session-lens").setup()]],
+ })
+
+ use({
+ "tpope/vim-dispatch",
+ cmd = {
+ "Dispatch",
+ "Make",
+ "Focus",
+ "Start",
+ },
+ })
+
+ use({
+ "neovim/nvim-lspconfig",
+ requires = {
+ "williamboman/nvim-lsp-installer",
+ "ray-x/lsp_signature.nvim",
+ },
+ config = [[require("tobyvin.plugins.lspconfig").setup()]],
+ })
+
+ use({
+ "jose-elias-alvarez/null-ls.nvim",
+ requires = "nvim-lua/plenary.nvim",
+ config = [[require("tobyvin.plugins.null-ls").setup()]],
+ })
+
+ use({
+ "folke/lua-dev.nvim",
+ requires = {
+ "neovim/nvim-lspconfig",
+ },
+ config = [[require("tobyvin.plugins.lua-dev").setup()]],
+ })
+
+ use({
+ "simrat39/rust-tools.nvim",
+ branch = "modularize_and_inlay_rewrite",
+ requires = {
+ "neovim/nvim-lspconfig",
+ },
+ config = [[require("tobyvin.plugins.rust-tools").setup()]],
+ })
+
+ use({
+ "brymer-meneses/grammar-guard.nvim",
+ requires = {
+ "neovim/nvim-lspconfig",
+ "williamboman/nvim-lsp-installer",
+ },
+ config = [[require("grammar-guard").init()]],
+ })
+
+ -- use({
+ -- "saecki/crates.nvim",
+ -- requires = { "nvim-lua/plenary.nvim" },
+ -- config = [[require("crates").setup()]],
+ -- })
+
+ use({
+ "hrsh7th/nvim-cmp",
+ requires = {
+ { "onsails/lspkind-nvim", config = [[require("tobyvin.plugins.lspkind")]] },
+ "ray-x/lsp_signature.nvim",
+ "hrsh7th/cmp-nvim-lsp",
+ "hrsh7th/cmp-nvim-lua",
+ "hrsh7th/cmp-buffer",
+ "hrsh7th/cmp-path",
+ "hrsh7th/cmp-calc",
+ "saadparwaiz1/cmp_luasnip",
+ "hrsh7th/cmp-nvim-lsp-signature-help",
+ },
+ config = [[require("tobyvin.plugins.cmp")]],
+ })
+
+ use({ "simrat39/symbols-outline.nvim", config = [[require("symbols-outline").setup()]] })
+
+ use({
+ "folke/trouble.nvim",
+ cmd = "TroubleToggle",
+ })
+
+ use({
+ "nvim-telescope/telescope.nvim",
+ requires = {
+ "nvim-lua/plenary.nvim",
+ "BurntSushi/ripgrep",
+ "nvim-telescope/telescope-dap.nvim",
+ "nvim-telescope/telescope-packer.nvim",
+ "nvim-telescope/telescope-github.nvim",
+ { "nvim-telescope/telescope-fzf-native.nvim", run = "make" },
+ { "nvim-telescope/telescope-smart-history.nvim", requires = { "tami5/sqlite.lua", module = "sqlite" } },
+ { "nvim-telescope/telescope-frecency.nvim", requires = { "tami5/sqlite.lua", module = "sqlite" } },
+ },
+ config = [[require("tobyvin.plugins.telescope").setup()]],
+ })
+
+ use({
+ "AckslD/nvim-neoclip.lua",
+ requires = {
+ { "tami5/sqlite.lua", module = "sqlite" },
+ { "nvim-telescope/telescope.nvim" },
+ },
+ config = [[require("tobyvin.plugins.neoclip").setup()]],
+ })
+
+ use({
+ "L3MON4D3/LuaSnip",
+ requires = "rafamadriz/friendly-snippets",
+ config = [[require("tobyvin.plugins.luasnip")]],
+ })
+
+ use({
+ "nvim-treesitter/nvim-treesitter",
+ run = ":TSUpdate",
+ requires = {
+ "nvim-treesitter/nvim-treesitter-refactor",
+ "nvim-treesitter/nvim-treesitter-textobjects",
+ "nvim-treesitter/nvim-treesitter-context",
+ "JoosepAlviste/nvim-ts-context-commentstring",
+ "mfussenegger/nvim-ts-hint-textobject",
+ },
+ config = [[require("tobyvin.plugins.treesitter").setup()]],
+ })
+
+ use({
+ "ThePrimeagen/refactoring.nvim",
+ requires = {
+ "nvim-lua/plenary.nvim",
+ "nvim-treesitter/nvim-treesitter",
+ },
+ config = [[require("tobyvin.plugins.refactoring").setup()]],
+ })
+
+ use({
+ "danymat/neogen",
+ requires = "nvim-treesitter/nvim-treesitter",
+ config = [[require("tobyvin.plugins.neogen").setup()]],
+ })
+
+ use("norcalli/nvim-colorizer.lua")
+
+ use({
+ "lukas-reineke/indent-blankline.nvim",
+ config = [[require("tobyvin.plugins.blankline")]],
+ })
+
+ use({ "lukas-reineke/virt-column.nvim", config = [[require("virt-column").setup()]] })
+ use("tpope/vim-eunuch")
+
+ use({
+ "nvim-lualine/lualine.nvim",
+ requires = {
+ { "kyazdani42/nvim-web-devicons" },
+ },
+ config = [[require("tobyvin.plugins.lualine")]],
+ })
+
+ use({
+ "TimUntersberger/neogit",
+ config = [[require("tobyvin.plugins.neogit").setup()]],
+ })
+
+ if vim.fn.executable("gh") == 1 then
+ use("pwntester/octo.nvim")
+ end
+
+ use({
+ "lewis6991/gitsigns.nvim",
+ requires = "nvim-lua/plenary.nvim",
+ config = [[require("tobyvin.plugins.gitsigns")]],
+ })
+
+ use({
+ "f-person/git-blame.nvim",
+ config = [[require("tobyvin.plugins.git-blame")]],
+ })
+
+ use({
+ "sindrets/diffview.nvim",
+ requires = "nvim-lua/plenary.nvim",
+ })
+
+ use({
+ "mbbill/undotree",
+ cmd = "UndotreeToggle",
+ config = [[vim.g.undotree_SetFocusWhenToggle = 1]],
+ })
+
+ use({
+ "ThePrimeagen/git-worktree.nvim",
+ config = [[require("tobyvin.plugins.git-worktree")]],
+ })
+
+ use({
+ "folke/which-key.nvim",
+ config = [[require("tobyvin.plugins.which-key").setup()]],
+ })
+
+ use({
+ "mfussenegger/nvim-dap",
+ requires = {
+ "theHamsta/nvim-dap-virtual-text",
+ "rcarriga/nvim-dap-ui",
+ "Pocco81/DAPInstall.nvim",
+ },
+ config = [[require("tobyvin.plugins.dap").setup()]],
+ })
+
+ use({ "antoinemadec/FixCursorHold.nvim", config = [[vim.g.curshold_updatime = 1000]] })
+ use("nacro90/numb.nvim")
+ use("ThePrimeagen/harpoon")
+ use("b0o/SchemaStore.nvim")
+ use("windwp/nvim-spectre")
+ use("ggandor/lightspeed.nvim")
+ use({ "ur4ltz/surround.nvim", config = [[require("surround").setup({mappings_style = "surround"})]] })
+
+ use({
+ "numToStr/Comment.nvim",
+ config = [[require("Comment").setup()]],
+ })
+
+ use({ "famiu/bufdelete.nvim", config = [[require("tobyvin.plugins.bufdelete").setup()]] })
+ use({
+ "akinsho/nvim-bufferline.lua",
+ requires = "kyazdani42/nvim-web-devicons",
+ config = [[require("tobyvin.plugins.bufferline")]],
+ })
+ use({
+ "goolord/alpha-nvim",
+ requires = { "kyazdani42/nvim-web-devicons" },
+ config = [[require("alpha").setup(require("alpha.themes.theta").config)]],
+ })
+
+ use("SmiteshP/nvim-gps")
+
+ if PackerBootstrap then
+ require("packer").sync()
+ end
+end
+
+M.open_log = function()
+ utils.popup(vim.fn.stdpath("cache") .. "/packer.nvim.log")
+end
+
+M.setup = function()
+ local install_path = vim.fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
+ if vim.fn.empty(vim.fn.glob(install_path, nil, nil, nil)) > 0 then
+ PackerBootstrap = vim.fn.system({
+ "git",
+ "clone",
+ "--depth",
+ "1",
+ "https://github.com/wbthomason/packer.nvim",
+ install_path,
+ })
+ vim.notify("Installing packer. Reload neovim to load plugins.", "info", { title = "[packer] Installing" })
+ vim.cmd([[packadd packer.nvim]])
+ end
+
+ local status_ok, packer = pcall(require, "packer")
+ if not status_ok then
+ vim.notify("Failed to load module 'packer'", "error")
+ return
+ end
+
+ packer.init({
+ display = {
+ open_fn = function()
+ return require("packer.util").float({ border = "rounded" })
+ end,
+ },
+ autoremove = false,
+ })
+
+ local augroup_packer = vim.api.nvim_create_augroup("Packer", { clear = true })
+ vim.api.nvim_create_autocmd("BufWritePost", {
+ group = augroup_packer,
+ pattern = "plugins.lua",
+ callback = function()
+ utils.reload("tobyvin.plugins")
+ packer.sync()
+ end,
+ desc = "Reload packer config on write",
+ })
+
+ local nmap = utils.create_map_group("n", "<leader>p", "Packer")
+
+ nmap("c", packer.compile, { desc = "Compile" })
+ nmap("C", packer.clean, { desc = "Clean" })
+ nmap("i", packer.install, { desc = "Install" })
+ nmap("s", packer.sync, { desc = "Sync" })
+ nmap("S", packer.status, { desc = "Status" })
+ nmap("u", packer.update, { desc = "Update" })
+ nmap("l", M.open_log, { desc = "Log" })
+
+ -- Install your plugins here
+ return packer.startup(M.plugins)
+end
+
+return M
diff --git a/nvim/.config/nvim/lua/plugins/blankline.lua b/nvim/.config/nvim/lua/tobyvin/plugins/blankline.lua
index a506e82..a506e82 100644
--- a/nvim/.config/nvim/lua/plugins/blankline.lua
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/blankline.lua
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins/bufdelete.lua b/nvim/.config/nvim/lua/tobyvin/plugins/bufdelete.lua
new file mode 100644
index 0000000..91c6ce4
--- /dev/null
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/bufdelete.lua
@@ -0,0 +1,44 @@
+local M = {
+ augroup = vim.api.nvim_create_augroup("bufdelete", { clear = true }),
+}
+
+M.get_listed_buffers = function()
+ local buffers = {}
+ local len = 0
+ for buffer = 1, vim.fn.bufnr("$") do
+ if vim.fn.buflisted(buffer) == 1 then
+ len = len + 1
+ buffers[len] = buffer
+ end
+ end
+
+ return buffers
+end
+
+M.setup = function()
+ vim.api.nvim_create_autocmd("User", {
+ pattern = "BDeletePre",
+ group = M.augroup,
+ callback = function(event)
+ local found_non_empty_buffer = false
+ local buffers = M.get_listed_buffers()
+
+ for _, bufnr in ipairs(buffers) do
+ if not found_non_empty_buffer then
+ local name = vim.api.nvim_buf_get_name(bufnr)
+ local ft = vim.api.nvim_buf_get_option(bufnr, "filetype")
+
+ if bufnr ~= event.buf and name ~= "" and ft ~= "Alpha" then
+ found_non_empty_buffer = true
+ end
+ end
+ end
+
+ if not found_non_empty_buffer then
+ vim.cmd([[:Alpha]])
+ end
+ end,
+ })
+end
+
+return M
diff --git a/nvim/.config/nvim/lua/plugins/bufferline.lua b/nvim/.config/nvim/lua/tobyvin/plugins/bufferline.lua
index 1ec906b..1ec906b 100644
--- a/nvim/.config/nvim/lua/plugins/bufferline.lua
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/bufferline.lua
diff --git a/nvim/.config/nvim/lua/plugins/cmp.lua b/nvim/.config/nvim/lua/tobyvin/plugins/cmp.lua
index 7631da6..c998df3 100644
--- a/nvim/.config/nvim/lua/plugins/cmp.lua
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/cmp.lua
@@ -3,7 +3,7 @@ if not status_ok then
return
end
-enabled = function()
+local enabled = function()
local context = require("cmp.config.context")
if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then
@@ -54,6 +54,7 @@ cmp.setup({
nvim_lua = "[Lua]",
buffer = "[Buffer]",
path = "[Path]",
+ crates = "[Crates]",
},
}),
},
@@ -63,5 +64,6 @@ cmp.setup({
{ name = "path" },
{ name = "luasnip" },
{ name = "buffer", keyword_length = 1 },
+ { name = "crates" },
},
})
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins/colorbuddy.lua b/nvim/.config/nvim/lua/tobyvin/plugins/colorbuddy.lua
new file mode 100644
index 0000000..6cadfb2
--- /dev/null
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/colorbuddy.lua
@@ -0,0 +1,56 @@
+local M = {}
+
+M.setup = function()
+ local status_ok, colorbuddy = pcall(require, "colorbuddy")
+ if not status_ok then
+ vim.notify("Failed to load module 'colorbuddy'", "error")
+ return
+ end
+
+ vim.opt.termguicolors = true
+
+ colorbuddy.colorscheme("gruvbuddy")
+
+ local c = require("colorbuddy.color").colors
+ local Group = require("colorbuddy.group").Group
+ local g = require("colorbuddy.group").groups
+ local s = require("colorbuddy.style").styles
+
+ Group.new("GoTestSuccess", c.green, nil, s.bold)
+ Group.new("GoTestFail", c.red, nil, s.bold)
+
+ -- Group.new('Keyword', c.purple, nil, nil)
+
+ Group.new("TSPunctBracket", c.orange:light():light())
+
+ Group.new("StatuslineError1", c.red:light():light(), g.Statusline)
+ Group.new("StatuslineError2", c.red:light(), g.Statusline)
+ Group.new("StatuslineError3", c.red, g.Statusline)
+ Group.new("StatuslineError3", c.red:dark(), g.Statusline)
+ Group.new("StatuslineError3", c.red:dark():dark(), g.Statusline)
+
+ Group.new("pythonTSType", c.red)
+ Group.new("goTSType", g.Type.fg:dark(), nil, g.Type)
+
+ Group.new("typescriptTSConstructor", g.pythonTSType)
+ Group.new("typescriptTSProperty", c.blue)
+
+ -- vim.cmd [[highlight WinSeparator guifg=#4e545c guibg=None]]
+ Group.new("WinSeparator", nil, nil)
+
+ -- I don't think I like highlights for text
+ -- Group.new("LspReferenceText", nil, c.gray0:light(), s.bold)
+ -- Group.new("LspReferenceWrite", nil, c.gray0:light())
+
+ -- Group.new("TSKeyword", c.purple, nil, s.underline, c.blue)
+ -- Group.new("LuaFunctionCall", c.green, nil, s.underline + s.nocombine, g.TSKeyword.guisp)
+
+ -- Hello
+ Group.new("TSTitle", c.blue)
+end
+
+M.colors = function()
+ return require("colorbuddy.color").colors
+end
+
+return M
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins/dap.lua b/nvim/.config/nvim/lua/tobyvin/plugins/dap.lua
new file mode 100644
index 0000000..9b9a0c5
--- /dev/null
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/dap.lua
@@ -0,0 +1,113 @@
+local M = {}
+
+M.setup = function()
+ local status_ok, dap = pcall(require, "dap")
+ if not status_ok then
+ vim.notify("Failed to load module 'dap'", "error")
+ return
+ end
+
+ -- Debugpy
+ dap.adapters.python = {
+ type = "executable",
+ command = "python",
+ args = { "-m", "debugpy.adapter" },
+ }
+
+ dap.configurations.python = {
+ {
+ type = "python",
+ request = "launch",
+ name = "Launch file",
+ program = "${file}",
+ pythonPath = function()
+ local venv_path = vim.fn.getenv("VIRTUAL_ENVIRONMENT")
+ if venv_path ~= vim.NIL and venv_path ~= "" then
+ return venv_path .. "/bin/python"
+ else
+ return "/usr/bin/python"
+ end
+ end,
+ },
+ }
+
+ -- Neovim Lua
+ dap.adapters.nlua = function(callback, config)
+ callback({ type = "server", host = config.host, port = config.port })
+ end
+
+ dap.configurations.lua = {
+ {
+ type = "nlua",
+ request = "attach",
+ name = "Attach to running Neovim instance",
+ host = function()
+ local value = vim.fn.input("Host [127.0.0.1]: ")
+ if value ~= "" then
+ return value
+ end
+ return "127.0.0.1"
+ end,
+ port = function()
+ local val = tonumber(vim.fn.input("Port: "))
+ assert(val, "Please provide a port number")
+ return val
+ end,
+ },
+ }
+
+ -- lldb
+ dap.adapters.lldb = {
+ type = "executable",
+ command = "/usr/bin/lldb-vscode",
+ name = "lldb",
+ }
+
+ dap.configurations.cpp = {
+ {
+ name = "Launch",
+ type = "lldb",
+ request = "launch",
+ program = function()
+ return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
+ end,
+ cwd = "${workspaceFolder}",
+ stopOnEntry = false,
+ args = {},
+ runInTerminal = false,
+ },
+ }
+
+ dap.configurations.c = dap.configurations.cpp
+ -- dap.configurations.rust = dap.configurations.cpp
+
+ -- nnoremap <silent> <F5> <Cmd>lua require'dap'.continue()<CR>
+ -- nnoremap <silent> <F10> <Cmd>lua require'dap'.step_over()<CR>
+ -- nnoremap <silent> <F11> <Cmd>lua require'dap'.step_into()<CR>
+ -- nnoremap <silent> <F12> <Cmd>lua require'dap'.step_out()<CR>
+ -- nnoremap <silent> <Leader>b <Cmd>lua require'dap'.toggle_breakpoint()<CR>
+ -- nnoremap <silent> <Leader>B <Cmd>lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))<CR>
+ -- nnoremap <silent> <Leader>lp <Cmd>lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message: '))<CR>
+ -- nnoremap <silent> <Leader>dr <Cmd>lua require'dap'.repl.open()<CR>
+ -- nnoremap <silent> <Leader>dl <Cmd>lua require'dap'.run_last()<CR>
+
+ -- vim.api.nvim_create_user_command("Debug", dap.continue, { force = true })
+ -- vim.api.nvim_create_user_command("BreakpointToggle", dap.toggle_breakpoint, { force = true })
+ -- vim.api.nvim_create_user_command("BreakpointCond", function() dap.set_breakpoint(vim.fn.input("Breakpoint condition: ")) end, { force = true })
+ -- vim.api.nvim_create_user_command("BreakpointLog", function() dap.set_breakpoint(nil, nil, vim.fn.input('Log point message: ')) end, { force = true })
+ -- vim.api.nvim_create_user_command("REPL", dap.repl.open, { force = true })
+
+ -- require("which-key").register({
+ -- d = {
+ -- name = "DAP",
+ -- b = { , "Format" },
+ -- F = { M.toggle_auto_format, "Toggle Auto-Format" },
+ -- },
+ -- }, { prefix = "<leader>", buffer = 0 })
+
+ if not pcall(require, "telescope") then
+ require("telescope").load_extension("dap")
+ end
+end
+
+return M
diff --git a/nvim/.config/nvim/lua/plugins/git-blame.lua b/nvim/.config/nvim/lua/tobyvin/plugins/git-blame.lua
index 0e3a7ea..0e3a7ea 100644
--- a/nvim/.config/nvim/lua/plugins/git-blame.lua
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/git-blame.lua
diff --git a/nvim/.config/nvim/lua/plugins/git-worktree.lua b/nvim/.config/nvim/lua/tobyvin/plugins/git-worktree.lua
index 5064289..5064289 100644
--- a/nvim/.config/nvim/lua/plugins/git-worktree.lua
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/git-worktree.lua
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins/gitsigns.lua b/nvim/.config/nvim/lua/tobyvin/plugins/gitsigns.lua
new file mode 100644
index 0000000..f9c1ff6
--- /dev/null
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/gitsigns.lua
@@ -0,0 +1,34 @@
+local M = {}
+
+M.setup = function()
+ local status_ok, gitsigns = pcall(require, "gitsigns")
+ if not status_ok then
+ vim.notify("Failed to load module 'gitsigns'", "error")
+ return
+ end
+
+ local nmap = require("tobyvin.utils").create_map_group("n", "<leader>g", "Git")
+
+ gitsigns.setup({
+ signs = {
+ add = { text = "▎" },
+ change = { text = "▎" },
+ delete = { text = "契" },
+ topdelete = { text = "契" },
+ changedelete = { text = "▎" },
+ },
+ current_line_blame = true,
+ preview_config = { border = "rounded" },
+ on_attach = function()
+ nmap("j", gitsigns.next_hunk, { desc = "Next Hunk" })
+ nmap("k", gitsigns.prev_hunk, { desc = "Prev Hunk" })
+ nmap("p", gitsigns.preview_hunk, { desc = "Preview Hunk" })
+ nmap("r", gitsigns.reset_hunk, { desc = "Reset Hunk" })
+ nmap("R", gitsigns.reset_buffer, { desc = "Reset Buffer" })
+ nmap("s", gitsigns.stage_hunk, { desc = "Stage Hunk" })
+ nmap("u", gitsigns.undo_stage_hunk, { desc = "Undo Stage Hunk" })
+ end,
+ })
+end
+
+return M
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins/gruvbox-baby.lua b/nvim/.config/nvim/lua/tobyvin/plugins/gruvbox-baby.lua
new file mode 100644
index 0000000..e243e3b
--- /dev/null
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/gruvbox-baby.lua
@@ -0,0 +1,10 @@
+local M = {}
+
+M.setup = function()
+ vim.opt.background = "dark"
+ vim.g.gruvbox_baby_telescope_theme = 1
+ vim.g.gruvbox_baby_transparent_mode = 1
+ vim.cmd([[colorscheme gruvbox-baby]])
+end
+
+return M
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins/gruvbox-flat.lua b/nvim/.config/nvim/lua/tobyvin/plugins/gruvbox-flat.lua
new file mode 100644
index 0000000..8f9277a
--- /dev/null
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/gruvbox-flat.lua
@@ -0,0 +1,12 @@
+local M = {}
+
+M.setup = function()
+ vim.opt.background = "dark"
+ local colors = require("gruvbox.colors").setup()
+ vim.g.gruvbox_colors = { bg_statusline = colors.line_cursor }
+ vim.g.gruvbox_flat_style = "hard"
+ vim.g.gruvbox_transparent = true
+ vim.cmd([[colorscheme gruvbox-flat]])
+end
+
+return M
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins/lsp-signature.lua b/nvim/.config/nvim/lua/tobyvin/plugins/lsp-signature.lua
new file mode 100644
index 0000000..9db8900
--- /dev/null
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/lsp-signature.lua
@@ -0,0 +1,17 @@
+local M = {}
+
+M.setup = function()
+ local status_ok, lsp_signature = pcall(require, "lsp_signature")
+ if not status_ok then
+ return
+ end
+
+ lsp_signature.setup({
+ bind = true, -- This is mandatory, otherwise border config won't get registered.
+ handler_opts = {
+ border = "rounded",
+ },
+ })
+end
+
+return M
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins/lspconfig.lua b/nvim/.config/nvim/lua/tobyvin/plugins/lspconfig.lua
new file mode 100644
index 0000000..e6eb5e1
--- /dev/null
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/lspconfig.lua
@@ -0,0 +1,62 @@
+local lsp = require("tobyvin.lsp")
+local utils = require("tobyvin.utils")
+local M = {}
+
+M.setup = function()
+ require("nvim-lsp-installer").setup({})
+
+ local status_ok, lspconfig = pcall(require, "lspconfig")
+ if not status_ok then
+ vim.notify("Failed to load module 'lspconfig'", "error")
+ return
+ end
+
+ lspconfig.tsserver.setup(lsp.config())
+
+ lspconfig.ccls.setup(lsp.config())
+
+ lspconfig.gopls.setup(lsp.config({
+ cmd = { "gopls", "serve" },
+ settings = {
+ gopls = {
+ analyses = {
+ unusedparams = true,
+ },
+ staticcheck = true,
+ },
+ },
+ }))
+
+ lspconfig.ltex.setup(lsp.config())
+
+ lspconfig.texlab.setup(lsp.config({
+ settings = {
+ texlab = {
+ build = {
+ onSave = true,
+ },
+ chktex = {
+ onEdit = true,
+ onOpenAndSave = true,
+ },
+ },
+ },
+ on_attach = function(client, bufnr)
+ vim.b.tex_flavor = "latex"
+ lsp.on_attach(client, bufnr)
+ end,
+ }))
+
+ require("lsp_signature").setup({
+ bind = true,
+ handler_opts = {
+ border = "rounded",
+ },
+ })
+
+ local nmap = utils.create_map_group("n", "<leader>l", "LSP")
+ nmap("<leader>li", "<cmd>LspInfo<cr>", { desc = "LSP info" })
+ nmap("<leader>lI", "<cmd>LspInstallInfo<cr>", { desc = "LSP installer info" })
+end
+
+return M
diff --git a/nvim/.config/nvim/lua/plugins/lspkind.lua b/nvim/.config/nvim/lua/tobyvin/plugins/lspkind.lua
index 8aac636..8aac636 100644
--- a/nvim/.config/nvim/lua/plugins/lspkind.lua
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/lspkind.lua
diff --git a/nvim/.config/nvim/lua/plugins/lspstatus.lua b/nvim/.config/nvim/lua/tobyvin/plugins/lspstatus.lua
index 0afd134..0afd134 100644
--- a/nvim/.config/nvim/lua/plugins/lspstatus.lua
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/lspstatus.lua
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins/lua-dev.lua b/nvim/.config/nvim/lua/tobyvin/plugins/lua-dev.lua
new file mode 100644
index 0000000..37e7df1
--- /dev/null
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/lua-dev.lua
@@ -0,0 +1,30 @@
+local M = {}
+
+M.setup = function()
+ local status_ok, lua_dev = pcall(require, "lua-dev")
+ if not status_ok then
+ vim.notify("Failed to load module 'lua-dev'", "error")
+ return
+ end
+
+ local lsp = require("tobyvin.lsp")
+ local lspconfig = require("lspconfig")
+
+ lspconfig.sumneko_lua.setup(lua_dev.setup({
+ runtime_path = true,
+ lspconfig = lsp.config({
+ settings = {
+ Lua = {
+ format = {
+ enable = false,
+ },
+ telemetry = {
+ enable = false,
+ },
+ },
+ },
+ }),
+ }))
+end
+
+return M
diff --git a/nvim/.config/nvim/lua/plugins/lualine.lua b/nvim/.config/nvim/lua/tobyvin/plugins/lualine.lua
index 369ccf6..f94d1f8 100644
--- a/nvim/.config/nvim/lua/plugins/lualine.lua
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/lualine.lua
@@ -9,11 +9,7 @@ end
local nvim_gps = function()
local status_gps_ok, gps = pcall(require, "nvim-gps")
- if not status_gps_ok then
- return
- end
- local gps_location = gps.get_location()
- if gps_location == "error" then
+ if not status_gps_ok or gps.get_location() == "error" then
return ""
else
return gps.get_location()
@@ -25,7 +21,6 @@ local hide_in_width = function()
end
lualine.setup({
-
options = {
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins/luasnip.lua b/nvim/.config/nvim/lua/tobyvin/plugins/luasnip.lua
new file mode 100644
index 0000000..b1dd30e
--- /dev/null
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/luasnip.lua
@@ -0,0 +1,24 @@
+local M = {}
+
+M.setup = function()
+ local status_ok, luasnip = pcall(require, "luasnip")
+ if not status_ok then
+ return
+ end
+
+ luasnip.config.set_config({
+ history = true,
+ updateevents = "TextChanged,TextChangedI",
+ })
+
+ luasnip.snippets = { all = {}, html = {} }
+
+ luasnip.snippets.javascript = luasnip.snippets.html
+ luasnip.snippets.javascriptreact = luasnip.snippets.html
+ luasnip.snippets.typescriptreact = luasnip.snippets.html
+ require("luasnip.loaders.from_vscode").load({ include = { "html" } })
+
+ require("luasnip.loaders.from_vscode").lazy_load()
+end
+
+return M
diff --git a/nvim/.config/nvim/lua/plugins/neo-tree.lua b/nvim/.config/nvim/lua/tobyvin/plugins/neo-tree.lua
index 37512d9..37512d9 100644
--- a/nvim/.config/nvim/lua/plugins/neo-tree.lua
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/neo-tree.lua
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins/neoclip.lua b/nvim/.config/nvim/lua/tobyvin/plugins/neoclip.lua
new file mode 100644
index 0000000..0d36846
--- /dev/null
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/neoclip.lua
@@ -0,0 +1,17 @@
+local M = {}
+
+M.setup = function()
+ local status_ok, neoclip = pcall(require, "neoclip")
+ if not status_ok then
+ vim.notify("Failed to load module 'neoclip'", "error")
+ return
+ end
+
+ neoclip.setup({
+ continuous_sync = false,
+ enable_persistent_history = false,
+ })
+
+end
+
+return M
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins/neogen.lua b/nvim/.config/nvim/lua/tobyvin/plugins/neogen.lua
new file mode 100644
index 0000000..78416e0
--- /dev/null
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/neogen.lua
@@ -0,0 +1,17 @@
+local M = {}
+
+M.setup = function()
+ local status_ok, neogen = pcall(require, "neogen")
+ if not status_ok then
+ vim.notify("Failed to load module 'neogen'", "error")
+ return
+ end
+
+ local nmap = require("tobyvin.utils").create_map_group("n", "<leader>s", "Snippets")
+
+ neogen.setup({ snippet_engine = "luasnip" })
+
+ nmap("d", neogen.generate)
+end
+
+return M
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins/neogit.lua b/nvim/.config/nvim/lua/tobyvin/plugins/neogit.lua
new file mode 100644
index 0000000..1c6c49b
--- /dev/null
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/neogit.lua
@@ -0,0 +1,18 @@
+local utils = require("tobyvin.utils")
+local M = {}
+
+M.setup = function()
+ local status_ok, neogit = pcall(require, "neogit")
+ if not status_ok then
+ vim.notify("Failed to load module 'neogit'", "error")
+ return
+ end
+
+ neogit.setup({ disable_commit_confirmation = true, disable_signs = true })
+
+ vim.notify("Loading neogit")
+ local nmap = utils.create_map_group("n", "<leader>g", "git")
+ nmap("g", neogit.open, { desc = "Neogit" })
+end
+
+return M
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins/notify.lua b/nvim/.config/nvim/lua/tobyvin/plugins/notify.lua
new file mode 100644
index 0000000..e3b1163
--- /dev/null
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/notify.lua
@@ -0,0 +1,17 @@
+local M = {}
+
+M.setup = function()
+ local status_ok, notify = pcall(require, "notify")
+ if not status_ok then
+ vim.notify("Failed to load module 'notify'", "error")
+ return
+ end
+
+ notify.setup({
+ background_colour = "#" .. vim.api.nvim_get_hl_by_name("Pmenu", "rgb").background,
+ })
+
+ vim.notify = notify
+end
+
+return M
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins/null-ls.lua b/nvim/.config/nvim/lua/tobyvin/plugins/null-ls.lua
new file mode 100644
index 0000000..efcd723
--- /dev/null
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/null-ls.lua
@@ -0,0 +1,37 @@
+local M = {}
+
+M.setup = function()
+ local status_ok, null_ls = pcall(require, "null-ls")
+ if not status_ok then
+ vim.notify("Failed to load module 'null-ls'", "error")
+ return
+ end
+
+ local code_actions = null_ls.builtins.code_actions
+ local diagnostics = null_ls.builtins.diagnostics
+ local formatting = null_ls.builtins.formatting
+
+ null_ls.setup({
+ sources = {
+
+ -- Code Actions
+ code_actions.gitsigns,
+ code_actions.shellcheck,
+
+ -- Diagnostics
+ diagnostics.markdownlint,
+ -- diagnostics.luacheck,
+ diagnostics.shellcheck,
+
+ -- Formatting
+ formatting.prettier,
+ formatting.black,
+ formatting.latexindent,
+ formatting.markdownlint,
+ formatting.stylua,
+ formatting.shfmt,
+ },
+ })
+end
+
+return M
diff --git a/nvim/.config/nvim/lua/plugins/nvim-tree.lua b/nvim/.config/nvim/lua/tobyvin/plugins/nvim-tree.lua
index 8b4bf89..8b4bf89 100644
--- a/nvim/.config/nvim/lua/plugins/nvim-tree.lua
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/nvim-tree.lua
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins/refactoring.lua b/nvim/.config/nvim/lua/tobyvin/plugins/refactoring.lua
new file mode 100644
index 0000000..70f3ad9
--- /dev/null
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/refactoring.lua
@@ -0,0 +1,39 @@
+local utils = require("tobyvin.utils")
+local M = {}
+
+M.setup = function()
+ local status_ok, refactoring = pcall(require, "refactoring")
+ if not status_ok then
+ vim.notify("Failed to load module 'refactoring'", "error")
+ return
+ end
+
+ refactoring.setup()
+
+ local nmap = utils.create_map_group("n", "<leader>r", "Refactor")
+ nmap("b", function()
+ refactoring.refactor("Extract Block")
+ end, { desc = "Extract Block" })
+ nmap("B", function()
+ refactoring.refactor("Extract Block To File")
+ end, { desc = "Extract Block To File" })
+ nmap("i", function()
+ refactoring.refactor("Inline Variable")
+ end, { desc = "Inline Variable" })
+
+ local vmap = utils.create_map_group("v", "<leader>r", "Refactor")
+ vmap("e", function()
+ refactoring.refactor("Extract Function")
+ end, { desc = "Extract Function" })
+ vmap("f", function()
+ refactoring.refactor("Extract Function To File")
+ end, { desc = "Extract Function To File" })
+ vmap("v", function()
+ refactoring.refactor("Extract Variable")
+ end, { desc = "Extract Variable" })
+ vmap("i", function()
+ refactoring.refactor("Inline Variable")
+ end, { desc = "Inline Variable" })
+end
+
+return M
diff --git a/nvim/.config/nvim/lua/plugins/renamer.lua b/nvim/.config/nvim/lua/tobyvin/plugins/renamer.lua
index 89d67d7..89d67d7 100644
--- a/nvim/.config/nvim/lua/plugins/renamer.lua
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/renamer.lua
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins/rust-tools.lua b/nvim/.config/nvim/lua/tobyvin/plugins/rust-tools.lua
new file mode 100644
index 0000000..3178e75
--- /dev/null
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/rust-tools.lua
@@ -0,0 +1,60 @@
+local M = {}
+
+M._dap_adapter = function()
+ local ext_path = vim.env.HOME .. "/usr/lib/codelldb/"
+ local codelldb_path = ext_path .. "adapter/codelldb"
+ local liblldb_path = ext_path .. "lldb/lib/liblldb.so"
+
+ if not require("tobyvin.utils").isdir(ext_path) then
+ vim.notify(
+ "[DAP] Failed to find codelldb, falling back to default DAP adapter.",
+ "warn",
+ { title = "[rust-tools] codelldb not found" }
+ )
+ return {}
+ end
+
+ return {
+ adapter = require("rust-tools.dap").get_codelldb_adapter(codelldb_path, liblldb_path),
+ }
+end
+
+M.setup = function()
+ local status_ok, rust_tools = pcall(require, "rust-tools")
+ if not status_ok then
+ vim.notify("Failed to load module 'rust-tools'", "error")
+ return
+ end
+
+ local lsp = require("tobyvin.lsp")
+
+ rust_tools.setup({
+ tools = {
+ autoSetHints = true,
+ hover_with_actions = true,
+ runnables = {
+ use_telescope = true,
+ },
+ inlay_hints = {
+ show_parameter_hints = true,
+ parameter_hints_prefix = "",
+ other_hints_prefix = "",
+ },
+ },
+ server = lsp.config({
+ settings = {
+ ["rust-analyzer"] = {
+ cargo = {
+ allFeatures = true,
+ },
+ checkOnSave = {
+ command = "clippy",
+ },
+ },
+ },
+ }),
+ dap = M._dap_adapter(),
+ })
+end
+
+return M
diff --git a/nvim/.config/nvim/lua/plugins/session-lens.lua b/nvim/.config/nvim/lua/tobyvin/plugins/session-lens.lua
index cfdfe95..cfdfe95 100644
--- a/nvim/.config/nvim/lua/plugins/session-lens.lua
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/session-lens.lua
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins/telescope.lua b/nvim/.config/nvim/lua/tobyvin/plugins/telescope.lua
new file mode 100644
index 0000000..c64a6b9
--- /dev/null
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/telescope.lua
@@ -0,0 +1,113 @@
+local M = {}
+
+M.setup = function()
+ local status_ok, telescope = pcall(require, "telescope")
+ if not status_ok then
+ vim.notify("Failed to load module 'telescope'", "error")
+ return
+ end
+
+ local actions = require("telescope.actions")
+
+ telescope.setup({
+ defaults = {
+ mappings = {
+ i = {
+ ["<esc>"] = actions.close,
+ ["<C-h>"] = "which_key",
+ },
+ },
+ vimgrep_arguments = {
+ "rg",
+ "--color=never",
+ "--no-heading",
+ "--with-filename",
+ "--line-number",
+ "--column",
+ "--hidden",
+ "--smart-case",
+ "--trim",
+ "-u",
+ },
+ layout_strategy = "flex",
+ scroll_strategy = "cycle",
+ history = {
+ path = vim.fn.stdpath("data") .. "/databases/telescope_history.sqlite3",
+ limit = 100,
+ },
+ },
+ pickers = {
+ find_files = {
+ theme = "dropdown",
+ find_command = { "fd", "--type", "f", "--hidden", "--strip-cwd-prefix" },
+ },
+ live_grep = { theme = "ivy" },
+ lsp_references = { theme = "dropdown" },
+ lsp_code_actions = { theme = "dropdown" },
+ lsp_definitions = { theme = "dropdown" },
+ lsp_implementations = { theme = "dropdown" },
+ buffers = {
+ show_all_buffers = true,
+ sort_lastused = true,
+ },
+ },
+ extensions = {
+ frecency = {
+ default_workspace = "CWD",
+ workspaces = {
+ ["src"] = "~/src",
+ },
+ theme = "dropdown",
+ },
+ },
+ })
+
+ -- Extensions
+ telescope.load_extension("smart_history")
+ telescope.load_extension("fzf")
+ telescope.load_extension("frecency")
+ telescope.load_extension("packer")
+ telescope.load_extension("gh")
+
+ local builtins = require("telescope.builtin")
+
+ local nmap_find = require("tobyvin.utils").create_map_group("n", "<leader>f", "Find")
+ nmap_find("b", builtins.buffers, { desc = "Buffers" })
+ nmap_find("C", builtins.commands, { desc = "Commands" })
+ nmap_find("f", builtins.find_files, { desc = "Find files" })
+ nmap_find("g", builtins.live_grep, { desc = "Find Text" })
+ nmap_find("h", builtins.help_tags, { desc = "Help" })
+ nmap_find("k", builtins.keymaps, { desc = "Keymaps" })
+ nmap_find("l", builtins.resume, { desc = "Last Search" })
+ nmap_find("m", builtins.man_pages, { desc = "Man Pages" })
+ nmap_find("r", builtins.oldfiles, { desc = "Recent File" })
+ nmap_find("R", builtins.registers, { desc = "Registers" })
+ nmap_find("t", builtins.colorscheme, { desc = "Colorscheme" })
+ nmap_find("e", telescope.extensions.frecency.frecency, { desc = "Frecency" })
+ nmap_find("p", telescope.extensions.packer.packer, { desc = "Packer" })
+
+ local nmap_git = require("tobyvin.utils").create_map_group("n", "<leader>g", "Git")
+ nmap_git("b", builtins.git_branches, { desc = "Checkout branch" })
+ nmap_git("c", builtins.git_commits, { desc = "Checkout commit" })
+ nmap_git("o", builtins.git_status, { desc = "Open changed file" })
+
+ local nmap_git_wt = require("tobyvin.utils").create_map_group("n", "<leader>gw", "Worktree")
+ nmap_git_wt("s", telescope.extensions.git_worktree.git_worktrees, { desc = "Switch worktree" })
+ nmap_git_wt("c", telescope.extensions.git_worktree.create_git_worktree, { desc = "Create worktree" })
+
+ local nmap_git_gh = require("tobyvin.utils").create_map_group("n", "<leader>gG", "Github")
+ nmap_git_gh("i", telescope.extensions.gh.issues, { desc = "Issues" })
+ nmap_git_gh("p", telescope.extensions.gh.pull_request, { desc = "Pull request" })
+ nmap_git_gh("g", telescope.extensions.gh.gist, { desc = "Gist" })
+ nmap_git_gh("r", telescope.extensions.gh.run, { desc = "Run" })
+end
+
+M.project_files = function()
+ local opts = {} -- define here if you want to define something
+ local ok = pcall(require("telescope.builtin").git_files, opts)
+ if not ok then
+ require("telescope.builtin").find_files(opts)
+ end
+end
+
+return M
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins/treesitter.lua b/nvim/.config/nvim/lua/tobyvin/plugins/treesitter.lua
new file mode 100644
index 0000000..9908bcc
--- /dev/null
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/treesitter.lua
@@ -0,0 +1,40 @@
+local M = {}
+
+M.setup = function()
+ local status_ok, treesitter = pcall(require, "nvim-treesitter.configs")
+ if not status_ok then
+ vim.notify("Failed to load module 'nvim-treesitter'", "error")
+ return
+ end
+
+ treesitter.setup({
+ ensure_installed = { "c", "lua", "rust", "latex" },
+ indent = {
+ enable = true,
+ },
+ highlight = {
+ enable = true,
+ additional_vim_regex_highlighting = false,
+ },
+ refactor = {
+ highlight_definitions = {
+ enable = true,
+ clear_on_cursor_move = true,
+ },
+ },
+ textobjects = {
+ select = {
+ enable = true,
+ lookahead = true,
+ keymaps = {
+ ["af"] = "@function.outer",
+ ["if"] = "@function.inner",
+ ["ac"] = "@class.outer",
+ ["ic"] = "@class.inner",
+ },
+ },
+ },
+ })
+end
+
+return M
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins/which-key.lua b/nvim/.config/nvim/lua/tobyvin/plugins/which-key.lua
new file mode 100644
index 0000000..2f75f01
--- /dev/null
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/which-key.lua
@@ -0,0 +1,26 @@
+local M = {}
+
+M.setup = function()
+ local status_ok, which_key = pcall(require, "which-key")
+ if not status_ok then
+ vim.notify("Failed to load module 'which-key'", "error")
+ return
+ end
+
+vim.opt.timeoutlen = 1500
+ which_key.setup({
+ plugins = {
+ spelling = {
+ enabled = true,
+ },
+ },
+ window = {
+ border = "rounded",
+ },
+ layout = {
+ align = "center",
+ },
+ })
+end
+
+return M
diff --git a/nvim/.config/nvim/lua/tobyvin/utils.lua b/nvim/.config/nvim/lua/tobyvin/utils.lua
new file mode 100644
index 0000000..b55a8b6
--- /dev/null
+++ b/nvim/.config/nvim/lua/tobyvin/utils.lua
@@ -0,0 +1,70 @@
+local M = {}
+
+M.create_map_group = function(mode, prefix, name, g_opts)
+ g_opts = g_opts or {}
+
+ local status_ok, which_key = pcall(require, "which-key")
+ if status_ok then
+ which_key.register({ [prefix] = { name = name } }, vim.tbl_extend("force", { mode = mode }, g_opts))
+ end
+
+ return function(lhs, rhs, opts)
+ vim.keymap.set(mode, prefix .. lhs, rhs, vim.tbl_deep_extend("force", g_opts, opts or {}))
+ end
+end
+
+-- TODO: add autocommand/keymap to reload current open file/module
+M.reload = function(name)
+ local status_ok, plenary_reload = pcall(require, "plenary.reload")
+ if status_ok then
+ plenary_reload.reload_module(name)
+ vim.notify("[utils.reload] '" .. name .. "' reloaded", "info", { title = "[utils] Reload" })
+ end
+
+ require(name)
+end
+
+M.popup = function(file_path)
+ local buf = vim.api.nvim_create_buf(false, true)
+
+ vim.api.nvim_buf_set_option(buf, "bufhidden", "wipe")
+
+ local width = vim.api.nvim_get_option("columns")
+ local height = vim.api.nvim_get_option("lines")
+
+ local win_height = math.ceil(height * 0.8 - 4)
+ local win_width = math.ceil(width * 0.8)
+
+ local row = math.ceil((height - win_height) / 2 - 1)
+ local col = math.ceil((width - win_width) / 2)
+
+ local opts = {
+ style = "minimal",
+ relative = "editor",
+ width = win_width,
+ height = win_height,
+ row = row,
+ col = col,
+ border = "rounded",
+ }
+
+ local win = vim.api.nvim_open_win(buf, true, opts)
+ vim.api.nvim_win_set_option(win, "cursorline", true)
+ vim.api.nvim_buf_set_option(buf, "modifiable", true)
+ vim.api.nvim_command("$read" .. file_path)
+ vim.api.nvim_buf_set_option(0, "modifiable", false)
+end
+
+M.file_exists = function(file)
+ local ok, err, code = os.rename(file, file)
+ if not ok and code == 13 then
+ return true
+ end
+ return ok, err
+end
+
+M.isdir = function(path)
+ return M.file_exists(path .. "/")
+end
+
+return M
diff --git a/nvim/.config/nvim/lua/utils.lua b/nvim/.config/nvim/lua/utils.lua
deleted file mode 100644
index bc733de..0000000
--- a/nvim/.config/nvim/lua/utils.lua
+++ /dev/null
@@ -1,11 +0,0 @@
-local M = {}
-
-function M.map(mode, lhs, rhs, opts)
- local options = { noremap = true }
- if opts then
- options = vim.tbl_extend("force", options, opts)
- end
- vim.api.nvim_set_keymap(mode, lhs, rhs, options)
-end
-
-return M