From 087c2089e1621ae163258f92a49a0c05a1729bab Mon Sep 17 00:00:00 2001 From: Wil Taylor Date: Mon, 21 Jun 2021 18:12:17 +1000 Subject: [PATCH] Updated plugins and added some more dsp settings --- cheatsheet.md | 201 ++++++++++++++++++++++++++++++++++++++++ flake.lock | 84 ++++++++--------- modules/lsp/default.nix | 14 ++- 3 files changed, 249 insertions(+), 50 deletions(-) create mode 100644 cheatsheet.md diff --git a/cheatsheet.md b/cheatsheet.md new file mode 100644 index 0000000..3841364 --- /dev/null +++ b/cheatsheet.md @@ -0,0 +1,201 @@ +Leader Key is Space + +# Global Commands: + - `:h keyword` - Bring up help for keyword + - `sav file` - save the current file as another filename + - `clo` - Close the current pane + - `ter` - Open a terminal window + - `ESC` - Return to Normal mode + - `:w` - save + - `:q` - quit + - `:q!` - quit don't save + - `:wqa` - Save and quit cloing all tabs + +# Movement Keys + - `h(left) j (down) k(up) l(right)` - Move around the screen + - `gg` - Move to top of buffer + - `G` - Move to bottom of file + - `H` - Top of screen + - `M` - Middle of screen + - `L` - Bottom of the screen + - `w` - jump forward to start of word + - `e` - jump forward to end of word + - `b` - jump backwards to start of word + - `%` - Jump forward to matching paren or brace. + - `0` - Start of line + - `$` - End of line + - `^` - First non blank charecter of line + - `f(char)` - Move to the next occurrence of charecter + - `F(char)` - Move ot the previous occurrence of charecter + - `;` - Repeat last f or F + - `,` - Repeat last f or F backwards + - `{ }` - Move around paragraph blocks (works in code too) + - `ctrl + e` - Move screen down one line without moving cursor. + - `ctrl + y` - Move screen up one line without moving cursor. + - `ctrl + b` - Move back one full screen + - `ctrl + f` - Move forward one full screen + - `ctrl + d` - Move forward 1/2 screen + - `ctrl + u` - Move back one full screen + +# Insert Mode + - `i` - Enter insert mode before cursor. + - `I` - Enter insert mode at the start of the line. + - `a` - Enter insert mode after cursor. + - `A` - Enter insert mode at the end of the line. + - `o` - Append a line below current line + - `O` - Append a line above current line + - `ea` - Enter insert mode at the end of the word + - `ctrl + rx` - Insert the contents of register x + +# Editing + - `r` - Replace single charecter + - `J` - Join line below to current one + - `gwip` - Reflow paragraph + - `g~` - switch case up to motion + - `gu` - Lower case up to motion + - `gU` - Upper case up to motion. + - `cc` - Replace entire line + - `C` or `c$` - Replace to end of line. + - `ciw` - Change entire word + - `cw` - Replace to end of word + - `u` - Undo + - `U` - Redo + - `.` - Repeat last command + +# Marking Text + - `v` - Visual mode + - `V` - Start linewise visual mode (select lines) + - `o` - Move to other end of marked area. + - `Ctrl + v` - Visual Block mode + - `Ctrl + O` - Other corner of block + - `aw` - Mark a word + - `ab` - Mark block with () + - `aB` - Mark block with {} + - `ib` - Mark inner block with () + - `iB` - mark inner block with {} + - `at` - Mark tags with <> + +# Visual Commands + - `>` - Shift text right + - `<` - Shift text left + - `y` - Yank marked text + - `d` - Delete marked text + - `~` - Switch case + - `u` - Change case to lowercase + - `U` - Change case to uppercase + +# Registers + - `:reg` - Show register content + - `"xy` - Yank into register x + - `"xp` - Paste contents of register x + - `"+y` - Yank into system clipboard + - `"+p` - Paste from system clipboard + +# Marks and Positions + - `:marks` - Lists all marks + - `ma` - Set position of mark a + - \`a - Jump back to a + - \`. - Go to position when last editing the file + - \`\` - Go to position before last jump + - `:ju` - List of jumps + - `ctrl + i` - Newer position in jump list + - `ctrl + o` - Older position in jump list + - `:changes` - List changes + - `g,` - Go to newer change + - `g;` - Go to older change + +# Macros + - `qa` - Record macro a + - `q` - stop recording macro + - `@a` - Run macro a + - `@@` - rerun last macro + +# Cut and Paste + - `yy` - yank line + - `yw` - yank word + - `y$` - yank to end of line + - `p` - Paste clipboard after cursor + - `P` - Paste clipboard before cursor + - `dd` - delete line + - `dw` - Delete word (from current cursor to next start of word) + - `d$` - Delete till end of line + - `x` - delete charecter + +# Indent text + - `<<` - Move line left + - `>>` - Move line right + - `>%` - Indent block (when on brace or paren) + - `=%` - Re-indent block + +# Searching and patterns + - `/pattern` - Search for pattern + - `?pattern` - Search backwards for pattern + - `n` - Repeat search in same direction + - `N` - Repeat search in opposite direction + - `:%s/old/new/g` - Replace all old with new throughout the file. + - `:%s/old/new/gc` - Replace all old with new throughout the file with confirmations. + - `noh` - Remove highlighting of search matches + - `:vimgrep /pattern/ **/*` - Search for pattern in all files. + - `:cn` - next match + - `:cp` - prev match + - `:cope` - List of all matches found + - `:ccl` - Close list of all matches + +# Tabs + - `:tabnew [file]` - Open file in new tab + - `Ctrl + wT` - Move current split window into its own tab + - `gt` - Go to next tab + - `gT` - Go to prev tab + - `#gt` - Go to tab number + - `:tabc` - Close current tab + - `:tabo` - Close other tabs but this one. + +# Buffers + - `:e file` - Edit file in a new buffer + - `:bn` - Next buffer + - `:bp` - Prev buffer + - `:bd` - Close buffer + - `:ls` - List open buffers + +# Splits + - `:sp file` - Open file in new buffer and split + - `:vs file` - Open file in new buffer and split (verticle) + - `:tab ba` - Open all buffers as tabs + - `ctrl + ws` - split window + - `ctrl + wv` - split window verticle + - `ctrl + ww` - switch window + - `ctrl + wq` - Quit window + - `ctrl + wx` - Exchange window with next one + - `ctrl + w=` - Make all windows equal height and width + - `ctrl + wh` - Move to left window + - `ctrl + wl` - Move to right window + - `ctrl + wj` - Move to below window + - `ctrl + wk` - Move to above window + +# File tree + - `ctrl+ n` - Toggle file tree + +# Telescope + - `leader + ff` - Find file + - `leader + fg` - Live grep + - `leader + fb` - Buffers + - `leader + fh` - Help tags + +# LSP + - `F2` - Rename + - `Leader + R` - Rename + - `Leader + r` - References + - `Leader + d` - Go to definition + - `Leader + e` - Show line diagnostics + - `Leader + f` - Format buffer + - `Leader + k` - Signature help + - `Leader + K` - Hover text + +## Debug + - `F5` - Run + - `F10` - Step over + - `F11` - Step into + - `F12` - Step out + - ` + b` - Set break point + - `F9` - Open debug repl + diff --git a/flake.lock b/flake.lock index d812970..3457f53 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "completion-nvim": { "flake": false, "locked": { - "lastModified": 1617852343, - "narHash": "sha256-Tq1cxbmTrOu9iNSd7HrRobkbv71/8+id+fm9dMth+As=", + "lastModified": 1623862100, + "narHash": "sha256-QLiQK9RN9cYh/3F3nBOSMikt3qouJSDhRUp62Qz42kE=", "owner": "nvim-lua", "repo": "completion-nvim", - "rev": "8bca7aca91c947031a8f14b038459e35e1755d90", + "rev": "d62fff879b29fa1ce915887a75305af0fff57d32", "type": "github" }, "original": { @@ -18,11 +18,11 @@ }, "flake-utils": { "locked": { - "lastModified": 1620759905, - "narHash": "sha256-WiyWawrgmyN0EdmiHyG2V+fqReiVi8bM9cRdMaKQOFg=", + "lastModified": 1623875721, + "narHash": "sha256-A8BU7bjS5GirpAUv4QA+QnJ4CceLHkcXdRp4xITDB0s=", "owner": "numtide", "repo": "flake-utils", - "rev": "b543720b25df6ffdfcf9227afafc5b8c1fabfae8", + "rev": "f7e004a55b120c02ecb6219596820fcd32ca8772", "type": "github" }, "original": { @@ -50,11 +50,11 @@ "lightline-vim": { "flake": false, "locked": { - "lastModified": 1621231938, - "narHash": "sha256-HNVyQV5dxXMdOTQsFKE6nmK52WGld557BOgrgZTFqc0=", + "lastModified": 1622343358, + "narHash": "sha256-iE72X/Vmm/lIQyxL016L/GUiaM8vxWaoMpi+9brWWLc=", "owner": "itchyny", "repo": "lightline.vim", - "rev": "d70d69b3418957cdf7c4993e484f8b9d3eb1603c", + "rev": "b06d921023cf6536bcbee5754071d122296e8942", "type": "github" }, "original": { @@ -92,11 +92,11 @@ }, "locked": { "dir": "contrib", - "lastModified": 1621256266, - "narHash": "sha256-pczGTgVGMLke9w+7t87egrH8PbNiRfZPX7QatGcApo0=", + "lastModified": 1624213243, + "narHash": "sha256-uO5fmezpruahUvEPuOmUf+VG8yO3XiyO+P5V+SB/WyQ=", "owner": "neovim", "repo": "neovim", - "rev": "dc18c1e3ee4f2ec556de4e13ae162c5f70cf51ae", + "rev": "b585f723bcbaa10a091fce5a61659b331b1467b9", "type": "github" }, "original": { @@ -108,11 +108,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1621169420, - "narHash": "sha256-NKFX7QhxRQkaw0+NjcZ6N+cYpDs7gkpMHxNC8QHkprg=", + "lastModified": 1623862044, + "narHash": "sha256-mY7nldu9Wl/Yb0qMPihZrWw0bRWXNsk6iyYztw/6F6Y=", "owner": "nixos", "repo": "nixpkgs", - "rev": "c58b97674b12d238d9d21e8ab9ee9d7a6b81ae8f", + "rev": "0747387223edf1aa5beaedf48983471315d95e16", "type": "github" }, "original": { @@ -153,11 +153,11 @@ "nord-vim": { "flake": false, "locked": { - "lastModified": 1619948108, - "narHash": "sha256-ox57vTGtDh25VG1wy3MppQmyMKoyAzY4UFQ1RXz4uzU=", + "lastModified": 1623268056, + "narHash": "sha256-ArG0/VrTeBBgDvQ/SeBC7CH0xxGv7yqq7Z8d9NTrZ6M=", "owner": "arcticicestudio", "repo": "nord-vim", - "rev": "5867535cea7bb6b4c219fa0726c93e4b055debd2", + "rev": "1380ad687671e5cbd79ba615d5e5517609cdafc2", "type": "github" }, "original": { @@ -169,11 +169,11 @@ "nvim-dap": { "flake": false, "locked": { - "lastModified": 1620670373, - "narHash": "sha256-9d8+sov54ZvWqzEWNNW4KIsQjicPe0qodzmvYO8xTsI=", + "lastModified": 1623780040, + "narHash": "sha256-FseSsjaZrbQNj2Qfx8eZPWgLLiZzwxz3W50K9ha98gk=", "owner": "mfussenegger", "repo": "nvim-dap", - "rev": "7c6d12132339d7ef4136dabdd316a20e9c7dd8cf", + "rev": "d5e57dc263ab14ec5d99049f66f5a069b63837dc", "type": "github" }, "original": { @@ -185,11 +185,11 @@ "nvim-lspconfig": { "flake": false, "locked": { - "lastModified": 1621200239, - "narHash": "sha256-vbsjBWFbdeGmBEriSAWGM+JM9s7+dyHo1W0vzzLruGU=", + "lastModified": 1624209456, + "narHash": "sha256-Z+DR+xInyx/c3R82qaWdqzAt5t/JLoZayhOPGNLWxP0=", "owner": "neovim", "repo": "nvim-lspconfig", - "rev": "0699e6c16c37c08418339675d142af0e00ccbeaa", + "rev": "48e47b4d26e45977d27c06dc1bc116416ca9276d", "type": "github" }, "original": { @@ -201,11 +201,11 @@ "nvim-telescope": { "flake": false, "locked": { - "lastModified": 1621190176, - "narHash": "sha256-SFJ+RvDPMHPdTCtb+2yiZeEhobSYndbvN43SU/aHxfo=", + "lastModified": 1623700246, + "narHash": "sha256-N9S+zn/Wk+rg93zmLWbAbGPmkouu9O3+BAA0hpSnT8w=", "owner": "nvim-telescope", "repo": "telescope.nvim", - "rev": "69eb5eacff421e05aeb1e02ff97ef64bfd955c53", + "rev": "6ac5ee0854fe02d651cadf2fc97a2463ff92f322", "type": "github" }, "original": { @@ -217,11 +217,11 @@ "nvim-tree-lua": { "flake": false, "locked": { - "lastModified": 1619123360, - "narHash": "sha256-AN/7FOjaDw3zbz/sYjD3cZEYquarQQTYLuSgKBjOynw=", + "lastModified": 1623786580, + "narHash": "sha256-ZyozHY3Zos85XwxqSIYUFGiWc/Jn6rNC4h9nybZsHms=", "owner": "kyazdani42", "repo": "nvim-tree.lua", - "rev": "f39869514645b98ec30bc8826763c288b6cbdbef", + "rev": "bfeaf4c8ef5ff24e93005da2561407a13ba69d4d", "type": "github" }, "original": { @@ -233,11 +233,11 @@ "nvim-web-devicons": { "flake": false, "locked": { - "lastModified": 1618594387, - "narHash": "sha256-DOurMGv1XHY3J/6N5fRrAk45MmM55jobhkVKAcKsCeM=", + "lastModified": 1621457141, + "narHash": "sha256-3LLgix89Q+U2QwVhcrCLPBP0LJ4w1vY2B5C91teVe0s=", "owner": "kyazdani42", "repo": "nvim-web-devicons", - "rev": "1db27380053de0cd4aaabd236a67c52d33199f1a", + "rev": "da717e19678bd6ec33008cf92da05da1b8ceb87d", "type": "github" }, "original": { @@ -249,11 +249,11 @@ "plenary-nvim": { "flake": false, "locked": { - "lastModified": 1620472381, - "narHash": "sha256-R1RcT2gMxFhPPLcQS8ybftiCdGC0WjH6bgtikjwfPGY=", + "lastModified": 1624125414, + "narHash": "sha256-/2AgeZV4BF67rM0/haqFuf2pxQqDSCxtVIzostKf+h8=", "owner": "nvim-lua", "repo": "plenary.nvim", - "rev": "3f993308024697186c02d51df1330bf07c12535a", + "rev": "268002fdba2f8f5a4e86574e3b9924ad6d42da20", "type": "github" }, "original": { @@ -285,11 +285,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1617631723, - "narHash": "sha256-Qo09WUFFsqoj07ZNXxF3SL3eMaCg9UovNNJb1wa/O8s=", + "lastModified": 1624126275, + "narHash": "sha256-FAmvOFDf8yMNqw5SrxbxvFUovTrTmOOQ/nXXGa4yvH8=", "owner": "nix-community", "repo": "rnix-lsp", - "rev": "23df7ab20b71896ac47da8dab6d4bcc6e8f994d5", + "rev": "e1ec7a064cdaa9a362561ab4a14dee60a4f84fbf", "type": "github" }, "original": { @@ -337,11 +337,11 @@ "vim-nix": { "flake": false, "locked": { - "lastModified": 1605554749, - "narHash": "sha256-UgiPw6R+EUHMur1GuIHxForDgtXcKvLD0uPJNhmP/80=", + "lastModified": 1622231877, + "narHash": "sha256-wQzNXfE7JFalgiCQ2ksPAUyFKacmJV7mNKmKDe9jySI=", "owner": "LnL7", "repo": "vim-nix", - "rev": "7542a2bf66d72cb86fc80529867accbc787f744b", + "rev": "63b47b39c8d481ebca3092822ca8972e08df769b", "type": "github" }, "original": { diff --git a/modules/lsp/default.nix b/modules/lsp/default.nix index 839e8cd..9203c51 100644 --- a/modules/lsp/default.nix +++ b/modules/lsp/default.nix @@ -50,17 +50,14 @@ in { vim.nnoremap = { "" = "lua vim.lsp.buf.rename()"; - "r" = "lua vim.lsp.buf.rename()"; - "d" = "lua vim.lsp.buf.type_definition()"; + "R" = "lua vim.lsp.buf.rename()"; + "r" = "lua vim.lsp.buf.references()"; + + "d" = "lua vim.lsp.buf.definition()"; "e" = "lua vim.lsp.diagnostic.show_line_diagnostics()"; "f" = "lua vim.lsp.buf.formatting()"; "k" = "lua vim.lsp.buf.signature_help()"; - - gD = "lua vim.lsp.buf.declaration()"; - gd = "lua vim.lsp.buf.definition()"; - gi = "lua vim.lsp.buf.implementation()"; - gr = "lua vim.lsp.buf.references()"; - K = "lua vim.lsp.buf.hover()"; + "K" = "lua vim.lsp.buf.hover()"; "[d" = "lua vim.lsp.diagnostic.goto_prev()"; "]d" = "lua vim.lsp.diagnostic.goto_next()"; @@ -72,6 +69,7 @@ in { "" = "lua require'dap'.step_out()"; "" = "lua require'dap'.continue()"; "b" = "lua require'dap'.toggle_breakpoint()"; + "" = "lua require'dap'.repl.open()"; }; vim.globals = {