https://github.com/sglavoie/better-vim-experience
Tips and tricks for Vim/Neovim, vimrc/init.vim, using Python in Vim, etc.
https://github.com/sglavoie/better-vim-experience
neovim python python-3 tmux vim vim-configs vimrc
Last synced: about 1 month ago
JSON representation
Tips and tricks for Vim/Neovim, vimrc/init.vim, using Python in Vim, etc.
- Host: GitHub
- URL: https://github.com/sglavoie/better-vim-experience
- Owner: sglavoie
- License: mit
- Created: 2018-02-26T02:23:13.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2021-09-20T00:22:37.000Z (over 4 years ago)
- Last Synced: 2025-02-05T22:40:04.667Z (over 1 year ago)
- Topics: neovim, python, python-3, tmux, vim, vim-configs, vimrc
- Language: Shell
- Homepage:
- Size: 944 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Tips and tricks for [Vim](https://github.com/vim/vim) / [Neovim](https://github.com/neovim/neovim)
[Link to up-to-date current Neovim configuration file](https://github.com/sglavoie/dotfiles/tree/master/.config/nvim).
## Table of Contents
* [General Tips And Tricks](#general-tips-and-tricks)
* [Display the main help buffer in a new tab](#display-the-main-help-buffer-in-a-new-tab)
* [Remove all whitespace at the end of every line in the buffer](#remove-all-whitespace-at-the-end-of-every-line-in-the-buffer)
* [Add newline without leaving normal mode and stay on current line](#add-newline-without-leaving-normal-mode-and-stay-on-current-line)
* [Completions with Ctrl+x (eXpand)](#completions-with-ctrlx-expand)
---
## General Tips And Tricks
This is obviously far from being an exhaustive list: those are some tips and tricks that I have found useful.
### Display the main help buffer in a new tab
```vim
" Display help in new tab
nnoremap h :tabnew:help:quit
```
This is useful to maximize the help window and read more easily. You can quickly switch back to the next tab with the keystrokes `gt` (especially useful if you don't have any other tab opened). Simply do `:q` on the help tab and you're back to work!
### Remove all whitespace at the end of every line in the buffer
This also works for lines that only contain whitespace. It keeps the line in place but remove the extra space(s) or tab(s) that might have been left by accident.
```vim
noremap :%s/\s\+$//:echo 'all whitespace removed.'
```
### Add newline without leaving normal mode and stay on current line
```vim
nnoremap o
nnoremap O
```
### Completions with Ctrl+x (eXpand)
Those are the combinations that I tend to use the most.
- `Ctrl + x Ctrl + p` will find a word and suggest a list to complete it. If there's only a match, it is automatically inserted.
- `Ctrl + x Ctrl + l` will complete a whole line automatically if there's only one match, else it will suggest a list.
- `Ctrl + x Ctrl + k` will complete a word from the dictionary.
- `Ctrl + x Ctrl + ]` will complete a word from available tags.