From 1f7e2bd3c800c0cebe355c9a00780e7926027e58 Mon Sep 17 00:00:00 2001 From: Baipyrus Date: Thu, 25 Jul 2024 20:34:16 +0200 Subject: [PATCH] bugfix: merge after effects and general clean up --- CHANGELOG.md | 85 +++++++++++++++++++++++++++ README.md | 12 ++-- init.lua | 1 + lua/custom/plugins/conflictmarker.lua | 5 +- lua/keymaps.lua | 1 + lua/kickstart/plugins/cmp.lua | 14 +++-- lua/kickstart/plugins/conform.lua | 4 +- lua/kickstart/plugins/lspconfig.lua | 3 + lua/kickstart/plugins/treesitter.lua | 9 --- lua/kickstart/plugins/which-key.lua | 2 +- lua/lazy-plugins.lua | 7 +-- lua/options.lua | 2 +- 12 files changed, 112 insertions(+), 33 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..64656b0 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,85 @@ +## [README.md](./README.md) + +- [x] Language utils: Add new entries +- [x] Change `Install Kickstart` to `Install Config` +- [x] Change `### Install this Configuration` to `#### Recommended Step` +- [x] Remove `Post Installation` +- [x] FAQ: Distro Alias: + ```markdown + You can apply both of these approaches to any Neovim + distribution that you would like to try out. + ``` + + +## [init.lua](./init.lua) +- [x] Add `NOTE` for `vim.g.mapleader`: + ```lua + -- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) + ``` + + +## [lua/custom/plugins/conflictmarker.lua](./lua/custom/plugins/conflictmarker.lua) + +- [x] Add logic to `git_conflict_detection`: + ```lua + local enabled = vim.diagnostic.is_enabled() + ``` + + +## [lua/keymaps.lua](./lua/keymaps.lua) + +- [x] Add `NOTE` for ``: + ```lua + -- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping + ``` +- [ ] Optional: Add `Insert` mode to arrow keymaps + + +## [lua/kickstart/plugins/cmp.lua](./lua/kickstart/plugins/cmp.lua) + +- [x] `friendly-snippets`: + ```lua + -- `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, + }, + ``` + + +## [lua/kickstart/plugins/lspconfig.lua](./lua/kickstart/plugins/lspconfig.lua) + +- [x] Add `markdownlint` via `markdown-tool-installer` + + +## [lua/kickstart/plugins/conform.lua](./lua/kickstart/plugins/conform.lua) + +- [x] Uncomment `python` formatters + + +## [lua/kickstart/plugins/treesitter.lua](./lua/kickstart/plugins/treesitter.lua) + +- [x] Remove empty file on line `2` +- [x] Remove Autotag and -rename: + - [x] Line 6 + - [x] Line 44-50 + + +## [lua/kickstart/plugins/which-key.lua](./lua/kickstart/plugins/which-key.lua) + +- [x] Add `Terminal` to `t` keymap + + +## [lua/lazy-plugins.lua](./lua/lazy-plugins.lua) + +- [x] Optional: Readd `tpope/vim-sleuth` +- [x] Optional: Remove `numToStr/Comment.nvim` + + +## [lua/options.lua](./lua/options.lua) + +- [x] Change `vim.api.nvim_exec2` to `vim.cmd` diff --git a/README.md b/README.md index dec3894..bf64153 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ External Requirements: - [ripgrep](https://github.com/BurntSushi/ripgrep#installation) - Clipboard tool (xclip/xsel/win32yank or other depending on platform) - A [Nerd Font](https://www.nerdfonts.com/): provides various icons -- Language utils: `rustup`, `npm`, `dotnet`, `python` +- Language utils: `rustup`, `npm`, `dotnet`, `python`, `golang`, `composer` - Optionally, install [Alacritty](https://github.com/alacritty/alacritty#installation) - Or on Windows, just install using `winget install alacritty --source winget` @@ -28,7 +28,7 @@ External Requirements: > See [Install Recipes](#Install-Recipes) for additional Windows and Linux specific notes > and quick install snippets -### Install Kickstart +### Install Config > **NOTE** > [Backup](#FAQ) your previous configuration (if any exists) @@ -41,7 +41,7 @@ Neovim's configurations are located under the following paths, depending on your | Windows (cmd)| `%localappdata%\nvim\` | | Windows (powershell)| `$env:LOCALAPPDATA\nvim\` | -### Install this Configuration +#### Recommended Step Clone it from GitHub: @@ -71,10 +71,6 @@ git clone https://github.com/Baipyrus/nvim-config.git $env:LOCALAPPDATA\nvim\ ### Post Installation -
Extras for Linux and Mac -In the [`options`](./lua/options.lua) file, change the settings to specify the terminal of your choice. This installation is used and maintained by a Windows user and, as such, will use Powershell. This setting may need to be updated after each upgrade. -
- Start Neovim ```sh @@ -104,6 +100,8 @@ current plugin status. Hit `q` to close the window. ```pwsh $env:NVIM_APPNAME = 'nvim-kickstart'; nvim ``` + You can apply both of these approaches to any Neovim + distribution that you would like to try out. * What if I want to "uninstall" this configuration: * See [lazy.nvim uninstall](https://github.com/folke/lazy.nvim#-uninstalling) information diff --git a/init.lua b/init.lua index 854e98f..0589969 100644 --- a/init.lua +++ b/init.lua @@ -1,5 +1,6 @@ -- Set as the leader key -- See `:help mapleader` +-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' diff --git a/lua/custom/plugins/conflictmarker.lua b/lua/custom/plugins/conflictmarker.lua index 4f083ce..4bc246d 100644 --- a/lua/custom/plugins/conflictmarker.lua +++ b/lua/custom/plugins/conflictmarker.lua @@ -22,9 +22,10 @@ return { -- Check if strict regex is contained in any line local beginning = vim.fn.match(lines, vim.g.conflict_marker_begin) local ending = vim.fn.match(lines, vim.g.conflict_marker_end) - if beginning > -1 or ending > -1 then + local enabled = vim.diagnostic.is_enabled() + if (beginning > -1 or ending > -1) and enabled then vim.diagnostic.enable(false) - else + elseif not enabled then vim.diagnostic.enable(true) end end diff --git a/lua/keymaps.lua b/lua/keymaps.lua index 1570330..b94eeb4 100644 --- a/lua/keymaps.lua +++ b/lua/keymaps.lua @@ -12,6 +12,7 @@ vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'Show diagn vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) -- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier +-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) -- Open terminal in current window diff --git a/lua/kickstart/plugins/cmp.lua b/lua/kickstart/plugins/cmp.lua index 51d0646..e13f0bd 100644 --- a/lua/kickstart/plugins/cmp.lua +++ b/lua/kickstart/plugins/cmp.lua @@ -25,11 +25,15 @@ return { 'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-path', - -- If you want to add a bunch of pre-configured snippets, - -- you can use this plugin to help you. It even has snippets - -- for various frameworks/libraries/etc. but you will have to - -- set up the ones that are useful for you. - 'rafamadriz/friendly-snippets', + -- `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, + }, }, config = function() -- See `:help cmp` diff --git a/lua/kickstart/plugins/conform.lua b/lua/kickstart/plugins/conform.lua index 943d262..52d68af 100644 --- a/lua/kickstart/plugins/conform.lua +++ b/lua/kickstart/plugins/conform.lua @@ -28,8 +28,8 @@ return { formatters_by_ft = { lua = { 'stylua' }, -- Conform can also run multiple formatters sequentially - -- python = { "isort", "black" }, - -- + python = { 'isort', 'black' }, + -- You can use a sub-list to tell conform to run *until* a formatter -- is found. javascript = { { 'prettierd', 'prettier' } }, diff --git a/lua/kickstart/plugins/lspconfig.lua b/lua/kickstart/plugins/lspconfig.lua index 0cb6b34..e0daba5 100644 --- a/lua/kickstart/plugins/lspconfig.lua +++ b/lua/kickstart/plugins/lspconfig.lua @@ -214,6 +214,9 @@ return { 'eslint_d', 'prettier', 'prettierd', + 'markdownlint', + 'isort', + 'black', }) require('mason-tool-installer').setup { ensure_installed = ensure_installed } diff --git a/lua/kickstart/plugins/treesitter.lua b/lua/kickstart/plugins/treesitter.lua index d6bd234..bfa5b95 100644 --- a/lua/kickstart/plugins/treesitter.lua +++ b/lua/kickstart/plugins/treesitter.lua @@ -1,9 +1,7 @@ return { - { -- Highlight, edit, and navigate code 'nvim-treesitter/nvim-treesitter', dependencies = { - 'windwp/nvim-ts-autotag', 'nvim-treesitter/nvim-treesitter-context', 'nvim-treesitter/nvim-treesitter-textobjects', }, @@ -41,13 +39,6 @@ return { ignore_install = { 'arduino', }, - -- Enable autotags and -rename - autotag = { - enable = true, - enable_close = true, - enable_rename = true, - enable_autocmd = true, - }, highlight = { enable = true, -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules. diff --git a/lua/kickstart/plugins/which-key.lua b/lua/kickstart/plugins/which-key.lua index eddbedf..a0d711f 100644 --- a/lua/kickstart/plugins/which-key.lua +++ b/lua/kickstart/plugins/which-key.lua @@ -26,7 +26,7 @@ return { { 'r', group = '[R]ename' }, { 's', group = '[S]earch' }, { 'w', group = '[W]orkspace' }, - { 't', group = '[T]oggle', mode = { 'n', 'v' } }, + { 't', group = '[T]oggle/[T]erminal', mode = { 'n', 'v' } }, { 'h', group = 'Git [H]unk/[H]arpoon', mode = { 'n', 'v' } }, { 'g', group = '[G]it/[G]lobal', mode = { 'n', 'v' } }, { 'b', group = '[B]uffer/[B]reakpoint' }, diff --git a/lua/lazy-plugins.lua b/lua/lazy-plugins.lua index 9b4a91f..7273a26 100644 --- a/lua/lazy-plugins.lua +++ b/lua/lazy-plugins.lua @@ -18,18 +18,13 @@ require('lazy').setup({ -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). 'sophacles/vim-processing', -- Processing-Java + 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically -- NOTE: Plugins can also be added by using a table, -- with the first argument being the link and the following -- keys can be used to configure plugin behavior/loading/etc. -- -- Use `opts = {}` to force a plugin to be loaded. - -- - -- This is equivalent to: - -- require('Comment').setup({}) - - -- "gc" to comment visual regions/lines - { 'numToStr/Comment.nvim', opts = {} }, -- modular approach: using `require 'path/name'` will -- include a plugin definition from file lua/path/name.lua diff --git a/lua/options.lua b/lua/options.lua index 51af581..35f726e 100644 --- a/lua/options.lua +++ b/lua/options.lua @@ -4,7 +4,7 @@ -- For more options, you can see `:help option-list` -- Set display language -vim.api.nvim_exec2('language en_US', {}) +vim.cmd('language en_US', {}) -- Shell options -- Sets the shell to use for system() and ! commands in windows