From ce68e64f153b97a1971645f6569c3bad3acd8cbc Mon Sep 17 00:00:00 2001 From: urec56 Date: Fri, 10 Jan 2025 19:10:34 +0300 Subject: [PATCH] =?UTF-8?q?=D0=90=D0=BA=D1=82=D1=83=D0=B0=D0=BB=D0=B8?= =?UTF-8?q?=D0=B7=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BB=20=D0=BE=D1=82=20?= =?UTF-8?q?=D0=B1=D1=83=D0=BB=D0=B8=D0=B2=D0=B5=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +- archive/default-apps.nix | 4 +- flake.lock | 6 +- modules/home-manager/bundle.nix | 2 +- modules/home-manager/terminal/zsh.nix | 10 +- modules/home-manager/wm/bspwm/bspwm.nix | 3 +- modules/nixos/bundle.nix | 1 + modules/nixos/nix-glow-gruvbox.jpg | Bin 397711 -> 397705 bytes modules/nixos/sound.nix | 3 +- nixos/packages.nix | 22 +-- nvim/README.md | 169 ++++++++++++++---- nvim/init.lua | 11 +- nvim/lazy-lock.json | 52 +++--- nvim/lua/custom/plugins/git.lua | 5 + nvim/lua/custom/plugins/golang.lua | 24 ++- nvim/lua/custom/plugins/sessions.lua | 16 ++ nvim/lua/custom/plugins/terminal.lua | 58 ------ nvim/lua/custom/terminal.lua | 56 ++++++ nvim/lua/kickstart/plugins/autoformat.lua | 3 +- nvim/lua/kickstart/plugins/completion.lua | 48 +++-- .../plugins/{neo-tree.lua => file-tree.lua} | 6 +- nvim/lua/kickstart/plugins/lsp.lua | 42 ++--- nvim/lua/kickstart/plugins/mini.lua | 1 - nvim/lua/kickstart/plugins/telescope.lua | 7 +- nvim/lua/kickstart/plugins/themes.lua | 32 ++-- nvim/lua/kickstart/plugins/todo-comments.lua | 1 - nvim/lua/kickstart/plugins/treesitter.lua | 25 ++- nvim/lua/kickstart/plugins/vim-sleuth.lua | 3 +- nvim/lua/kickstart/plugins/which-key.lua | 6 +- nvim/lua/kickstart/settings.lua | 53 +++++- nvim/shit.md | 5 - shit/mimeapps.list | 4 +- 32 files changed, 445 insertions(+), 239 deletions(-) create mode 100644 nvim/lua/custom/plugins/git.lua create mode 100644 nvim/lua/custom/plugins/sessions.lua delete mode 100644 nvim/lua/custom/plugins/terminal.lua create mode 100644 nvim/lua/custom/terminal.lua rename nvim/lua/kickstart/plugins/{neo-tree.lua => file-tree.lua} (88%) diff --git a/README.md b/README.md index 3bf1820..015b8e3 100644 --- a/README.md +++ b/README.md @@ -70,9 +70,8 @@ | `Super + B` | Browser LibreWolf. Основа | Да | | `Super + Shift + B` | Browser Firefox. Паблик активность | Да | | `Super + Shift + Ctrl + B` | Browser Chromium. Пусть будет | Да | -| `Super + N` | Note taking app (obsidian) | Да | | `Super + E` | Explorer. Thunar file manager | Да | -| `Super + I` | IDE, text editor, NeoVim | Да | +| `Super + I` | IDE, text editor | Да | | `Super + M` | Monitor of resources (btop) | Да | | `Super + G` | Goals. Todo manager. Task tracker | Да | | `Super + Shift + C` | Color picker. Получить hex в буфер обмена | Да | @@ -112,6 +111,7 @@ - [Копия man page для bspwm с доп инфой](./modules/home-manager/wm/bspwm/bspwm.md) - [Описание плагинов для mpv](./modules/home-manager/mpv/README.md) +- [NeoVim config](./nvim/README.md) ## Проблемы @@ -229,6 +229,8 @@ font = lib.mkForce "JetBrainsMono Nerd Font 11"; ip a ``` +В бутменю биоса надо ставить не ссд диск, а `nixos boot`. У меня иначе не работало + ## Нюансы с JetBrains Toolbox В стоке тулбокс может всегда разлогинивать. Я не проверял, сразу сделал как просили на вики, чтоб это исправить. diff --git a/archive/default-apps.nix b/archive/default-apps.nix index c9b6ee9..1a4453d 100644 --- a/archive/default-apps.nix +++ b/archive/default-apps.nix @@ -29,7 +29,7 @@ "x-scheme-handler/unknown" = [ "librewolf.desktop" ]; # Images "image/*" = [ "qview.desktop" "imv.desktop" ]; - "image/avif" = [ "qview.desktop" "imv.desktop" ]; + "image/avif" = [ "imv.desktop" "qview.desktop" ]; "image/gif" = [ "qview.desktop" "imv.desktop" ]; "image/jpeg" = [ "qview.desktop" "imv.desktop" ]; # Обычный jpeg, прогрузка сверху вниз "image/pjpeg" = [ "qview.desktop" "imv.desktop" ]; # Сначала размытый и постепенной лучше видно, для медленного инета @@ -90,7 +90,7 @@ associations.added = { # Дополнительные приложения для нужного файла. Будет в меню "Открыть с помощью" # Images "image/*" = [ "qview.desktop" "imv.desktop" ]; - "image/avif" = [ "qview.desktop" "imv.desktop" ]; + "image/avif" = [ "imv.desktop" "qview.desktop" ]; "image/gif" = [ "qview.desktop" "imv.desktop" ]; "image/jpeg" = [ "qview.desktop" "imv.desktop" ]; # Обычный jpeg, прогрузка сверху вниз "image/pjpeg" = [ "qview.desktop" "imv.desktop" ]; # Сначала размытый и постепенной лучше видно, для медленного инета diff --git a/flake.lock b/flake.lock index 94f42b1..0093d60 100644 --- a/flake.lock +++ b/flake.lock @@ -263,11 +263,11 @@ }, "nixpkgs2": { "locked": { - "lastModified": 1733392399, - "narHash": "sha256-kEsTJTUQfQFIJOcLYFt/RvNxIK653ZkTBIs4DG+cBns=", + "lastModified": 1736344531, + "narHash": "sha256-8YVQ9ZbSfuUk2bUf2KRj60NRraLPKPS0Q4QFTbc+c2c=", "owner": "nixos", "repo": "nixpkgs", - "rev": "d0797a04b81caeae77bcff10a9dde78bc17f5661", + "rev": "bffc22eb12172e6db3c5dde9e3e5628f8e3e7912", "type": "github" }, "original": { diff --git a/modules/home-manager/bundle.nix b/modules/home-manager/bundle.nix index 208d418..d442dc1 100644 --- a/modules/home-manager/bundle.nix +++ b/modules/home-manager/bundle.nix @@ -2,7 +2,7 @@ imports = [ ./ranger/ranger.nix - #./gui/vscode.nix + ./gui/vscode.nix ./imv/imv.nix ./mpv/mpv.nix diff --git a/modules/home-manager/terminal/zsh.nix b/modules/home-manager/terminal/zsh.nix index 0d352d7..e189929 100644 --- a/modules/home-manager/terminal/zsh.nix +++ b/modules/home-manager/terminal/zsh.nix @@ -22,11 +22,9 @@ upg = "sudo nixos-rebuild switch --impure --upgrade --flake ${flakeDir}"; # Обновить пакеты, но не репозиторий во fleke.lock # Обновить все flake inputs до последних версий. Возможно это аналог "sudo pacman -Sy" на Arch Linux - upd = "nix flake update --recreate-lock-file ${flakeDir}"; - - # Update Single flake input. Требует дописать имя инпута после команды - # Для my-lib.url надо писать `upds my-lib` - upds = "nix flake lock --update-input"; + # Если после upd дописать название инпута из flake.nix, то обновится только указанный инпут + # Например `upd nixpkgs2` для обновления анстабле репы + upd = "sudo nix flake update --flake ${flakeDir}"; # Garbage collector. Удалить все не используемые пакеты (например после обновы) grb = "sudo nix-collect-garbage -d"; @@ -104,4 +102,4 @@ zsh-you-should-use # Напомнит, если у написанной команды есть алиас zsh-nix-shell # zsh plugin that lets you use zsh in nix-shell shell ]; -} \ No newline at end of file +} diff --git a/modules/home-manager/wm/bspwm/bspwm.nix b/modules/home-manager/wm/bspwm/bspwm.nix index 0478602..38d1356 100644 --- a/modules/home-manager/wm/bspwm/bspwm.nix +++ b/modules/home-manager/wm/bspwm/bspwm.nix @@ -66,7 +66,8 @@ state = "floating"; }; in { # А тут правила окон - "Screenkey" = { manage = false; }; + # "Screenkey" = { manage = false; }; + # "Screenkey" = floating; "gcolor3" = floating; "obs" = floating; "steam" = floating; diff --git a/modules/nixos/bundle.nix b/modules/nixos/bundle.nix index f419665..496db83 100644 --- a/modules/nixos/bundle.nix +++ b/modules/nixos/bundle.nix @@ -9,6 +9,7 @@ ./sound.nix ./stylix.nix ./virtualisation.nix + ./vr.nix ./xserver.nix ]; } diff --git a/modules/nixos/nix-glow-gruvbox.jpg b/modules/nixos/nix-glow-gruvbox.jpg index 67009e25134c5085f447ff1462d3dbcb8e5c3dc8..4225af2cef7db53be9e80bc359a26acd43891b8c 100644 GIT binary patch delta 47 zcmeBQEYZ1GLg@dE{|^`hyxct97#JCu7-Se^8YNmK7+WQnS|ylUC0JS|Shq^Bl?ws@ DZXpcT delta 53 zcmeBNEYZJMLgN38{|_0&Tq`ou7#Mtg8MGJ}7&w5Kp;4$+h_O|Osa1%%Rfwfkh;^$F HTe% ⚠️ **Warning**: Некоторых lsp в mason не существует и их надо качать отдельно. Или они не работают в NixOS, если их качать через mason. Такие lsp я настроил отдельно и скачал как пакет. Из конфига mason я их удалил. **Не скачай случайно эти lsp через mason руками, когда они уже настроены как отдельный пакет**. Это же касается форматтеров и линтеров. Их я стараюсь качать как системный пакет, а не через mason. -> ⚠️ **Warning**: Возможно в будущем я вообще перестану что либо качать через mason, используя его только как поиск разных инструментов для нужного мне языка. Так что лучше ничего не качать через него +> ⚠️ **Warning**: Я вообще перестал качать что либо через mason, используя его только как поиск разных инструментов для нужного мне языка. Так что лучше ничего не качать через него. ## Установка На новом пк руками делаю симлинк в `~/.config/nvim`. @@ -21,6 +30,9 @@ LSP list - https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.txt ln -s ~/nixos-private-dots/nvim ~/.config/nvim ``` ### Зависимости + +Для работы этого конфига надо установить некоторые пакеты в систему. Часть из них я напишу ниже, часть находится в `packages.nix` в категории `программирование` + Это мне пришлось скачать для работы конфига на NixOS с нужными мне инструментами: - `neovim` - `git` @@ -30,35 +42,8 @@ ln -s ~/nixos-private-dots/nvim ~/.config/nvim - `xclip` на X11 или `wl-clipboard` на Wayland - `tree-sitter` - Любой nerd font -- C/C++: - - `gcc` - - `gnumake` - - `rocmPackages.llvm.clang` - - `ccls` (lsp, нет в mason) -- Lua: - - `lua5_1` - - `luajit` - - `luajitPackages.luarocks` (package manager) - - `lua-language-server` (lsp, из mason не работает на NixOS) - - `stylua` (formatter, из mason не работает на NixOS) -- Rust: - - `rustup` и потом запустить `rustup default stable` + `rustup component add rust-analyzer` в терминале - - `rust-analyzer` (lsp) -- JS/TS: - - `nodejs_23` для npm (package manager) -- Python: - - `python3Full` - - `python3Packages.pip` (package manager) - - `ruff` (linter/formatter, из mason не работает на NixOS) -- Golang: - - `go` - - `golangci-lint` (linter) - - `templ` (HTML UI in Go) -- Nix: - - `nixd` (lsp, нет в mason) -- Bash: - - `shellcheck` (linter) - - `shfmt` (formatter) + +Пакеты для разных языков могут часть меняться, так что ищем в `packages.nix` Чтоб понять есть ли проблемы с конфигом, может какие-то пакеты отсутствуют, можно запустить `:healthcheck`. @@ -68,15 +53,125 @@ ln -s ~/nixos-private-dots/nvim ~/.config/nvim ### Мои бинды -|Бинд|Действие| -|-|-| -|1|2| +Все бинды можно искать прям в neovim, если нажать `Space s k`, тоесть `S`earch `K`eymaps -### Были изначально в kickstart.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 | 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 | + + +### Git + +Бинды начинаются с буквы `h`. Типо "Git `H`unk" + +Без пробела + +| 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 | +| `hu` | Git `U`ndo stage hunk | gitsigns.lua | +| `hR` | Git `R`eset buffer | gitsigns.lua | +| `hp` | Git `P`review hunk | gitsigns.lua | +| `hb` | Git `B`lame line | gitsigns.lua | +| `hd` | Git `D`iff against index | gitsigns.lua | +| `hD` | Git `D`iff against last commit | gitsigns.lua | +| `td` | `T`oggle git show `B`lame line | gitsigns.lua | +| `tD` | `T`oggle git show `D`eleted | gitsigns.lua | +### Debug + +Без пробела + +| Bind | Description | File | +| ---- | ------------------------------ | --------- | +| `F5` | Debug: Start/Continue | debug.lua | +| `F1` | Debug: Step Into | debug.lua | +| `F2` | Debug: Step Over | debug.lua | +| `F3` | Debug: Step Out | debug.lua | +| `F7` | Debug: See last session rusult | debug.lua | +С пробелом + +| Bind | Description | File | +| ---- | -------------------------- | --------- | +| `b` | Debug: Toggle `B`reakpoint | debug.lua | +| `B` | Debug: Set `B`reakpoint | debug.lua | -|Бинд|Действие| -|-|-| -|1|2| ## Нюансы работы LSP/Linter/Formatter diff --git a/nvim/init.lua b/nvim/init.lua index 292af60..4f6c7f9 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -1,9 +1,10 @@ -- [[ Базовые настройки. Не плагины ]] require 'kickstart.settings' -require 'custom.plugins.terminal' +require 'custom.terminal' -- [[ Install `lazy.nvim` plugin manager ]] -- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info +-- git clone https://github.com/folke/lazy.nvim.git ~/.local/share/nvim/lazy/lazy.nvim local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' if not (vim.uv or vim.loop).fs_stat(lazypath) then local lazyrepo = 'https://github.com/folke/lazy.nvim.git' @@ -77,7 +78,7 @@ require('lazy').setup({ require 'kickstart.plugins.autopairs', -- Browse the file system - require 'kickstart.plugins.neo-tree', + require 'kickstart.plugins.file-tree', ------------------------------------- -- Установил руками под свои нужды -- @@ -89,6 +90,12 @@ require('lazy').setup({ -- Feature-Rich Go Plugin for Neovim require 'custom.plugins.golang', + -- Automated session manager + require 'custom.plugins.sessions', + + -- Plugins for git + require 'custom.plugins.git', + -- 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 172c156..0336ef5 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -1,52 +1,56 @@ { - "LuaSnip": { "branch": "master", "commit": "33b06d72d220aa56a7ce80a0dd6f06c70cd82b9d" }, - "catppuccin": { "branch": "main", "commit": "faf15ab0201b564b6368ffa47b56feefc92ce3f4" }, + "LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" }, + "auto-session": { "branch": "main", "commit": "021b64ed7d4ac68a37be3ad28d8e1cba5bec582c" }, + "catppuccin": { "branch": "main", "commit": "f67b886d65a029f12ffa298701fb8f1efd89295d" }, "cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, - "conform.nvim": { "branch": "master", "commit": "f4e8837878fc5712d053ba3091a73d27d96a09e2" }, - "edge": { "branch": "master", "commit": "5b5a0683be0d9d8023a874ebf7e230095f4e1bae" }, - "everforest": { "branch": "master", "commit": "44c2659ffb6d26a994346974b4d12e988f43e5e5" }, + "conform.nvim": { "branch": "master", "commit": "70019124aa4f2e6838be9fbd2007f6d13b27a96d" }, + "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, + "edge": { "branch": "master", "commit": "12ff979b43e3660053e14cd65101d5928e56f422" }, + "everforest": { "branch": "master", "commit": "84fbfc99c9853408682f104063a7ef4465dae46a" }, "fidget.nvim": { "branch": "main", "commit": "9238947645ce17d96f30842e61ba81147185b657" }, + "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, "gitsigns.nvim": { "branch": "main", "commit": "5f808b5e4fef30bd8aca1b803b4e555da07fc412" }, "go.nvim": { "branch": "master", "commit": "c6d5ca26377d01c4de1f7bff1cd62c8b43baa6bc" }, - "gruvbox-material": { "branch": "master", "commit": "fca2ff9ba627bbf172548eb52fcbb03f99ba34e9" }, + "gruvbox-material": { "branch": "master", "commit": "e41451337d33997aff4c078a83165a9f66e2d38d" }, "guihua.lua": { "branch": "master", "commit": "d783191eaa75215beae0c80319fcce5e6b3beeda" }, - "image.nvim": { "branch": "master", "commit": "b3e1af829a56bb038e5f81bf97798a2950064b62" }, + "image.nvim": { "branch": "master", "commit": "f1163cc2f6fff5b0de7c23c7502eee0df23a3e0e" }, "indent-blankline.nvim": { "branch": "master", "commit": "259357fa4097e232730341fa60988087d189193a" }, - "kanagawa.nvim": { "branch": "master", "commit": "ad3dddecd606746374ba4807324a08331dfca23c" }, + "kanagawa.nvim": { "branch": "master", "commit": "18ae5771b22d8f913ef541c827a8180b4cb12c8a" }, "lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" }, - "lazydev.nvim": { "branch": "main", "commit": "f59bd14a852ca43db38e3662395354cb2a9b13e0" }, - "luvit-meta": { "branch": "main", "commit": "57d464c4acb5c2e66bd4145060f5dc9e96a7bbb7" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "8e46de9241d3997927af12196bd8faa0ed08c29a" }, + "lazydev.nvim": { "branch": "main", "commit": "8620f82ee3f59ff2187647167b6b47387a13a018" }, + "luvit-meta": { "branch": "main", "commit": "55709f183b0742a7e4f47688c284f81148ad4dc0" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "97d9f1d3ad205dece6bcafd1d71cf1507608f3c7" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, - "mini.nvim": { "branch": "main", "commit": "7ebfab26d77a4b9b05aaae565907e7fa4b2ee154" }, + "mini.nvim": { "branch": "main", "commit": "b1af49d98233180c6045e81f4aef5b663d032b62" }, "monokai-pro.nvim": { "branch": "master", "commit": "6c15e36834a624a32f46c6db8f9fc063995b24b6" }, "neo-tree.nvim": { "branch": "main", "commit": "a77af2e764c5ed4038d27d1c463fa49cd4794e07" }, - "nightfox.nvim": { "branch": "main", "commit": "7557f26defd093c4e9bc17f28b08403f706f5a44" }, + "nightfox.nvim": { "branch": "main", "commit": "595ffb8f291fc4a9bef3201a28b7c0379a41cdee" }, "nordic.nvim": { "branch": "main", "commit": "1ee4044077059b34eacd18d93613495a602c131f" }, "nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" }, "nvim-autopairs": { "branch": "master", "commit": "b464658e9b880f463b9f7e6ccddd93fb0013f559" }, - "nvim-cmp": { "branch": "main", "commit": "3403e2e9391ed0a28c3afddd8612701b647c8e26" }, - "nvim-dap": { "branch": "master", "commit": "567da83810dd9da32f9414d941bc6848715fc102" }, + "nvim-cmp": { "branch": "main", "commit": "8c82d0bd31299dbff7f8e780f5e06d2283de9678" }, + "nvim-dap": { "branch": "master", "commit": "0e673accbb512e1e191dfb4fecea89cc38c1bcdd" }, "nvim-dap-go": { "branch": "main", "commit": "6aa88167ea1224bcef578e8c7160fe8afbb44848" }, - "nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" }, - "nvim-lint": { "branch": "master", "commit": "6b46370d02cd001509a765591a3ffc481b538794" }, - "nvim-lspconfig": { "branch": "master", "commit": "9f2c279cf9abe584f03bfeb37c6658d68e3ff49d" }, + "nvim-dap-ui": { "branch": "master", "commit": "e94d98649dccb6a3884b66aabc2e07beb279e535" }, + "nvim-lint": { "branch": "master", "commit": "dfa45de973c3ce7bd1b9a6d346f896a68ad07e44" }, + "nvim-lspconfig": { "branch": "master", "commit": "8121483b8132b7053120fafd83728178fb3febf6" }, "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, - "nvim-treesitter": { "branch": "master", "commit": "3b8dee4293567b0b9a87360842af14669f60dd13" }, - "nvim-web-devicons": { "branch": "master", "commit": "0eb18da56e2ba6ba24de7130a12bcc4e31ad11cb" }, + "nvim-treesitter": { "branch": "master", "commit": "622a4a6ba76d1de52b72a965159213ae655b4ac7" }, + "nvim-treesitter-context": { "branch": "master", "commit": "d0dd7ce5a9d0be1f28086e818e52fdc5c78975df" }, + "nvim-web-devicons": { "branch": "master", "commit": "5740b7382429d20b6ed0bbdb0694185af9507d44" }, "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, "rose-pine": { "branch": "main", "commit": "91548dca53b36dbb9d36c10f114385f759731be1" }, - "rustaceanvim": { "branch": "master", "commit": "1933318b98940b3e98ccbcd2828ae88c1bce8494" }, - "sonokai": { "branch": "master", "commit": "fd42b20963c34dfc1744ac31f6a6efe78f4edad2" }, + "rustaceanvim": { "branch": "master", "commit": "0a1876b970ab946be3f4d341e9d743a5d62d646a" }, + "sonokai": { "branch": "master", "commit": "836ad3994d3d0eaea68126cabddf6319508584e8" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "dae2eac9d91464448b584c7949a31df8faefec56" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, "todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" }, - "tokyonight.nvim": { "branch": "main", "commit": "45d22cf0e1b93476d3b6d362d720412b3d34465c" }, + "tokyonight.nvim": { "branch": "main", "commit": "7bb270adaa7692c2c33befc35f5567fc596a2504" }, "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" }, - "which-key.nvim": { "branch": "main", "commit": "8ab96b38a2530eacba5be717f52e04601eb59326" } + "which-key.nvim": { "branch": "main", "commit": "1f8d414f61e0b05958c342df9b6a4c89ce268766" } } diff --git a/nvim/lua/custom/plugins/git.lua b/nvim/lua/custom/plugins/git.lua new file mode 100644 index 0000000..238bd5e --- /dev/null +++ b/nvim/lua/custom/plugins/git.lua @@ -0,0 +1,5 @@ +return { + { + 'sindrets/diffview.nvim', + }, +} diff --git a/nvim/lua/custom/plugins/golang.lua b/nvim/lua/custom/plugins/golang.lua index 2584e94..9edbb6b 100644 --- a/nvim/lua/custom/plugins/golang.lua +++ b/nvim/lua/custom/plugins/golang.lua @@ -2,17 +2,23 @@ return { { - "ray-x/go.nvim", - dependencies = { -- optional packages - "ray-x/guihua.lua", - "neovim/nvim-lspconfig", - "nvim-treesitter/nvim-treesitter", + 'ray-x/go.nvim', + dependencies = { -- optional packages + 'ray-x/guihua.lua', + 'neovim/nvim-lspconfig', + 'nvim-treesitter/nvim-treesitter', }, config = function() - require("go").setup() + 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' }) end, - event = {"CmdlineEnter"}, - ft = {"go", 'gomod'}, + event = { 'CmdlineEnter' }, + ft = { 'go', 'gomod' }, -- build = ':lua require("go.install").update_all_sync()' -- if you need to install/update all binaries - } + }, } diff --git a/nvim/lua/custom/plugins/sessions.lua b/nvim/lua/custom/plugins/sessions.lua new file mode 100644 index 0000000..ba4d10d --- /dev/null +++ b/nvim/lua/custom/plugins/sessions.lua @@ -0,0 +1,16 @@ +-- A small automated session manager for Neovim + +return { + { + 'rmagatti/auto-session', + lazy = false, + + ---enables autocomplete for opts + ---@module "auto-session" + ---@type AutoSession.Config + opts = { + suppressed_dirs = { '~/', '~/Projects', '~/Downloads', '/' }, + -- log_level = 'debug', + }, + }, +} diff --git a/nvim/lua/custom/plugins/terminal.lua b/nvim/lua/custom/plugins/terminal.lua deleted file mode 100644 index 9d69f20..0000000 --- a/nvim/lua/custom/plugins/terminal.lua +++ /dev/null @@ -1,58 +0,0 @@ -vim.keymap.set("t", "", "") - -local state = { - floating = { - buf = -1, - win = -1, - } -} - -local function create_floating_window(opts) - opts = opts or {} - local width = opts.width or math.floor(vim.o.columns * 0.8) - local height = opts.height or math.floor(vim.o.lines * 0.8) - - -- Calculate the position to center the window - local col = math.floor((vim.o.columns - width) / 2) - local row = math.floor((vim.o.lines - height) / 2) - - -- Create a buffer - local buf = nil - if vim.api.nvim_buf_is_valid(opts.buf) then - buf = opts.buf - else - buf = vim.api.nvim_create_buf(false, true) -- No file, scratch buffer - end - - -- Define window configuration - local win_config = { - relative = "editor", - width = width, - height = height, - col = col, - row = row, - style = "minimal", -- No borders or extra UI elements - border = "rounded", - } - - -- Create the floating window - local win = vim.api.nvim_open_win(buf, true, win_config) - - return { buf = buf, win = win } -end - -local toggle_terminal = function() - if not vim.api.nvim_win_is_valid(state.floating.win) then - state.floating = create_floating_window { buf = state.floating.buf } - if vim.bo[state.floating.buf].buftype ~= "terminal" then - vim.cmd.terminal() - end - else - vim.api.nvim_win_hide(state.floating.win) - end -end - --- Example usage: --- Create a floating window with default dimensions -vim.api.nvim_create_user_command("Floaterminal", toggle_terminal, {}) -vim.keymap.set({ "n", "t" }, "tt", toggle_terminal, { desc = '[T]oggle [T]erminal' }) diff --git a/nvim/lua/custom/terminal.lua b/nvim/lua/custom/terminal.lua new file mode 100644 index 0000000..08be5dc --- /dev/null +++ b/nvim/lua/custom/terminal.lua @@ -0,0 +1,56 @@ +local state = { + floating = { + buf = -1, + win = -1, + }, +} + +local function create_floating_window(opts) + opts = opts or {} + local width = opts.width or math.floor(vim.o.columns * 0.8) + local height = opts.height or math.floor(vim.o.lines * 0.8) + + -- Calculate the position to center the window + local col = math.floor((vim.o.columns - width) / 2) + local row = math.floor((vim.o.lines - height) / 2) + + -- Create a buffer + local buf = nil + if vim.api.nvim_buf_is_valid(opts.buf) then + buf = opts.buf + else + buf = vim.api.nvim_create_buf(false, true) -- No file, scratch buffer + end + + -- Define window configuration + local win_config = { + relative = 'editor', + width = width, + height = height, + col = col, + row = row, + style = 'minimal', -- No borders or extra UI elements + border = 'rounded', + } + + -- Create the floating window + local win = vim.api.nvim_open_win(buf, true, win_config) + + return { buf = buf, win = win } +end + +local toggle_terminal = function() + if not vim.api.nvim_win_is_valid(state.floating.win) then + state.floating = create_floating_window { buf = state.floating.buf } + if vim.bo[state.floating.buf].buftype ~= 'terminal' then + vim.cmd.terminal() + end + else + vim.api.nvim_win_hide(state.floating.win) + end +end + +-- Example usage: +-- Create a floating window with default dimensions +vim.api.nvim_create_user_command('Floaterminal', toggle_terminal, {}) +vim.keymap.set({ 'n', 't' }, 'tt', toggle_terminal, { desc = '[T]oggle [T]erminal' }) diff --git a/nvim/lua/kickstart/plugins/autoformat.lua b/nvim/lua/kickstart/plugins/autoformat.lua index f0fe22b..4de5c4a 100644 --- a/nvim/lua/kickstart/plugins/autoformat.lua +++ b/nvim/lua/kickstart/plugins/autoformat.lua @@ -70,4 +70,5 @@ return { }, }, }, -} \ No newline at end of file +} + diff --git a/nvim/lua/kickstart/plugins/completion.lua b/nvim/lua/kickstart/plugins/completion.lua index af44d26..5b0d3aa 100644 --- a/nvim/lua/kickstart/plugins/completion.lua +++ b/nvim/lua/kickstart/plugins/completion.lua @@ -21,12 +21,12 @@ return { -- `friendly-snippets` contains a variety of premade snippets. -- See the README about individual language/framework/plugin snippets: -- https://github.com/rafamadriz/friendly-snippets - -- { - -- 'rafamadriz/friendly-snippets', - -- config = function() - -- require('luasnip.loaders.from_vscode').lazy_load() - -- end, - -- }, + { + 'rafamadriz/friendly-snippets', + config = function() + require('luasnip.loaders.from_vscode').lazy_load() + end, + }, }, }, 'saadparwaiz1/cmp_luasnip', @@ -44,6 +44,7 @@ return { luasnip.config.setup {} cmp.setup { + preselect = cmp.PreselectMode.None, snippet = { expand = function(args) luasnip.lsp_expand(args.body) @@ -56,25 +57,38 @@ return { -- -- No, but seriously. Please read `:help ins-completion`, it is really good! mapping = cmp.mapping.preset.insert { + -- (enabled by default in nvim-cmp) -- Select the [n]ext item - [''] = cmp.mapping.select_next_item(), + -- [''] = cmp.mapping.select_next_item(), -- Select the [p]revious item - [''] = cmp.mapping.select_prev_item(), - - -- Scroll the documentation window [b]ack / [f]orward - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), + -- [''] = cmp.mapping.select_prev_item(), -- Accept ([y]es) the completion. -- This will auto-import if your LSP supports it. -- This will expand snippets if the LSP sent a snippet. - [''] = cmp.mapping.confirm { select = true }, + -- [''] = cmp.mapping.confirm { select = true }, -- If you prefer more traditional completion keymaps, -- you can uncomment the following lines - --[''] = cmp.mapping.confirm { select = true }, - --[''] = cmp.mapping.select_next_item(), - --[''] = cmp.mapping.select_prev_item(), + -- [''] = cmp.mapping.confirm { select = true }, + [''] = cmp.mapping.select_next_item(), + [''] = cmp.mapping.select_prev_item(), + + -- Allows Up arrow to fall back without interacting with cmp + [''] = cmp.mapping(function(fallback) + cmp.close() + fallback() + end, { 'i', 'c' }), + + -- Allows Up arrow to fall back without interacting with cmp + [''] = cmp.mapping(function(fallback) + cmp.close() + fallback() + end, { 'i', 'c' }), + + -- Scroll the documentation window [b]ack / [f]orward + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), -- Manually trigger a completion from nvim-cmp. -- Generally you don't need this, because nvim-cmp will display @@ -116,4 +130,4 @@ return { } end, }, -} \ No newline at end of file +} diff --git a/nvim/lua/kickstart/plugins/neo-tree.lua b/nvim/lua/kickstart/plugins/file-tree.lua similarity index 88% rename from nvim/lua/kickstart/plugins/neo-tree.lua rename to nvim/lua/kickstart/plugins/file-tree.lua index 3a35ff5..da9df01 100644 --- a/nvim/lua/kickstart/plugins/neo-tree.lua +++ b/nvim/lua/kickstart/plugins/file-tree.lua @@ -10,11 +10,11 @@ return { 'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended 'MunifTanjim/nui.nvim', { -- Optional image support in preview window: See `# Preview Mode` for more information - "3rd/image.nvim", + '3rd/image.nvim', build = false, -- so that it doesn't build the rock opts = { - backend = "ueberzug", -- or "kitty" - processor = "magick_cli", -- or "magick_rock" + backend = 'ueberzug', -- or "kitty" + processor = 'magick_cli', -- or "magick_rock" }, }, }, diff --git a/nvim/lua/kickstart/plugins/lsp.lua b/nvim/lua/kickstart/plugins/lsp.lua index a1a9553..695c852 100644 --- a/nvim/lua/kickstart/plugins/lsp.lua +++ b/nvim/lua/kickstart/plugins/lsp.lua @@ -92,7 +92,8 @@ return { -- Fuzzy find all the symbols in your current document. -- Symbols are things like variables, functions, types, etc. - map('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') + -- Было ds [D]ocument [S]ymbols + map('S', require('telescope.builtin').lsp_document_symbols, 'Document [S]ymbols') -- Fuzzy find all the symbols in your current workspace. -- Similar to document symbols, except searches over your entire project. @@ -153,12 +154,12 @@ return { -- Change diagnostic symbols in the sign column (gutter) if vim.g.have_nerd_font then - local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' } - local diagnostic_signs = {} - for type, icon in pairs(signs) do - diagnostic_signs[vim.diagnostic.severity[type]] = icon - end - vim.diagnostic.config { signs = { text = diagnostic_signs } } + local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' } + local diagnostic_signs = {} + for type, icon in pairs(signs) do + diagnostic_signs[vim.diagnostic.severity[type]] = icon + end + vim.diagnostic.config { signs = { text = diagnostic_signs } } end -- LSP servers and clients are able to communicate to each other what features they support. @@ -178,17 +179,18 @@ return { -- - on_attach (func): Функция, которая вызывается, когда LSP подключается к буферу -- - settings (table): Override the default settings passed when initializing the server. -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ - local servers = { -- WARN: Качает через mason. Может не работать в NixOS. Оставил для других OS на будущее - -- See `:help lspconfig-all` for a list of all the pre-configured LSPs - -- - -- Some languages (like typescript) have entire language plugins that can be useful: - -- https://github.com/pmizio/typescript-tools.nvim - -- - -- But for many setups, the LSP (`ts_ls`) will work just fine - -- taplo - } + local servers = + { -- WARN: Качает через mason. Может не работать в NixOS. Оставил для других OS на будущее + -- See `:help lspconfig-all` for a list of all the pre-configured LSPs + -- + -- Some languages (like typescript) have entire language plugins that can be useful: + -- https://github.com/pmizio/typescript-tools.nvim + -- + -- But for many setups, the LSP (`ts_ls`) will work just fine + -- taplo + } - local lspconfig = require('lspconfig') + local lspconfig = require 'lspconfig' -- Nix lspconfig.nixd.setup {} @@ -231,7 +233,6 @@ return { end, } - -- Lua lspconfig.lua_ls.setup { settings = { @@ -282,7 +283,6 @@ return { lspconfig.vimls.setup {} lspconfig.yamlls.setup {} - -- Ensure the servers and tools above are installed -- To check the current status of installed tools and/or manually install -- other tools, you can run @@ -312,5 +312,5 @@ return { }, } end, - }, -} \ No newline at end of file + }, +} diff --git a/nvim/lua/kickstart/plugins/mini.lua b/nvim/lua/kickstart/plugins/mini.lua index cf3d2cd..22f7f19 100644 --- a/nvim/lua/kickstart/plugins/mini.lua +++ b/nvim/lua/kickstart/plugins/mini.lua @@ -39,4 +39,3 @@ return { end, }, } - diff --git a/nvim/lua/kickstart/plugins/telescope.lua b/nvim/lua/kickstart/plugins/telescope.lua index 0fd61dd..c6bf852 100644 --- a/nvim/lua/kickstart/plugins/telescope.lua +++ b/nvim/lua/kickstart/plugins/telescope.lua @@ -90,13 +90,16 @@ return { vim.keymap.set('n', 'sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' }) vim.keymap.set('n', 'sr', builtin.resume, { desc = '[S]earch [R]esume' }) vim.keymap.set('n', 's.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) - vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) + vim.keymap.set('n', '', function() + builtin.buffers { sort_mru = true, ignore_current_buffer = true } + end, { desc = '[ ] Find etisting buffers' }) + vim.keymap.set('n', 'st', ':Telescope colorscheme', { desc = '[S]earch [T]hemes' }) -- Slightly advanced example of overriding default behavior and theme vim.keymap.set('n', '/', function() -- You can pass additional configuration to Telescope to change the theme, layout, etc. builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { - winblend = 10, + -- winblend = 10, previewer = false, }) end, { desc = '[/] Fuzzily search in current buffer' }) diff --git a/nvim/lua/kickstart/plugins/themes.lua b/nvim/lua/kickstart/plugins/themes.lua index 52de299..d54772c 100644 --- a/nvim/lua/kickstart/plugins/themes.lua +++ b/nvim/lua/kickstart/plugins/themes.lua @@ -5,9 +5,9 @@ -- Чтоб сменить стандартную тему, надо раскомментировать vim.cmd.colorscheme пад именем темы -- и закомментировать это же у прошлой темы --- В lazy.nvim параметр priority определяет порядок загрузки плагинов. --- Чем выше значение priority, тем раньше загружается плагин. --- Это особенно важно для тем, поскольку они часто требуют загрузки до других плагинов, +-- В lazy.nvim параметр priority определяет порядок загрузки плагинов. +-- Чем выше значение priority, тем раньше загружается плагин. +-- Это особенно важно для тем, поскольку они часто требуют загрузки до других плагинов, -- чтобы корректно применить стили. -- https://dotfyle.com/neovim/colorscheme/top @@ -17,18 +17,17 @@ local variants = { 'default', 'atlantis', 'andromeda', 'shusia', 'maia', 'espres -- Создаем псевдонимы для каждой темы for _, variant in ipairs(variants) do - local alias = "sonokai-" .. variant - vim.api.nvim_create_user_command("Colorscheme" .. variant, function() - vim.g.sonokai_style = variant - vim.cmd("colorscheme sonokai") - end, {}) + local alias = 'sonokai-' .. variant + vim.api.nvim_create_user_command('Colorscheme' .. variant, function() + vim.g.sonokai_style = variant + vim.cmd 'colorscheme sonokai' + end, {}) - -- Регистрируем в Neovim как отдельный colorscheme - vim.api.nvim_set_hl(0, alias, {}) - vim.cmd(string.format("autocmd ColorSchemePre %s let g:sonokai_style = '%s' | colorscheme sonokai", alias, variant)) + -- Регистрируем в Neovim как отдельный colorscheme + vim.api.nvim_set_hl(0, alias, {}) + vim.cmd(string.format("autocmd ColorSchemePre %s let g:sonokai_style = '%s' | colorscheme sonokai", alias, variant)) end - return { { 'folke/tokyonight.nvim', @@ -62,7 +61,7 @@ return { name = 'catppuccin', priority = 1000, config = function() - -- 'catppuccin', 'catppuccin-latte', 'catppuccin-frappe', + -- 'catppuccin', 'catppuccin-latte', 'catppuccin-frappe', -- 'catppuccin-macchiato', 'catppuccin-mocha' -- vim.cmd.colorscheme 'catppuccin' end, @@ -71,12 +70,12 @@ return { 'rebelot/kanagawa.nvim', priority = 1000, config = function() - -- 'kanagawa-wave', 'kanagawa-dragon', 'kanagawa-lotus', + -- 'kanagawa-wave', 'kanagawa-dragon', 'kanagawa-lotus', -- vim.cmd.colorscheme 'kanagawa-dragon' end, }, { - "EdenEast/nightfox.nvim", + 'EdenEast/nightfox.nvim', priority = 1000, config = function() -- 'nightfox', 'dayfox', 'dawnfox', 'duskfox' @@ -147,4 +146,5 @@ return { -- vim.cmd.colorscheme 'edge' end, }, -} \ No newline at end of file +} + diff --git a/nvim/lua/kickstart/plugins/todo-comments.lua b/nvim/lua/kickstart/plugins/todo-comments.lua index 3b65db0..ced1ffa 100644 --- a/nvim/lua/kickstart/plugins/todo-comments.lua +++ b/nvim/lua/kickstart/plugins/todo-comments.lua @@ -8,4 +8,3 @@ return { opts = { signs = false }, }, } - diff --git a/nvim/lua/kickstart/plugins/treesitter.lua b/nvim/lua/kickstart/plugins/treesitter.lua index 9385844..ef3464d 100644 --- a/nvim/lua/kickstart/plugins/treesitter.lua +++ b/nvim/lua/kickstart/plugins/treesitter.lua @@ -53,5 +53,28 @@ return { -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects }, + { + 'nvim-treesitter/nvim-treesitter-context', + dependencies = { 'nvim-treesitter/nvim-treesitter' }, + config = function() + require('treesitter-context').setup { + enable = true, -- Enable this plugin (Can be enabled/disabled later via commands) + multiwindow = false, -- Enable multiwindow support. + max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit. + min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit. + line_numbers = true, + multiline_threshold = 3, -- Maximum number of lines to show for a single context + trim_scope = 'outer', -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer' + mode = 'cursor', -- Line used to calculate context. Choices: 'cursor', 'topline' + -- Separator between context and content. Should be a single character string, like '-'. + -- When separator is set, the context will only show up when there are at least 2 lines above cursorline. + separator = nil, + zindex = 20, -- The Z-index of the context window + on_attach = nil, -- (fun(buf: integer): boolean) return false to disable attaching + } + vim.keymap.set('n', 'gp', function() + require('treesitter-context').go_to_context(vim.v.count1) + end, { silent = true, desc = '[G]oto context ([P]arent)' }) + end, + }, } - diff --git a/nvim/lua/kickstart/plugins/vim-sleuth.lua b/nvim/lua/kickstart/plugins/vim-sleuth.lua index a9c0705..d882bcd 100644 --- a/nvim/lua/kickstart/plugins/vim-sleuth.lua +++ b/nvim/lua/kickstart/plugins/vim-sleuth.lua @@ -1,4 +1,5 @@ -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). return { 'tpope/vim-sleuth', -- Detect expandtab and shiftwidth automatically -} \ No newline at end of file +} + diff --git a/nvim/lua/kickstart/plugins/which-key.lua b/nvim/lua/kickstart/plugins/which-key.lua index 318aae6..8fd2e8e 100644 --- a/nvim/lua/kickstart/plugins/which-key.lua +++ b/nvim/lua/kickstart/plugins/which-key.lua @@ -60,13 +60,15 @@ return { -- Document existing key chains spec = { { 'c', group = '[C]ode', mode = { 'n', 'x' } }, - { 'd', group = '[D]ocument' }, + -- { 'd', group = '[D]ocument' }, { 'r', group = '[R]ename' }, { 's', group = '[S]earch' }, { 'w', group = '[W]orkspace' }, { 't', group = '[T]oggle' }, + { 'g', group = '[G]olang' }, + { 'gt', group = '[G]olang [T]ag' }, { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, }, }, }, -} \ No newline at end of file +} diff --git a/nvim/lua/kickstart/settings.lua b/nvim/lua/kickstart/settings.lua index 75c2777..96736e0 100644 --- a/nvim/lua/kickstart/settings.lua +++ b/nvim/lua/kickstart/settings.lua @@ -19,6 +19,7 @@ vim.opt.relativenumber = true -- Табуляция в 4 символа vim.opt.tabstop = 4 +-- vim.opt.shiftwidth = 4 -- Enable mouse mode, can be useful for resizing splits for example! vim.opt.mouse = 'a' @@ -30,9 +31,29 @@ vim.opt.showmode = false -- Schedule the setting after `UiEnter` because it can increase startup-time. -- Remove this option if you want your OS clipboard to remain independent. -- See `:help 'clipboard'` -vim.schedule(function() - vim.opt.clipboard = 'unnamedplus' -end) +-- vim.schedule(function() +-- vim.opt.clipboard = 'unnamedplus' +-- end) + +-- Use system clipboard via y/d, but Neovim clipboard via just y/d +vim.keymap.set('n', 'y', '"+y', { desc = '[Y]ank to system clipboard' }) +vim.keymap.set('v', 'y', '"+y', { desc = '[Y]ank to system clipboard' }) +-- vim.keymap.set('n', 'Y', '"+Y', { desc = '[Y]ank to system clipboard' }) +vim.keymap.set('n', 'd', '"_d', { desc = '[D]elete to system clipboard' }) +vim.keymap.set('v', 'd', '"_d', { desc = '[D]elete to system clipboard' }) + +-- Change `K` hover documentation size +vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, { + -- border = 'rounded', + max_width = 80, + -- max_height = 15, +}) + +-- Move lines in visual mode +vim.keymap.set('v', '', ":m '>+1gv=gv") +vim.keymap.set('v', '', ":m '>+1gv=gv") +vim.keymap.set('v', '', ":m '<-2gv=gv") +vim.keymap.set('v', '', ":m '<-2gv=gv") -- Enable break indent vim.opt.breakindent = true @@ -40,6 +61,15 @@ vim.opt.breakindent = true -- Save undo history vim.opt.undofile = true +-- Disable swap file +vim.opt.swapfile = false + +-- Settings for sessions +vim.o.sessionoptions = 'blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions' + +-- Highlight a vertical line at the specified column to encourage keeping lines within this limit +vim.opt.colorcolumn = '100' + -- Case-insensitive searching UNLESS \C or one or more capital letters in the search term vim.opt.ignorecase = true vim.opt.smartcase = true @@ -105,6 +135,11 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the left wind vim.keymap.set('n', '', '', { desc = 'Move focus to the right window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) +-- Use CTRL+arrows to switch between windows +vim.keymap.set('n', '', '', { desc = 'Move focus to the left window' }) +vim.keymap.set('n', '', '', { desc = 'Move focus to the right window' }) +vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) +vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) -- [[ Basic Autocommands ]] -- See `:help lua-guide-autocommands` @@ -113,9 +148,9 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the upper win -- Try it with `yap` in normal mode -- See `:help vim.highlight.on_yank()` vim.api.nvim_create_autocmd('TextYankPost', { - desc = 'Highlight when yanking (copying) text', - group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), - callback = function() - vim.highlight.on_yank() - end, -}) \ No newline at end of file + desc = 'Highlight when yanking (copying) text', + group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), + callback = function() + vim.highlight.on_yank() + end, +}) diff --git a/nvim/shit.md b/nvim/shit.md index 2210dab..7bcc33d 100644 --- a/nvim/shit.md +++ b/nvim/shit.md @@ -1,10 +1,5 @@ Тут будут куски текста из разных источников. Я не хочу засирать ими свои заметки, кину сюда -```sql -select * from pidor -``` - - ## На будущее Fix C/C++ - https://www.reddit.com/r/NixOS/comments/1d7zvgu/nvim_cant_find_standard_library_headers/ diff --git a/shit/mimeapps.list b/shit/mimeapps.list index 40654a2..dd14fd1 100644 --- a/shit/mimeapps.list +++ b/shit/mimeapps.list @@ -6,7 +6,7 @@ application/xml=nvim.desktop;codium.desktop application/yaml=nvim.desktop;codium.desktop image/*=com.interversehq.qView.desktop;imv.desktop image/apng=com.interversehq.qView.desktop;imv.desktop -image/avif=imv.desktop;com.interversehq.qView.desktop +image/avif=imv.desktop image/gif=com.interversehq.qView.desktop;imv.desktop image/jpeg=;com.interversehq.qView.desktop;imv.desktop; image/pjpeg=com.interversehq.qView.desktop;imv.desktop @@ -56,7 +56,7 @@ audio/x-mpegurl=mpv.desktop audio/x-opus+ogg=mpv.desktop image/*=com.interversehq.qView.desktop;imv.desktop image/apng=com.interversehq.qView.desktop;imv.desktop -image/avif=imv.desktop;com.interversehq.qView.desktop +image/avif=imv.desktop image/gif=com.interversehq.qView.desktop;imv.desktop image/jpeg=com.interversehq.qView.desktop;imv.desktop image/pjpeg=com.interversehq.qView.desktop;imv.desktop