Skip to content

Commit

Permalink
feat: nvim 0.10 updates, add extras
Browse files Browse the repository at this point in the history
  • Loading branch information
rafi committed May 17, 2024
1 parent 3d9c68b commit 8408fb3
Show file tree
Hide file tree
Showing 18 changed files with 170 additions and 64 deletions.
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Syntax style
# https://spec.editorconfig.org/

root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
max_line_length = 80
insert_final_newline = true
trim_trailing_whitespace = true

[{*.go,*.lua,Makefile,.gitmodules,go.mod,go.sum}]
indent_style = tab

[*.{js,jsx,ts,tsx,css,less,sass,scss,vue,py}]
indent_size = 4
11 changes: 11 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"default": true,
"line-length": false,
"single-trailing-newline": false,
"no-space-in-code": false,
"no-inline-html": {
"allowed_elements": [
"a", "i", "strong", "center", "kbd", "small", "details", "summary"
]
}
}
9 changes: 8 additions & 1 deletion .neoconf.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
"neodev": {
"library": {
"enabled": true,
"plugins": [ "plenary.nvim" ]
"plugins": [
"LazyVim"
,"plenary.nvim"
,"lazy.nvim"
,"noice.nvim"
,"conform.nvim"
,"nvim-cmp"
]
}
},
"neoconf": {
Expand Down
8 changes: 8 additions & 0 deletions .stylua.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
column_width = 80
line_endings = "Unix"
indent_type = "Tabs"
indent_width = 2
quote_style = "AutoPreferSingle"
call_parentheses = "Always"
[sort_requires]
enabled = true
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ endif
"$(XDG_CACHE_HOME)/nvim/venv/bin/pip" install -U pynvim

test:
$(info Testing for NVIM >= 0.9.x)
$(if $(shell nvim --version | egrep 'NVIM v0\.(9|10)\.'),\
$(info Testing for NVIM >= 0.10.x)
$(if $(shell nvim --version | egrep 'NVIM v0\.1[0-9]\.'),\
$(info OK),\
$(error .. You need Neovim 0.9.x or newer))
$(error .. You need Neovim 0.10.x or newer))
@echo All tests passed, hooray!

.PHONY: install update create-dirs update-repo update-plugins uninstall venv test
31 changes: 17 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Rafael Bodill's Neovim Config

Lean mean Neovim machine, 30-45ms startup time. Works best with [Neovim] ≥0.9
Lean mean Neovim machine, 30-45ms startup time. Works best with [Neovim] ≥0.10

:gear: See "[Extending](#extending)" for customizing configuration and adding
plugins.
Expand Down Expand Up @@ -116,7 +116,7 @@ entire configuration has been rewritten to use [lazy.nvim] and Lua.
## Prerequisites

* [git](https://git-scm.com/) ≥ 2.19.0 (`brew install git`)
* [Neovim](https://github.com/neovim/neovim/wiki/Installing-Neovim) ≥ v0.9.0
* [Neovim](https://github.com/neovim/neovim/wiki/Installing-Neovim) ≥ v0.10.0
(`brew install neovim`)

**Optional**, but highly recommended:
Expand Down Expand Up @@ -236,12 +236,12 @@ git pull --ff --ff-only
* [rafi/](./lua/rafi)
* [config/](./lua/config) — Neovim configurations
* [autocmd.lua](./lua/rafi/config/autocmd.lua) — Auto-commands
* [init.lua](./lua/rafi/config/init.lua)initialization
* [init.lua](./lua/rafi/config/init.lua)Initialization
* [keymaps.lua](./lua/rafi/config/keymaps.lua) — Key-mappings
* [lazy.lua](./lua/rafi/config/lazy.lua) — Entry-point initialization
* [options.lua](./lua/rafi/config/options.lua) — Editor settings
* [util/](./lua/rafi/util) — Utilities
* [plugins/](./lua/plugins) — Plugins and configurations
* [util/](./lua/rafi/util) — Utility library
* [snippets/](./snippets) — Personal code snippets

## Extending
Expand Down Expand Up @@ -350,10 +350,10 @@ return {
(Default values are shown)

```lua
-- Enable auto format on-save
-- Auto format on-save
vim.g.autoformat = false

-- Enable elite-mode (hjkl mode. arrow-keys resize window)
-- Elite-mode (hjkl mode. arrow-keys resize window)
vim.g.elite_mode = false

-- When enabled, 'q' closes any window
Expand Down Expand Up @@ -479,7 +479,6 @@ _Note_ that 95% of the plugins are **lazy-loaded**.
| [lambdalisue/suda.vim] | An alternative sudo for Vim and Neovim
| [christoomey/tmux-navigator] | Seamless navigation between tmux panes and vim splits
| [folke/persistence.nvim] | Simple lua plugin for automated session management
| [RRethy/vim-illuminate] | Highlights other uses of the word under the cursor
| [mbbill/undotree] | Ultimate undo history visualizer
| [folke/flash.nvim] | Search labels, enhanced character motions
| [haya14busa/vim-edgemotion] | Jump to the edge of block
Expand All @@ -488,7 +487,7 @@ _Note_ that 95% of the plugins are **lazy-loaded**.
| [folke/trouble.nvim] | Pretty lists to help you solve all code diagnostics
| [akinsho/toggleterm.nvim] | Persist and toggle multiple terminals
| [hedyhli/outline.nvim] | Code outline sidebar powered by LSP
| [s1n7ax/nvim-window-picker] | Window picker
| [s1n7ax/nvim-window-picker] | Fancy Window picker
| [dnlhc/glance.nvim] | Pretty window for navigating LSP locations
| [nvim-pack/nvim-spectre] | Find the enemy and replace them with dark power
| [echasnovski/mini.bufremove] | Helper for removing buffers
Expand Down Expand Up @@ -553,7 +552,7 @@ _Note_ that 95% of the plugins are **lazy-loaded**.
| [nvim-neo-tree/neo-tree.nvim] | File explorer written in Lua
| [nvim-telescope/telescope.nvim] | Find, Filter, Preview, Pick. All lua.
| [jvgrootveld/telescope-zoxide] | Telescope extension for Zoxide
| [rafi/telescope-thesaurus.nvim] | Browse synonyms from thesaurus.com
| [rafi/telescope-thesaurus.nvim] | Browse synonyms for a word
| [nvim-lua/plenary.nvim] | Lua functions library

### Treesitter & Syntax
Expand All @@ -578,7 +577,7 @@ _Note_ that 95% of the plugins are **lazy-loaded**.
| -------------- | ----------------------
| [nvim-tree/nvim-web-devicons] | Lua fork of vim-devicons
| [MunifTanjim/nui.nvim] | UI Component Library
| [rcarriga/nvim-notify] | Fancy notification manager for NeoVim
| [rcarriga/nvim-notify] | Fancy notification manager
| [stevearc/dressing.nvim] | Improve the default vim-ui interfaces
| [akinsho/bufferline.nvim] | Snazzy tab/bufferline
| [folke/noice.nvim] | Replaces the UI for messages, cmdline and the popupmenu
Expand All @@ -589,14 +588,14 @@ _Note_ that 95% of the plugins are **lazy-loaded**.
| [folke/which-key.nvim] | Create key bindings that stick
| [tenxsoydev/tabs-vs-spaces.nvim] | Hint and fix deviating indentation
| [t9md/vim-quickhl] | Highlight words quickly
| [kevinhwang91/nvim-bqf] | Better quickfix window in Neovim
| [kevinhwang91/nvim-bqf] | Better quickfix window
| [uga-rosa/ccc.nvim] | Super powerful color picker/colorizer plugin
| [itchyny/calendar.vim] | Calendar application

[neovim/nvim-lspconfig]: https://github.com/neovim/nvim-lspconfig
[folke/neoconf.nvim]: https://github.com/folke/neoconf.nvim
[folke/neodev.nvim]: https://github.com/folke/neodev.nvim
[williamboman/mason.nvim]: https://github.com/williamboman/
[williamboman/mason.nvim]: https://github.com/williamboman/mason.nvim
[williamboman/mason-lspconfig.nvim]: https://github.com/williamboman/mason-lspconfig.nvim
[stevearc/conform.nvim]: https://github.com/stevearc/conform.nvim
[mfussenegger/nvim-lint]: https://github.com/mfussenegger/nvim-lint
Expand All @@ -607,7 +606,6 @@ _Note_ that 95% of the plugins are **lazy-loaded**.
[tweekmonster/helpful.vim]: https://github.com/tweekmonster/helpful.vim
[lambdalisue/suda.vim]: https://github.com/lambdalisue/suda.vim
[folke/persistence.nvim]: https://github.com/folke/persistence.nvim
[RRethy/vim-illuminate]: https://github.com/RRethy/vim-illuminate
[mbbill/undotree]: https://github.com/mbbill/undotree
[folke/flash.nvim]: https://github.com/folke/flash.nvim
[haya14busa/vim-edgemotion]: https://github.com/haya14busa/vim-edgemotion
Expand Down Expand Up @@ -718,19 +716,23 @@ Spec: `rafi.plugins.extras.coding.<name>`
| Name | Repository | Description
| -------------- | -------------- | ----------------------
| `align` | [echasnovski/mini.align] | Align text interactively
| `chainsaw` | [chrisgrieser/nvim-chainsaw] | Create log statements on the fly
| `cmp-git` | [petertriho/cmp-git] | Git source for nvim-cmp
| `copilot` | [zbirenbaum/copilot.lua] | Fully featured & enhanced copilot
| `editorconfig` | [sgur/vim-editorconfig] | EditorConfig plugin written entirely in Vimscript
| `emmet` | [mattn/emmet-vim] | Provides support for expanding abbreviations alá emmet
| `minipairs` | [echasnovski/mini.pairs] | Automatically manage character pairs
| `neogen` | [danymat/neogen] | Annotation generator
| `sandwich` | [machakann/vim-sandwich] | Search, select, and edit sandwich text objects

[echasnovski/mini.align]: https://github.com/echasnovski/mini.align
[chrisgrieser/nvim-chainsaw]: https://github.com/chrisgrieser/nvim-chainsaw
[petertriho/cmp-git]: https://github.com/petertriho/cmp-git
[zbirenbaum/copilot.lua]: https://github.com/zbirenbaum/copilot.lua
[sgur/vim-editorconfig]: https://github.com/sgur/vim-editorconfig
[mattn/emmet-vim]: https://github.com/mattn/emmet-vim
[echasnovski/mini.pairs]: https://github.com/echasnovski/mini.pairs
[danymat/neogen]: https://github.com/danymat/neogen
[machakann/vim-sandwich]: https://github.com/machakann/vim-sandwich

### Extra Plugins: Editor
Expand Down Expand Up @@ -848,6 +850,7 @@ Spec: `rafi.plugins.extras.ui.<name>`
| `cybu` | [ghillb/cybu.nvim] | Cycle buffers with a customizable notification window
| `deadcolumn` | [Bekaboo/deadcolumn.nvim] | Show colorcolumn dynamically
| `goto-preview` | [rmagatti/goto-preview] | Preview definitions using floating windows
| `illuminate` | [RRethy/vim-illuminate] | Highlights other uses of the word under the cursor
| `incline` | [b0o/incline.nvim] | Floating statuslines
| `miniclue` | [echasnovski/mini.clue] | Show next key clues
| `minimap` | [echasnovski/mini.map] | Window with buffer text overview, scrollbar and highlights
Expand All @@ -859,6 +862,7 @@ Spec: `rafi.plugins.extras.ui.<name>`
[ghillb/cybu.nvim]: https://github.com/ghillb/cybu.nvim
[Bekaboo/deadcolumn.nvim]: https://github.com/Bekaboo/deadcolumn.nvim
[rmagatti/goto-preview]: https://github.com/rmagatti/goto-preview
[RRethy/vim-illuminate]: https://github.com/RRethy/vim-illuminate
[b0o/incline.nvim]: https://github.com/b0o/incline.nvim
[echasnovski/mini.clue]: https://github.com/echasnovski/mini.clue
[echasnovski/mini.map]: https://github.com/echasnovski/mini.map
Expand Down Expand Up @@ -952,7 +956,6 @@ Note that,
| Key | Mode | Action | Plugin or Mapping
| ----- |:----:| ------------------ | ------
| <kbd>],</kbd> or <kbd>[,</kbd> | 𝐍 | Next/previous parameter | <small>[akinsho/bufferline.nvim]</small>
| <kbd>]]</kbd> or <kbd>[[</kbd> | 𝐍 | Next/previous reference | <small>[RRethy/vim-illuminate]</small>
| <kbd>]q</kbd> or <kbd>[q</kbd> | 𝐍 | Next/previous on quick-fix | <small>`:cnext` / `:cprev`</small>
| <kbd>]a</kbd> or <kbd>[a</kbd> | 𝐍 | Next/previous on location-list | <small>`:lnext` / `:lprev`</small>
| <kbd>]d</kbd> or <kbd>[d</kbd> | 𝐍 | Next/previous diagnostics |
Expand Down
2 changes: 1 addition & 1 deletion lua/rafi/config/autocmds.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ vim.api.nvim_create_autocmd({ 'FocusGained', 'TermClose', 'TermLeave' }, {
vim.api.nvim_create_autocmd('TextYankPost', {
group = augroup('highlight_yank'),
callback = function()
vim.highlight.on_yank({ timeout = 100 })
vim.highlight.on_yank({ timeout = 50 })
end,
})

Expand Down
1 change: 1 addition & 0 deletions lua/rafi/config/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ function M.init()
M.did_init = true
local plugin = require('lazy.core.config').spec.plugins.LazyVim
if plugin then
---@diagnostic disable-next-line: undefined-field
vim.opt.rtp:append(plugin.dir)
end

Expand Down
5 changes: 4 additions & 1 deletion lua/rafi/config/keymaps.lua
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ local diagnostic_goto = function(next, severity)
go({ severity = severity_int })
end
end

map('n', ']d', diagnostic_goto(true), { desc = 'Next Diagnostic' })
map('n', '[d', diagnostic_goto(false), { desc = 'Prev Diagnostic' })
map('n', ']e', diagnostic_goto(true, 'ERROR'), { desc = 'Next Error' })
Expand Down Expand Up @@ -283,7 +284,9 @@ map('n', '<leader>us', function() LazyVim.toggle('spell') end, { desc = 'Toggle
map('n', '<leader>uw', function() LazyVim.toggle('wrap') end, { desc = 'Toggle Word Wrap' })
map('n', '<leader>uL', function() LazyVim.toggle('relativenumber') end, { desc = 'Toggle Relative Line Numbers' })
map('n', '<leader>ul', function() LazyVim.toggle.number() end, { desc = 'Toggle Line Numbers' })
map('n', '<leader>ud', function() LazyVim.toggle.diagnostics() end, { desc = 'Toggle Diagnostics' })
map('n', '<Leader>ud', function() RafiUtil.edit.diagnostic_toggle(false) end, { desc = 'Disable Diagnostics' })
map('n', '<Leader>uD', function() RafiUtil.edit.diagnostic_toggle(true) end, { desc = 'Disable All Diagnostics' })

map('n', '<Leader>uo', '<cmd>setlocal nolist!<CR>', { desc = 'Toggle Whitespace Symbols' })
map('n', '<Leader>uu', '<cmd>nohlsearch<CR>', { desc = 'Hide Search Highlight' })
local conceallevel = vim.o.conceallevel > 0 and vim.o.conceallevel or 3
Expand Down
1 change: 1 addition & 0 deletions lua/rafi/config/lazy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ if not vim.uv.fs_stat(lazypath) then
-- stylua: ignore
vim.fn.system({ 'git', 'clone', '--filter=blob:none', 'https://github.com/folke/lazy.nvim.git', '--branch=stable', lazypath })
end
---@diagnostic disable-next-line: undefined-field
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)

-- Load user options from lua/config/setup.lua
Expand Down
11 changes: 1 addition & 10 deletions lua/rafi/config/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,6 @@ end
opt.ignorecase = true -- Search ignoring case
opt.smartcase = true -- Keep case when searching with *
opt.inccommand = 'nosplit' -- Preview incremental substitute
opt.grepformat = '%f:%l:%c:%m'

if vim.fn.executable('rg') then
opt.grepprg = 'rg --vimgrep --no-heading'
.. (opt.smartcase and ' --smart-case' or '') .. ' --'
elseif vim.fn.executable('ag') then
opt.grepprg = 'ag --vimgrep'
.. (opt.smartcase and ' --smart-case' or '') .. ' --'
end

-- Formatting
-- ===
Expand Down Expand Up @@ -167,7 +158,7 @@ opt.listchars = {
trail = '·'
}
opt.fillchars = {
foldopen = '󰅀', -- 󰅀 
foldopen = '', -- 󰅀 
foldclose = '', -- 󰅂 
fold = ' ', --
foldsep = ' ',
Expand Down
4 changes: 1 addition & 3 deletions lua/rafi/plugins/editor.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
-- Plugins: Editor
-- https://github.com/rafi/vim-config

local is_windows = vim.uv.os_uname().sysname == 'Windows_NT'

return {

-----------------------------------------------------------------------------
Expand All @@ -20,7 +18,7 @@ return {
{
'christoomey/vim-tmux-navigator',
lazy = false,
cond = vim.env.TMUX and not is_windows,
cond = vim.env.TMUX and vim.uv.os_uname().sysname ~= 'Windows_NT',
-- stylua: ignore
keys = {
{ '<C-h>', '<cmd>TmuxNavigateLeft<CR>', mode = { 'n', 't' }, silent = true, desc = 'Go to Left Window' },
Expand Down
23 changes: 23 additions & 0 deletions lua/rafi/plugins/extras/coding/chainsaw.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
return {

-- Create log statements on the fly
{
'chrisgrieser/nvim-chainsaw',
opts = {
logStatements = {
messageLog = {
go = 'fmt.Println("%s")',
},
variableLog = {
go = 'fmt.Println("%s %s:", %s)',
nvim_lua = 'vim.notify("%s %s", vim.inspect(%s))',
},
},
},
-- stylua: ignore
keys = {
{ '<Leader>dv', function() require('chainsaw').variableLog() end },
{ '<Leader>dm', function() require('chainsaw').messageLog() end },
},
},
}
12 changes: 12 additions & 0 deletions lua/rafi/plugins/extras/coding/neogen.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
return {

-- Annotation generator
{
'danymat/neogen',
-- stylua: ignore
keys = {
{ '<leader>cg', function() require('neogen').generate({}) end, desc = 'Neogen Comment' },
},
opts = { snippet_engine = 'luasnip' },
},
}
Loading

0 comments on commit 8408fb3

Please sign in to comment.