I use the lazyvim.org distro, so my plugins and tips are optimized to be compatible with that the most, if using something different you might need to to a bit of tweaking, but you can grab the overall ideas and adapt them to your own config
I use macOS, so keep that in mind too
This is not a distribution, this is my personal setup, so one day I may use certain plugin, like neo-tree, and the following day I may completely disable it and instead switch to mini.files, in case you clone and pull, expect to see changes
My entire neovim setup is in my github repo, so you can also grab it
All links to my YouTube videos in video description
All of the links will also be in my blogpost
Pending items
These don’t have to be at a specific section, they can be anywhere in the file, I just leave them at the top because they break my <C-Space key
And you will be able to see the code related to that keymap
I’m not giving you a permalink, as my dotfiles change quite often, so always check for the latest updates
Markdown tips
Better bullet points
You’ll see what plugin we use later on
When you are in a bullet point, and press enter, it automatically creates it below and respects indentation
If you put a colon at the end, it will indent the next bullet point:
Notice the indentation changed:
And indented again
If you press enter in a line that only has a bullet point, line below won’t have one
Numbers are also auto increased
This was added automatically
There’s much more that you can find in the github page
Spell checking (works in tmux)
To toggle spelling <Leader>us
To jump between misspelled words use [s and ]s
To correct a word using suggestions the default is z=
I created a keymap <leader>mss (markdown spelling)
This keymap only worked for me with nvim_feedkeys if you know why, please let me know in the comments
To add a word to your dictionary use zg
I created a keymap <leader>msg (markdown good)
If you added a word by mistake and want to remove it <leader>msu
After you correct a word, if you want to repeat that and correct it across the file use <leader>msr
This isn’t working for me, will look at it another day, if you know how to fix it,
I’m not sure why, but if you use the dashboard-nvim plugin and press “s” to restore the session, but you do it really fast, the autocmd doesn’t kick in and spelling will be off, so when in the dashboard wait a few seconds before pressings “s”, will take a look at this issue another day
Spell dictionary
The file with all the keywords I add is in my main neobean directory:
Don’t manually add words to that file, but instead add them with the mapping so that neovim recompiles the file
Personally, I haven’t tested how this file across machines, but time will tell
Fix undercurl in tmux
Special thanks to Folke for this tip
I use both kitty and tmux, for this to work, you need to add the following lines to your tmux.conf file
1
2
3
4
5
6
7
8
9
10
11
# Undercurl support (works with kitty)# Fix found below in Folke's tokyonight theme :heart:# https://github.com/folke/tokyonight.nvim#fix-undercurls-in-tmux## After reloading the configuration, you also have to kill the tmux session for# these changes to take effectset-g default-terminal "${TERM}"# undercurl supportset-as terminal-overrides ',*:Smulx=\E[4::%p1%dm'# underscore colours - needs tmux-3.0set-as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m'
Go and see my tmux.conf file for the latest changes
I changed the undercurl color and style in my neovim colorscheme settings, every time you make a change there you have to reload the tmux config, but also kill the tmux session or it won’t work
Lazyvim spell defaults
There’s a default Auto Command (autocmd) in Folke’s lazyvim.org distro that is what enables spelling
Also the lazyvim.org comes preconfigured with the Optionopt.spelllang = { "en" } (English)
John McBride video recommendation
Watch this great video by by John McBride if you want to learn more about spell:
It will add it at the top of the file if there’s not one, and if there is a TOC already, it will update it
It doesn’t matter if the file has front matter at the top or not, the keymap will detect it and not cause problems
To generate the TOC I use the markdown-toc plugin, and it’s installed as a LazyExtra, you’ll understand later
Delete current file
A lot of times, I want to remove the file I’m on without going out of neovim or without even opening my neovim file explorer
<leader>fD
This is for macOS and uses the trash app, if you’re on Linux, modify the keymap
Create or jump daily note hyper+t+r
I normally handle my notes as large files (kubernetes, docker, xcp-ng, etc), but there are times I don’t want to add stuff to one of those files and instead add it to my daily note
Useful if for example if I want to add TODO items, they’ll be in my obsidian vault and I can see which ones are pending
This will:
Create a daily note with the date-day for example 2024-06-30-Sunday inside the obsidian_main/250-daily/2024/06-Jun directory
If the directories do not exist it will create them
If the daily note doesn’t exist it will create it
Create a new tmux session with the note name in detached mode and start neovim with the daily note
If a tmux session with that name already exists, just switch to it
I’ll let you know how I do hyper+t+r later on
Make sure that the ~/github/dotfiles-latest/scripts/macos/mac/300-dailyNote.sh script is executable
Create headings and daily note
I use this in my Obsidian vault
This is useful in case I want to have stuff linked to my daily note
I use markdown headings with date on a specific note XOA for example
Then in obsidian I can go to a specific note, and see which headings are linked to that note, just so that I can keep track of what did each day, some sort of journal
These keymaps besides adding the heading, will also create the daily note if it does not exist:
If you don’t want to create the daily note, comment that line
By default if you want to bold some text, you select it and do 2gsa* or if you want to “unbold” it I normally do gsd*.
I configured keymap <leader>mb
This is just a random paragraph with random text in it, it doesn’t serve any purpose but I just want to use it to demonstrate how multi line bold and unbold works
This is just a single line of text
Jump between markdown headings
Follow markdown convention and use a single H1 heading in your file for this to work
Besides the outline plugin if I want to navigate between headings I use:
Some of these default keymaps are the better up/down ones found below:
1
2
3
4
5
6
7
8
9
-- better up/down-- If there is no count (v:count == 0), pressing j will execute gj-- Useful when dealing with wrapped lines in the buffer.-- If there is a count (v:count != 0), pressing j will execute j.-- For example, if you press 3j to move down three linesmap({"n","x"},"j","v:count == 0 ? 'gj' : 'j'",{expr=true,silent=true})map({"n","x"},"<Down>","v:count == 0 ? 'gj' : 'j'",{expr=true,silent=true})map({"n","x"},"k","v:count == 0 ? 'gk' : 'k'",{expr=true,silent=true})map({"n","x"},"<Up>","v:count == 0 ? 'gk' : 'k'",{expr=true,silent=true})
So by default my neovim “sends” gj when I press j and I can navigate through wrapped lines easily
You might think that gj and gk mappings I added would break the default keymaps, but for some reason it still keeps working
So with j and k I navigate through wrapped lines without issues
Fold all level 2 or 3 headings
I created 4 keymaps to fold:
<leader>mfj (markdown fold 1)
<leader>mfk (markdown fold 2)
I know, it looks like madafaka, but it’s just the 2nd letter
<leader>mfl (markdown fold 3)
<leader>mf; (markdown fold 4)
And to unfold:
<leader>mfu (markdown fold undo)
See the Folding section in the keymaps file
DO NOT leave headings OF THE SAME LEVEL without any text between them or folding will not work properly
Folding basics
There are several fold options worth knowing about
opt.foldlevel = 99
(default LazyVim)
Sets the initial fold level when opening a file.
With a high value like 99, it ensures that almost all folds are open when a file is opened.
opt.foldmethod = "expr"
(default LazyVim 0.10)
Sets the method for defining folds
Uses the expression defined in foldexpr to create folds. This method allows for highly customizable folding behavior based on the evaluated expression.
I really hated this behaviour, maybe skill issue, but every time I was at the end of a line and hit enter, it would autocomplete a word instead of moving to the line below
I change this in the nvim-cmp.lua file
Working with marks
Leave a mark somewhere you need to come back to
While in normal mode, press m and then a letter a-z will create a mark
Lowercase letters (a to z) are for marks local to the current buffer
Uppercase letters (A to Z) create global marks that can be jumped to from any buffer
To jump to a mark
'a - (single quote) jump to the line of the mark in the first character
`a - (backtick), jumps to character in which mark was set originally
To see all the marks use :marks
:delmarks a would remove the mark a
:delmarks a j k l m z n removes all the marks specified
I created a keymap to delete all marks
<leader>md (mark delete)
Make selected text a link
Regular link <leader>mll (markdown link)
Link to lazyvim.org
Link that opens in new tab <leader>mlt (markdown link tab)
Link that opens in new tab
Paste github repo as link
I use this quite a lot, so decided to create a keymap
<C-g> (github, and since you run it with ctrl, can run it in insert mode)
Make sure you have the main github repo link in your clipboard first
The configuration file will be resolved starting from the location of the file being formatted, and searching up the file tree until a config file is (or isn’t) found.
Prettier intentionally doesn’t support any kind of global configuration. This is to make sure that when a project is copied to another computer, Prettier’s behavior stays the same. Otherwise, Prettier wouldn’t be able to guarantee that everybody in a team gets the same consistent results.
Disable autoformatting in certain sections
Prettier is enabled and will autoformat your file, but there are some times that you don’t need prettier to autoformat, example below:
Notice that I’m also disabling markdownlint
I have a keymap to add this snippet
This is a message that renders correctly in the page because it’s not autoformatted
Add file path to current file
A lot of times I need the path of the current file to be added to the file itself as a comment
This does not only work for markdown, but for any file type
So make sure that plugin is installed, comes with lazyvim.org distro by default
<C-z>
Insert filename with path
Copy current file path to clipboard
To copy the file path to the clipboard use <leader>fp
Navigate the help pages
If for example you’re setting up a keymap, or you want to understand what the commands on an existing keymap do, or basically, any command in neovim, use the help
<leader>sh
Then search for something pwd and navigate around “tags” with shift+k
To go back to where you were after navigating to a tag, use Ctrl-o
Close that pane with <leader>wd (window delete)
See key maps
<leader>sk
Paste with “p” in visual mode
This is not markdown specific, but overall neovim specific
DON’T use cmd+v (macOS) to paste
Paste with p (lowercase) or P (uppercase)
1
2
3
4
5
6
7
8
Laborum aute consectetur sit reprehenderit.
Laborum aute consectetur sit reprehenderit.
Duis consectetur laborum deserunt.
Duis consectetur laborum deserunt.
Minim tempor ullamco do eu pariatur minim.
Minim tempor ullamco do eu pariatur minim.
Select text in a bullet point
Press ctrl+space
Keep pressing it to keep selecting
To go back use backspace
Adding 2nd bullet point just for testing
This breaks if you have a markdown comment below in the file, it will jump there, not sure why
If you know why this is, let me know down in the comments
Don’t indent with tab
Don’t try this, because if you use snippets, this will interfere with them and you won’t be able to jump to the next field using tab
If you use tab for something else, you’ll lose it
To indent use defaults:
In insert mode use <C-T> and <C-D>
In normal mode >> and <<
Open current file in finder
<leader>fO (uppercase O as in “Oscar”)
This is for macOS, not sure if works on Linux, but modify it
You’ll see the pop-up, but a lot of times you will want to see them again
There’s a default lazyvim keymap <leader>snh (search noice history)
Close the window that shows below with <leader>wd (window delete)
Or use the command :NoiceHistory
Dismiss all messages
If you open neovim on an old outdated machine, you will get hundreds of noice messages on the screen, sometimes occupying the entire screen and you won’t be able to read
Clear them all with <leader>snd (search noice dismiss)
1
:lua local messages ={"System update available. System update available. System update available.","Backup completed successfully. Backup completed successfully. Backup completed successfully.","New email received. New email received. New email received.","Reminder: Meeting at 3 PM. Reminder: Meeting at 3 PM. Reminder: Meeting at 3 PM.","Low disk space on drive C:. Low disk space on drive C:. Low disk space on drive C:.","Software update installed. Software update installed. Software update installed.","Battery level critical. Battery level critical. Battery level critical.","File download completed. File download completed. File download completed.","New message from John. New message from John. New message from John.","Security scan completed. Security scan completed. Security scan completed.","Application crash detected. Application crash detected. Application crash detected.","Printer is out of paper. Printer is out of paper. Printer is out of paper.","Wi-Fi connection lost. Wi-Fi connection lost. Wi-Fi connection lost.","New friend request received. New friend request received. New friend request received.","Weather alert: Heavy rain expected. Weather alert: Heavy rain expected. Weather alert: Heavy rain expected.","VPN connection established. VPN connection established. VPN connection established.","System reboot required. System reboot required. System reboot required.","Bluetooth device connected. Bluetooth device connected. Bluetooth device connected.","Scheduled maintenance at midnight. Scheduled maintenance at midnight. Scheduled maintenance at midnight.","Password change reminder. Password change reminder. Password change reminder."}for _, message in ipairs(messages)do vim.api.nvim_echo(, false, {}) end
What plugins and tips do you use?
Let me know down below, there’s also cool recommendations that can help me improve my setup
What do you want to see next?
Video in which I go over the colorscheme I use in neovim, SketchyBar, kitty, tmux, markdown headings, etc
Markdown plugins
These are sorted by my personal preference, most preferred ones at the top
This is a beauty, it comes installed with lazyvim.org by default, I think Folke disabled it once, and I almost died, so in case the following stop working, you know this is the plugin
viq or vaq select inside or around quotes
Text inside backticks
“Text inside double quotes”
‘Text inside single quotes’
vig select entire file
vio or vao
I select text inside code blocks A LOT, and I mean A LOT
So this is definitely one of my personal favorites
vi or va to see what other options are useful for you
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env bash# Filename: ~/github/scripts/macos/mac/300-dailyNote.sh# Get current date componentscurrent_year=$(date +"%Y")current_month_num=$(date +"%m")current_month_abbr=$(date +"%b")current_day=$(date +"%d")current_weekday=$(date +"%A")# Construct the directory structure and filenamenote_dir=~/github/obsidian_main/250-daily/${current_year}/${current_month_num}-${current_month_abbr}note_name=${current_year}-${current_month_num}-${current_day}-${current_weekday}full_path=${note_dir}/${note_name}.md
# Use note name as the session nametmux_session_name=${note_name}
I like my cursor to always be in the middle, specially if I’m at the bottom of a file, yes, you can configure a keymap, but this plugin works great for me
Paste images in neovim and save them in different formats, I prefer .avif or .webp as their size is way smaller compared to .png when dealing with images with transparent backgrounds
You can manage these in the lua/config/lazy.lua file or with :LazyExtras
I’m not sure if you can also manage them in the lazyvim.json file as well
I prefer to configure the extras in the lazy.lua file, because I want to have the settings on each machine, but if that’s not your case, you can enable the extras on each machine with :LazyExtras
This is the plugin that shows me markdown warnings when the line length is exceeded, I have a duplicate or invalid heading, etc
I love it, helps me follow markdown “best practices”
To modify the warning settings, copy the following file ~/github/dotfiles-latest/.markdownlint.yaml
To each dir in which you want the settings to be applied, for example, I copied it to my github/obsidian_main and github/linkarzu.github.io dir.
Copy it to the working directory, you can see it with :pwd
If, you need to change markdownlint settings INSIDE a specific file, add this heading as an example
For example, I had a file in which I configured prettier’s print width to 100 instead of 80, so I added this so that the markdownlint stopped showing me errors
Using LSP protocol it provides completion, goto definition, find references, rename refactoring, diagnostics, and more. In addition to regular Markdown, it also supports wiki-link-style references that enable Zettelkasten-like, note taking
Go to the obsidian XOA file under Create Windows 11 VM
K (uppercase k) over a link allow me to hover
KK (press it twice) and you can navigate that file in the hover menu
gd (go to definition) allows me to go the file that a link points to
formatting.prettier
This includes:
mason.nvim conform.nvim none-ls.nvim
If you go to the lazyvim.org website in the extras -> formatting -> prettier section (notice it matches the Extra’s name)
You’ll be able to see which plugins Mason will install, which is only prettier
Prettier is the one that automatically formats my markdown files
It removes extra blank lines
Removes blank spaces at the end of a line
But also messes up my chirpy tips because it format things
You can ignore some parts from formatting, will show you how below
I like following markdown guidelines, so I don’t like my lines to be longer than 80 characters, I like to enable wrapping for them
0:00 - Bullet points
0:57 - Spell checking
4:12 - Where are the files?
4:51 - todo items
6:34 - add TOC
7:49 - Delete current file
8:27 - Daily note with hyper+t+r
9:38 - Add headings and daily note
11:11 - View and paste images
12:00 - Snippets
13:11 - Bold
14:33 - Jump markdown headings
15:33 - Fold all headings
17:09 - Fold with enter
17:23 - If you want to support me, I appreciate it
18:50 - Completion with ctrl+y
19:24 - Marks
20:13 - Make selected text a link
20:44 - Paste github repo link
21:06 - Increase or decrease headings
21:45 - Line wrapping
23:33 - Disable autoformatting in sections
24:23 - Add file path to file
24:42 - Copy file path to clipboard
25:07 - Navigate the help pages
25:57 - Search key maps
26:20 - Paste with p
26:56 - Select text in a bulletpoint
27:40 - Dont indent with tab
28:24 - Open current file in finder
28:35 - Alternate file
29:26 - How do I hyper+t+r
30:15 - See messages history
30:37 - Dismiss all messages
31:03 - Share your plugins
31:28 - Plugins section
31:57 - bullets.vim
32:10 - mini.ai
33:24 - stay-centered.nvim
33:50 - outline.nvim
34:15 - headlines.nvim
34:45 - nvim-spectre
36:01 - auto-save.nvim
36:35 - markdown-preview.nvim
37:01 - mini.surround
38:19 - image.nvim and img-clip.nvim
38:47 - BufExplorer
40:10 - Telescope.nvim
40:50 - nvim-treesitter
41:19 - LazyExtras
43:14 - markdownlint-cli2
45:40 - marksman
46:41 - prettier
47:46 - obsidian.nvim
48:23 - see you next year
48:44 - outro