diff --git a/doc/smoketest.md b/doc/smoketest.md new file mode 100644 index 00000000000..b485602d4dc --- /dev/null +++ b/doc/smoketest.md @@ -0,0 +1,72 @@ +# Smoketest + +A manual smoketest checklist to ensure features are working: + +## Plugins +### Default +- [ ] Whichkey groups should have accurate keybindings + - c -> LSP: [C]ode + - g -> [G]it + - n -> [N]otepad + - r -> [R]e[N]ame + - s -> [S]earch + - t -> [T]oggle + +### Kickstart +Kickstart plugins *that are enabled* should be working +- [ ] Autopairs + - Brackets, parenthesis, etc, should automatically close +- [ ] Git Signs + - `ghs` should stage a hunk of changes + - `ghr` should reset a hunk of changes + - `ghS` should stage a buffer of changes + - `ghR` should reset a buffer of changes + - `ghp` should preview changes in a git hunk + - `gb` should show the git blame line + - `gd` should show the git diff since the index + - `gD` should show the git diff since the last commit +- [ ] IndentLine + - Should see visual indentation guides for indented lines + +### Custom +Custom plugins should be working +- [ ] Oil + - Shortcut `-` should open Oil +- [ ] Snacks + - Should load dashboard at start, and `=` should open dashboard + - `gr` should open the remote git repository in a browser + - `gl` should open lazy git + - `no` should open a scratchpad + - `ns` browses existing notes in scratchpad + - `` should open a terminal +- [ ] VimTmuxNavigator + - Should be able to navigate between nvim and tmux panes using ``, ``, ``, `` for each respective direction +- [ ] Remote SSHFS + - Should be able to remotely access a directory using the `:RemoteSSHFSConnect` command +- [ ] Guttermarks + - Marks (place a mark with `m`) should be displayed in the gutter by their character + +### Themes +- [ ] Catppuccin Theme +- [ ] Rose Pine Theme + +## Settings +- [ ] Nerd fonts should be enabled +- [ ] Line numbers should be relative +- [ ] Virtual Diagnostic Lines (errors/warnings) should be beneath the applicable line +- [ ] Arrow key navigation should be disabled +- [ ] Should connect to godot server when running +- [ ] Files should format on save + +## LSP + +- [ ] LSP, autocomplete, and formatting should work for the following file types + - Javascript `.js`, `.jsx` + - Typescript `.ts`, `.tsx` + - Svelte `.svelte` + - C# `.cs` + - Lua `.lua` +- [ ] Mason should ensure that the following tools are installed + - Clangd + - Pyright + - Omnisharp diff --git a/init.lua b/init.lua index aff5250e921..92fd34900da 100644 --- a/init.lua +++ b/init.lua @@ -99,7 +99,7 @@ do vim.g.maplocalleader = ' ' -- Set to true if you have a Nerd Font installed and selected in the terminal - vim.g.have_nerd_font = false + vim.g.have_nerd_font = true -- [[ Setting options ]] -- See `:help vim.o` @@ -110,7 +110,10 @@ do vim.o.number = true -- You can also add relative line numbers, to help with jumping. -- Experiment for yourself to see if you like it! - -- vim.o.relativenumber = true + vim.o.relativenumber = true + + -- Set to nowrap //TODO: can this be in a separate file than the init.lua to avoid conflicts with upstream? + vim.o.wrap = false -- Enable mouse mode, can be useful for resizing splits for example! vim.o.mouse = 'a' @@ -194,8 +197,8 @@ do underline = { severity = { min = vim.diagnostic.severity.WARN } }, -- Can switch between these as you prefer - virtual_text = true, -- Text shows up at the end of the line - virtual_lines = false, -- Text shows up underneath the line, with virtual lines + virtual_text = false, -- Text shows up at the end of the line + virtual_lines = true, -- Text shows up underneath the line, with virtual lines -- Auto open the float, so you can easily read the errors when jumping with `[d` and `]d` jump = { @@ -220,10 +223,10 @@ do vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) -- TIP: Disable arrow keys in normal mode - -- vim.keymap.set('n', '', 'echo "Use h to move!!"') - -- vim.keymap.set('n', '', 'echo "Use l to move!!"') - -- vim.keymap.set('n', '', 'echo "Use k to move!!"') - -- vim.keymap.set('n', '', 'echo "Use j to move!!"') + vim.keymap.set('n', '', 'echo "Use h to move!!"') + vim.keymap.set('n', '', 'echo "Use l to move!!"') + vim.keymap.set('n', '', 'echo "Use k to move!!"') + vim.keymap.set('n', '', 'echo "Use j to move!!"') -- Keybinds to make split navigation easier. -- Use CTRL+ to switch between windows @@ -371,8 +374,13 @@ do spec = { { 's', group = '[S]earch', mode = { 'n', 'v' } }, { 't', group = '[T]oggle' }, - { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, -- Enable gitsigns recommended keymaps first - { 'gr', group = 'LSP Actions', mode = { 'n' } }, + { 'g', group = '[G]it' }, + { 'gh', group = '[G]it [H]unk', mode = { 'n', 'v' } }, -- Enable gitsigns recommended keymaps first + { 'gt', group = '[G]it [T]oggle', mode = { 'n', 'v' } }, -- Enable gitsigns recommended keymaps first + { 'n', group = '[N]otepad' }, + { 'r', group = '[R]e[N]ame', mode = { 'n' } }, + { 'c', group = 'LSP: [C]ode', mode = { 'n' } }, + { 'cg', group = 'LSP: [G]oto', mode = { 'n' } }, }, } @@ -390,10 +398,13 @@ do }, } + vim.pack.add { gh 'catppuccin/nvim' } + vim.pack.add { gh 'rose-pine/neovim' } + -- Load the colorscheme here. -- Like many other themes, this one has different styles, and you could load -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. - vim.cmd.colorscheme 'tokyonight-night' + vim.cmd.colorscheme 'rose-pine' -- Highlight todo, notes, etc in comments vim.pack.add { gh 'folke/todo-comments.nvim' } @@ -416,6 +427,7 @@ do -- - va) - [V]isually select [A]round [)]paren -- - yiiq - [Y]ank [I]nside [I]+1 [Q]uote -- - ci' - [C]hange [I]nside [']quote + --FIX: mini.ai does not seem to be working correctly. Conflicts? require('mini.ai').setup { -- NOTE: Avoid conflicts with the built-in incremental selection mappings on Neovim>=0.12 (see `:help treesitter-incremental-selection`) mappings = { @@ -430,6 +442,7 @@ do -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren -- - sd' - [S]urround [D]elete [']quotes -- - sr)' - [S]urround [R]eplace [)] ['] + --FIX: mini.surround does not seem to be working correctly. Conflicts? require('mini.surround').setup() -- Simple and easy statusline. @@ -531,29 +544,29 @@ do local buf = event.buf -- Find references for the word under your cursor. - vim.keymap.set('n', 'grr', builtin.lsp_references, { buffer = buf, desc = '[G]oto [R]eferences' }) + vim.keymap.set('n', 'cgr', builtin.lsp_references, { buffer = buf, desc = '[G]oto [R]eferences' }) -- Jump to the implementation of the word under your cursor. -- Useful when your language has ways of declaring types without an actual implementation. - vim.keymap.set('n', 'gri', builtin.lsp_implementations, { buffer = buf, desc = '[G]oto [I]mplementation' }) + vim.keymap.set('n', 'cgi', builtin.lsp_implementations, { buffer = buf, desc = '[G]oto [I]mplementation' }) -- Jump to the definition of the word under your cursor. -- This is where a variable was first declared, or where a function is defined, etc. -- To jump back, press . - vim.keymap.set('n', 'grd', builtin.lsp_definitions, { buffer = buf, desc = '[G]oto [D]efinition' }) + vim.keymap.set('n', 'cgd', builtin.lsp_definitions, { buffer = buf, desc = '[G]oto [D]efinition' }) -- Fuzzy find all the symbols in your current document. -- Symbols are things like variables, functions, types, etc. - vim.keymap.set('n', 'gO', builtin.lsp_document_symbols, { buffer = buf, desc = 'Open Document Symbols' }) + vim.keymap.set('n', 'cgO', builtin.lsp_document_symbols, { buffer = buf, desc = 'Open Document Symbols' }) -- Fuzzy find all the symbols in your current workspace. -- Similar to document symbols, except searches over your entire project. - vim.keymap.set('n', 'gW', builtin.lsp_dynamic_workspace_symbols, { buffer = buf, desc = 'Open Workspace Symbols' }) + vim.keymap.set('n', 'cgW', builtin.lsp_dynamic_workspace_symbols, { buffer = buf, desc = 'Open Workspace Symbols' }) -- Jump to the type of the word under your cursor. -- Useful when you're not sure what type a variable is and you want to see -- the definition of its *type*, not where it was *defined*. - vim.keymap.set('n', 'grt', builtin.lsp_type_definitions, { buffer = buf, desc = '[G]oto [T]ype Definition' }) + vim.keymap.set('n', 'cgt', builtin.lsp_type_definitions, { buffer = buf, desc = '[G]oto [T]ype Definition' }) end, }) @@ -638,15 +651,15 @@ do -- Rename the variable under your cursor. -- Most Language Servers support renaming across files, etc. - map('grn', vim.lsp.buf.rename, '[R]e[n]ame') - + map('rn', vim.lsp.buf.rename, '[R]e[n]ame') -- Execute a code action, usually your cursor needs to be on top of an error + -- or a suggestion from your LSP for this to activate. - map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' }) + map('ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' }) -- WARN: This is not Goto Definition, this is Goto Declaration. -- For example, in C this would take you to the header. - map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + map('cgD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') -- The following two autocommands are used to highlight references of the -- word under your cursor when your cursor rests there for a little while. @@ -692,9 +705,9 @@ do -- See `:help lsp-config` for information about keys and how to configure ---@type table local servers = { - -- clangd = {}, + clangd = {}, -- gopls = {}, - -- pyright = {}, + pyright = {}, -- rust_analyzer = {}, -- -- Some languages (like typescript) have entire language plugins that can be useful: @@ -703,6 +716,8 @@ do -- But for many setups, the LSP (`ts_ls`) will work just fine -- ts_ls = {}, + omnisharp = {}, -- Used to format C# code + stylua = {}, -- Used to format Lua code -- Special Lua Config, as recommended by neovim help docs @@ -760,6 +775,9 @@ do local ensure_installed = vim.tbl_keys(servers or {}) vim.list_extend(ensure_installed, { -- You can add other tools here that you want Mason to install + 'clangd', + 'pyright', + 'omnisharp', }) require('mason-tool-installer').setup { ensure_installed = ensure_installed } @@ -782,8 +800,13 @@ do format_on_save = function(bufnr) -- You can specify filetypes to autoformat on save here: local enabled_filetypes = { - -- lua = true, - -- python = true, + lua = true, + javascript = true, + typescript = true, + typescriptreact = true, + cs = true, + --TODO: not getting any lsp completion for svelte files + svelte = true, } if enabled_filetypes[vim.bo[bufnr].filetype] then return { timeout_ms = 500 } @@ -802,6 +825,11 @@ do -- -- You can use 'stop_after_first' to run the first available formatter from the list -- javascript = { "prettierd", "prettier", stop_after_first = true }, + json = { 'prettierd', 'prettier', stop_after_first = true }, + javascript = { 'prettierd', 'prettier', stop_after_first = true }, + typescript = { 'prettierd', 'prettier', stop_after_first = true }, + typescriptreact = { 'prettierd', 'prettier', stop_after_first = true }, + svelte = { 'prettierd', 'prettier', stop_after_first = true }, }, } @@ -967,17 +995,23 @@ do -- Uncomment any of the lines below to enable them (you will need to restart nvim). -- -- require 'kickstart.plugins.debug' - -- require 'kickstart.plugins.indent_line' + require 'kickstart.plugins.indent_line' -- require 'kickstart.plugins.lint' - -- require 'kickstart.plugins.autopairs' + require 'kickstart.plugins.autopairs' -- require 'kickstart.plugins.neo-tree' - -- require 'kickstart.plugins.gitsigns' -- adds gitsigns recommended keymaps + require 'kickstart.plugins.gitsigns' -- adds gitsigns recommended keymaps -- NOTE: You can add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- require 'custom.plugins' + require 'custom.plugins' end +-- FIX: godot-server: should check if the server is already running first... +local gdprojectfilepath = vim.fn.getcwd() .. '/project.godot' +local isInGdDirectory = vim.fn.filereadable(gdprojectfilepath) == 1 + +if isInGdDirectory then vim.fn.serverstart '127.0.0.1:55432' end + -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et diff --git a/lua/custom/plugins/guttermarks.lua b/lua/custom/plugins/guttermarks.lua new file mode 100644 index 00000000000..8fa1d3d6d22 --- /dev/null +++ b/lua/custom/plugins/guttermarks.lua @@ -0,0 +1 @@ +vim.pack.add { "https://github.com/dimtion/guttermarks.nvim" } diff --git a/lua/custom/plugins/mini.lua b/lua/custom/plugins/mini.lua new file mode 100644 index 00000000000..061127a8321 --- /dev/null +++ b/lua/custom/plugins/mini.lua @@ -0,0 +1,9 @@ +require('mini.git').setup() + +vim.keymap.set('n', 'ga', 'Git add -A', { desc = 'Git add all' }) +vim.keymap.set('n', 'gc', 'Git commit', { desc = 'Git commit' }) +vim.keymap.set('n', 'gs', 'Git status', { desc = 'Git status' }) +vim.keymap.set('n', 'gg', 'Git log --graph --oneline --all', { desc = 'Git graph' }) + +require('mini.move').setup() +-- usage: Alt = directional keys should move the line in normal mode diff --git a/lua/custom/plugins/oil.lua b/lua/custom/plugins/oil.lua new file mode 100644 index 00000000000..016895d26f6 --- /dev/null +++ b/lua/custom/plugins/oil.lua @@ -0,0 +1,4 @@ +vim.pack.add { 'https://github.com/stevearc/oil.nvim' } +require('oil').setup { + vim.keymap.set('n', '-', 'Oil', { desc = 'Open parent directory' }), +} diff --git a/lua/custom/plugins/remote-sshfs.lua b/lua/custom/plugins/remote-sshfs.lua new file mode 100644 index 00000000000..60abac3cbe3 --- /dev/null +++ b/lua/custom/plugins/remote-sshfs.lua @@ -0,0 +1,7 @@ +vim.pack.add { "https://github.com/nosduco/remote-sshfs.nvim"} +require('remote-sshfs').setup() + +-- Usage: :RemoteSSHFSConnect @:/path/to/file +-- Sometimes you have to force close, and that causes permission failed on reconnect. +-- When that happens DO NOT DELETE THE DIRECTORY under .sshfd. That will delete everything that mountpoint is connected to *at the connection* +-- Instead safely unmount with `umount -l ~/.sshfd/[MOUNT_POINT]` diff --git a/lua/custom/plugins/snacks.lua b/lua/custom/plugins/snacks.lua new file mode 100644 index 00000000000..d14f66f0228 --- /dev/null +++ b/lua/custom/plugins/snacks.lua @@ -0,0 +1,23 @@ +--TODO: design a style and features for my dashboard (add opening parent directory with Oil) +--TODO: determine a method for deleting scratches easily +vim.pack.add { 'https://github.com/folke/snacks.nvim' } +require('snacks').setup { + dashboard = { + enabled = true, + sections = { + { section = 'header' }, + { section = 'keys', gap = 1, padding = 1 }, + }, + }, + gitbrowse = { enabled = true }, + lazygit = { enabled = true }, + scratch = { enabled = true }, + terminal = { enabled = true }, +} + +vim.keymap.set('n', '=', function() Snacks.dashboard.open() end, { desc = 'Dashboard' }) +vim.keymap.set('n', 'gr', function() Snacks.gitbrowse.open() end, { desc = 'Open [G]it [R]emore Repository in Browser' }) +vim.keymap.set('n', 'gl', function() Snacks.lazygit.open() end, { desc = 'Open [L]azy [G]it' }) +vim.keymap.set('n', 'no', function() Snacks.scratch() end, { desc = '[O]pen [N]otepad' }) +vim.keymap.set('n', 'ns', function() Snacks.scratch.select() end, { desc = '[S]elect [N]ote' }) +vim.keymap.set('n', '', function() Snacks.terminal() end, { desc = 'Open [T]erminal' }) diff --git a/lua/custom/plugins/typescript-tools.lua b/lua/custom/plugins/typescript-tools.lua new file mode 100644 index 00000000000..f35d3fdb200 --- /dev/null +++ b/lua/custom/plugins/typescript-tools.lua @@ -0,0 +1,2 @@ +vim.pack.add { 'https://github.com/pmizio/typescript-tools.nvim' } +require('typescript-tools').setup {} diff --git a/lua/custom/plugins/vimtmuxnavigator.lua b/lua/custom/plugins/vimtmuxnavigator.lua new file mode 100644 index 00000000000..c4e21b1bd0d --- /dev/null +++ b/lua/custom/plugins/vimtmuxnavigator.lua @@ -0,0 +1 @@ +vim.pack.add { 'https://github.com/christoomey/vim-tmux-navigator' } diff --git a/lua/kickstart/plugins/gitsigns.lua b/lua/kickstart/plugins/gitsigns.lua index b7e40a87cfc..3ee1c5cf856 100644 --- a/lua/kickstart/plugins/gitsigns.lua +++ b/lua/kickstart/plugins/gitsigns.lua @@ -2,8 +2,6 @@ -- NOTE: gitsigns is already included in init.lua but contains only the base -- config. This will add also the recommended keymaps. -vim.pack.add { 'https://github.com/lewis6991/gitsigns.nvim' } - require('gitsigns').setup { on_attach = function(bufnr) local gitsigns = require 'gitsigns' @@ -33,25 +31,24 @@ require('gitsigns').setup { -- Actions -- visual mode - map('v', 'hs', function() gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'git [s]tage hunk' }) - map('v', 'hr', function() gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'git [r]eset hunk' }) + map('v', 'ghs', function() gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = '[g]it [s]tage [h]unk' }) + map('v', 'ghr', function() gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = '[g]it [r]eset hunk' }) -- normal mode - map('n', 'hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' }) - map('n', 'hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' }) - map('n', 'hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' }) - map('n', 'hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' }) - map('n', 'hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' }) - map('n', 'hi', gitsigns.preview_hunk_inline, { desc = 'git preview hunk [i]nline' }) - map('n', 'hb', function() gitsigns.blame_line { full = true } end, { desc = 'git [b]lame line' }) - map('n', 'hd', gitsigns.diffthis, { desc = 'git [d]iff against index' }) - map('n', 'hD', function() gitsigns.diffthis '@' end, { desc = 'git [D]iff against last commit' }) - map('n', 'hQ', function() gitsigns.setqflist 'all' end, { desc = 'git hunk [Q]uickfix list (all files in repo)' }) - map('n', 'hq', gitsigns.setqflist, { desc = 'git hunk [q]uickfix list (all changes in this file)' }) + map('n', 'ghs', gitsigns.stage_hunk, { desc = '[g]it [s]tage [h]unk' }) + map('n', 'ghr', gitsigns.reset_hunk, { desc = '[g]it [r]eset [h]unk' }) + map('n', 'ghS', gitsigns.stage_buffer, { desc = '[g]it [S]tage buffer' }) + map('n', 'ghR', gitsigns.reset_buffer, { desc = '[g]it [R]eset buffer' }) + map('n', 'ghp', gitsigns.preview_hunk_inline, { desc = '[g]it [p]review [h]unk inline' }) + map('n', 'gb', function() gitsigns.blame { full = true } end, { desc = 'git [b]lame' }) + map('n', 'gd', gitsigns.diffthis, { desc = 'git [d]iff against index' }) + map('n', 'gD', function() gitsigns.diffthis '@' end, { desc = 'git [D]iff against last commit' }) + map('n', 'gQ', function() gitsigns.setqflist 'all' end, { desc = 'git hunk [Q]uickfix list (all files in repo)' }) + map('n', 'gq', gitsigns.setqflist, { desc = 'git hunk [q]uickfix list (all changes in this file)' }) -- Toggles - map('n', 'tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' }) - map('n', 'tw', gitsigns.toggle_word_diff, { desc = '[T]oggle git intra-line [w]ord diff' }) + map('n', 'gtb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' }) + map('n', 'gtw', gitsigns.toggle_word_diff, { desc = '[T]oggle git intra-line [w]ord diff' }) -- Text object - map({ 'o', 'x' }, 'ih', gitsigns.select_hunk) + map({ 'o', 'x' }, 'gih', gitsigns.select_hunk) end, }