From 7612d675b246fff33a50d8f7b6e568f8f64f0123 Mon Sep 17 00:00:00 2001 From: Buliway Date: Sun, 12 Jan 2025 22:21:48 +0300 Subject: [PATCH] new go binds and format readme tables --- nvim/README.md | 126 +++++++++++++++-------------- nvim/init.lua | 8 ++ nvim/lazy-lock.json | 1 + nvim/lua/custom/plugins/golang.lua | 10 ++- 4 files changed, 79 insertions(+), 66 deletions(-) diff --git a/nvim/README.md b/nvim/README.md index 6041836..fef046b 100644 --- a/nvim/README.md +++ b/nvim/README.md @@ -57,70 +57,72 @@ ln -s ~/nixos-private-dots/nvim ~/.config/nvim Я не помню откуда эти бинды, может они есть в стоке, а может нет, но они полезные. -| Bind | Description | -| -------------- | ---------------------------------- | -| `K` | Hover documentation | -| `ctrl+o` | Go back | -| `ctrl+i` | Go forward (if you went backwards) | -| `p` | Paste from nvim register | -| `ctrl+shift+v` | Paste from system clipboard | -| `y` | Yank(copy) to nvim register | -| `space y` | Yank(copy) to system clipboard | -| `d` | Delete(copy) to nvim register | -| `space d` | Delete(copy) to system clipboard | -| `alt + up/down/j/k` | Move lines in visual mode | -| `[d` | Go to previous `D`iagnostic message | -| `]d` | Go to next `D`iagnostic message | -| `space e` | Show diagnostic `E`rror message | -| `space q` | Open diagnostic `Q`uickfix | +| Bind | Description | +|---------------------|-------------------------------------| +| `K` | Hover documentation | +| `ctrl+o` | Go back | +| `ctrl+i` | Go forward (if you went backwards) | +| `p` | Paste from nvim register | +| `ctrl+shift+v` | Paste from system clipboard | +| `y` | Yank(copy) to nvim register | +| `space y` | Yank(copy) to system clipboard | +| `d` | Delete(copy) to nvim register | +| `space d` | Delete(copy) to system clipboard | +| `alt + up/down/j/k` | Move lines in visual mode | +| `[d` | Go to previous `D`iagnostic message | +| `]d` | Go to next `D`iagnostic message | +| `space e` | Show diagnostic `E`rror message | +| `space q` | Open diagnostic `Q`uickfix | Бинды в таблице ниже нажимаются без пробела перед ними. Просто бинд -| Bind | Description | File | -| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | -------------- | -| `esc esc` | Exit terminal mode (This won't work in all terminal emulators/tmux/etc. Try your own mapping or use `` to exit terminal mode) | settings.lua | -| `esc` | Creal highlights on search when pressing Esc in normal mode | settings.lua | -| `gp` | `G`oto context (`p`arent) | treesitter.lua | -| `gd` | `G`oto `D`efinition | lsp.lua | -| `gr` | `G`oto `R`eferences | lsp.lua | -| `gI` | `G`oto `I`mplementation | lsp.lua | -| `gD` | `G`oto `D`eclaration. This is not Goto Definition, this is Goto Declaration. For example, in C this would take you to the header | lsp.lua | -| `gc` | Toggle Comment from mini-comment plugin | - | -| `\` | Toggle file tree | file-tree.lua | +| Bind | Description | File | +|-----------|-----------------------------------------------------------------------------------------------------------------------------------------|----------------| +| `esc esc` | Exit terminal mode (This won't work in all terminal emulators/tmux/etc. Try your own mapping or use `` to exit terminal mode) | settings.lua | +| `esc` | Creal highlights on search when pressing Esc in normal mode | settings.lua | +| `gp` | `G`oto context (`p`arent) | treesitter.lua | +| `gd` | `G`oto `D`efinition | lsp.lua | +| `gr` | `G`oto `R`eferences | lsp.lua | +| `gI` | `G`oto `I`mplementation | lsp.lua | +| `gD` | `G`oto `D`eclaration. This is not Goto Definition, this is Goto Declaration. For example, in C this would take you to the header | lsp.lua | +| `gc` | Toggle Comment from mini-comment plugin | - | +| `\` | Toggle file tree | file-tree.lua | Перед каждым из биндов в нижней таблице надо нажать `leader`, что есть `space`, пробел. -| Bind | Description | File | -| ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------- | -| `tt` | `T`oggle `T`erminal | terminal.lua | -| `gta` | `G`o `T`ag `A`dd. Add json tags for struct | golang.lua | -| `gtr` | `G`o `T`ag `R`emove. Remove json tags for struct | golang.lua | -| `gfs` | `G`o `F`ill `S`truct | golang.lua | -| `gfc` | `G`o `F`ill Switch `C`ase | golang.lua | -| `gie` | `G`o `I`f `E`rr | golang.lua | -| `gfp` | `G`o `F`ix `P`lurals | golang.lua | -| `D` | Type `D`efinition. Jump to the typo 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*. | lsp.lua | -| `ds` | `D`ocument `S`ymbols. Fuzzy find all the symbols in your current document. Symbols are things like variables, funckions, types, etc. | lsp.lua | -| `ws` | `W`orkspace `S`ymbols. Fuzzy find all the symbols in your currend workspace. Similar to document symbols, except searches over you entire project | lsp.lua | -| `rn` | `R`e`n`ame. Rename the variable under your cursor. Most Language Servers support renaming across files, etc. | lsp.lua | -| `ca` | `C`ode `A`ction. 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 | lsp.lua | -| `sh` | `S`earch `H`elp | health.lua | -| `sk` | `S`earch `K`eymaps | health.lua | -| `sf` | `S`earch `F`iles | health.lua | -| `ss` | `S`earch `S`elect Telescope | health.lua | -| `sw` | `S`earch current `W`ord | health.lua | -| `sg` | `S`earch by `G`rep | health.lua | -| `sd` | `S`earch `D`iagnostics | health.lua | -| `sr` | `S`earch `R`esume | health.lua | -| `s.` | `S`earch Recent Files ("." for repeat) | health.lua | -| `space` | Find existing buffers. Аналог перелючения между вкладками | health.lua | -| `/` | Fuzzily search in current buffer | health.lua | -| `s/` | `S`earch `/` in Open Files. Live Grep in Open Files | health.lua | -| `sn` | `S`earch `N`eovim files. Shortcut for searching your Neovim configuration files | health.lua | -| `st` | `S`earch `T`hemes | health.lua | -| `q` | Open diagnostic `Q`uicfix list | settings.lua | -| `f` | `F`ormat buffer | autoformat.lua | +| Bind | Description | File | +|---------|---------------------------------------------------------------------------------------------------------------------------------------------------|----------------| +| `tt` | `T`oggle `T`erminal | terminal.lua | +| `gta` | `G`o `T`ag `A`dd. Add json tags for struct | golang.lua | +| `gtr` | `G`o `T`ag `R`emove. Remove json tags for struct | golang.lua | +| `gs` | `G`o fill `S`truct | golang.lua | +| `gc` | `G`o fill Switch `C`ase | golang.lua | +| `gp` | `G`o fix `P`lurals (change func foo(b int, a int, r int) -> func foo(b, a, r int)) | golang.lua | +| `ge` | `G`o if `E`rr | golang.lua | +| `gi` | `G`o `I`mports | golang.lua | +| `D` | Type `D`efinition. Jump to the typo of the word under your cursor. | lsp.lua | +| | 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*. | | +| `ds` | `D`ocument `S`ymbols. Fuzzy find all the symbols in your current document. Symbols are things like variables, funckions, types, etc. | lsp.lua | +| `ws` | `W`orkspace `S`ymbols. Fuzzy find all the symbols in your currend workspace. Similar to document symbols, except searches over you entire project | lsp.lua | +| `rn` | `R`e`n`ame. Rename the variable under your cursor. Most Language Servers support renaming across files, etc. | lsp.lua | +| `ca` | `C`ode `A`ction. 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 | lsp.lua | +| `sh` | `S`earch `H`elp | health.lua | +| `sk` | `S`earch `K`eymaps | health.lua | +| `sf` | `S`earch `F`iles | health.lua | +| `ss` | `S`earch `S`elect Telescope | health.lua | +| `sw` | `S`earch current `W`ord | health.lua | +| `sg` | `S`earch by `G`rep | health.lua | +| `sd` | `S`earch `D`iagnostics | health.lua | +| `sr` | `S`earch `R`esume | health.lua | +| `s.` | `S`earch Recent Files ("." for repeat) | health.lua | +| `space` | Find existing buffers. Аналог перелючения между вкладками | health.lua | +| `/` | Fuzzily search in current buffer | health.lua | +| `s/` | `S`earch `/` in Open Files. Live Grep in Open Files | health.lua | +| `sn` | `S`earch `N`eovim files. Shortcut for searching your Neovim configuration files | health.lua | +| `st` | `S`earch `T`hemes | health.lua | +| `q` | Open diagnostic `Q`uicfix list | settings.lua | +| `f` | `F`ormat buffer | autoformat.lua | ### Git @@ -130,19 +132,19 @@ ln -s ~/nixos-private-dots/nvim ~/.config/nvim Без пробела | Bind | Description | File | -| ---- | ----------------------------- | ------------ | +|------|-------------------------------|--------------| | `]c` | Jump to next git `C`hange | gitsigns.lua | | `[c` | Jump to previous git `C`hange | gitsigns.lua | Visual mode. С пробелом | Bind | Description | File | -| ---- | ---------------- | ------------ | +|------|------------------|--------------| | `hs` | `S`tage git hunk | gitsigns.lua | | `hr` | `R`eset git hunk | gitsigns.lua | Normal mode. С пробелом | Bind | Description | File | -| ---- | ------------------------------ | ------------ | +|------|--------------------------------|--------------| | `hs` | Git `S`tage hunk | gitsigns.lua | | `hr` | Git `R`eset hunk | gitsigns.lua | | `hS` | Git `S`tage buffer | gitsigns.lua | @@ -159,7 +161,7 @@ Normal mode. С пробелом Без пробела | Bind | Description | File | -| ---- | ------------------------------ | --------- | +|------|--------------------------------|-----------| | `F5` | Debug: Start/Continue | debug.lua | | `F1` | Debug: Step Into | debug.lua | | `F2` | Debug: Step Over | debug.lua | @@ -168,7 +170,7 @@ Normal mode. С пробелом С пробелом | Bind | Description | File | -| ---- | -------------------------- | --------- | +|------|----------------------------|-----------| | `b` | Debug: Toggle `B`reakpoint | debug.lua | | `B` | Debug: Set `B`reakpoint | debug.lua | diff --git a/nvim/init.lua b/nvim/init.lua index 4f6c7f9..314e2d8 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -96,6 +96,14 @@ require('lazy').setup({ -- Plugins for git require 'custom.plugins.git', + -- Autoformat markdown tables + { + 'Kicamon/markdown-table-mode.nvim', + config = function() + require('markdown-table-mode').setup() + end, + }, + -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- This is the easiest way to modularize your config. -- diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index 0336ef5..1bb4d42 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -21,6 +21,7 @@ "lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" }, "lazydev.nvim": { "branch": "main", "commit": "8620f82ee3f59ff2187647167b6b47387a13a018" }, "luvit-meta": { "branch": "main", "commit": "55709f183b0742a7e4f47688c284f81148ad4dc0" }, + "markdown-table-mode.nvim": { "branch": "main", "commit": "870d0449c1c78c673faa9637a63036f9537b4caa" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "97d9f1d3ad205dece6bcafd1d71cf1507608f3c7" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" }, diff --git a/nvim/lua/custom/plugins/golang.lua b/nvim/lua/custom/plugins/golang.lua index 9edbb6b..686e44c 100644 --- a/nvim/lua/custom/plugins/golang.lua +++ b/nvim/lua/custom/plugins/golang.lua @@ -12,10 +12,12 @@ return { require('go').setup() vim.keymap.set({ 'n' }, 'gta', ':GoAddTag', { desc = '[G]o [T]ag [A]dd' }) vim.keymap.set({ 'n' }, 'gtr', ':GoRmTag', { desc = '[G]o [T]ag [R]emove' }) - vim.keymap.set({ 'n' }, 'gfs', ':GoFillStruct', { desc = '[G]o [F]ill [S]truct' }) - vim.keymap.set({ 'n' }, 'gfc', ':GoFillSwitch', { desc = '[G]o [F]ill Switch [C]ase' }) - vim.keymap.set({ 'n' }, 'gie', ':GoIfErr', { desc = '[G]o [I]f [E]rr' }) - vim.keymap.set({ 'n' }, 'gfp', ':GoFixPlurals', { desc = '[G]o [F]ix [P]lurals' }) + vim.keymap.set({ 'n' }, 'gs', ':GoFillStruct', { desc = '[G]o fill [S]truct' }) + vim.keymap.set({ 'n' }, 'gc', ':GoFillSwitch', { desc = '[G]o fill Switch [C]ase' }) + -- Go Fix Plurals - change func foo(b int, a int, r int) -> func foo(b, a, r int) + vim.keymap.set({ 'n' }, 'gp', ':GoFixPlurals', { desc = '[G]o fix [P]lurals' }) + vim.keymap.set({ 'n' }, 'ge', ':GoIfErr', { desc = '[G]o if [E]rr' }) + vim.keymap.set({ 'n' }, 'gi', ':GoImports', { desc = '[G]o [I]mports' }) end, event = { 'CmdlineEnter' }, ft = { 'go', 'gomod' },