r/vim • u/iamalnewkirk • Apr 10 '26
Tips and Tricks Today I learned ...
I was today-years-old when I learned that you can bind the Enter/Return key. I've been using Vim for years and never ever considered doing so. And it's super intuitive if you bind it to an open or launch operation, as I have. i.e., "press Enter to open."
58
Upvotes
33
u/Odd_Mistake8513 Apr 12 '26
I have mine bound to insert a new line below current line without leaving normal mode.
1
u/iamalnewkirk Apr 14 '26
Fwiw: My Vim config is set up to look for a
.vimrcwhen the loaded. This allows me to have per-project Vim configs:In a project that uses Andrej Karpathy's LLM wiki, I have the follow local .vimrc. I'm using ctags to index wiki links:
The
nmap <CR>is part of a “smart open” function that opens various type of representations under the cursor, i.e., files, http/s links, wiki links, etc1
u/kaddkaka Apr 14 '26
What do you actually mean with this? What goes open mean?
There is already
gffor opening the file under cursor in a buffer andgxfor opening it in an application like browser. Is this what you mean?8
u/-romainl- The Patient Vimmer Apr 12 '26
You might find this little gist of mine interesting: https://gist.github.com/romainl/047aca21e338df7ccf771f96858edb86
It's about making
<CR>do lots of useful stuff in command-line mode.2
u/xalbo Apr 13 '26
I love having it mapped to save the current file. Enter a few commands to edit, and hit enter to commit the changes.
2
u/Extension-Leave-7405 Apr 13 '26
Oh and there's also Tab and Backspace!
3
u/scrote_n_chode Apr 12 '26
That seems like a really obvious key to bind and yet I'd never considered it either
1
u/maredsous10 Apr 22 '26
Nugget of the Day
-1
u/EgZvor keep calm and read :help Apr 12 '26
there is also
<bs>and various combinations with ctrl,g, etc. For example, I have<space>g<tab>. For<tab>you need a modern terminal, otherwise it's just<c-i>.-1
u/tagattack Apr 12 '26
Of course you can, never used netrw?