let mapleader = ' '
It might look strange, but think about how little you use it on normal mode. The space bar is a pretty accessible key on your keyboard and it will reduce your pinky pain.
Search local vimrc files (".lvimrc") in the tree (root dir up to current dir) and load them.
This plugin searches for local vimrc files in the file system tree of the currently opened file. It searches for all ".lvimrc" files from the directory of the file up to the root directory. By default those files are loaded in order from the root directory to the directory of the file. The filename and amount of loaded files are customizable through global variables.
For security reasons it the plugin asks for confirmation before loading a local vimrc file and loads it using |:sandbox| command. The plugin asks once per session and local vimrc before loading it, if the file didn't change since previous loading.
It is possible to define a whitelist and a blacklist of local vimrc files that are loaded or ignored unconditionally.
Resource all local vimrc files for the…
Besides that, sometimes I don't want to make certain configurations public, so adding them to my public dot-files is not an option.
With this plugin you can easily (and more or less safely) keep those configurations scoped to the projects where you need them.
augroup setSpelling autocmd! autocmd FileType gitcommit setlocal spell spelllang=en_us autocmd FileType markdown setlocal spell spelllang=en_us augroup END
If (like me) you're not a native English speaker it is even more helpful to have spell checking. This simple piece of config will spell check your git commit messages and the markdown you write.
Remember when Vim marks a spelling issue you can see the available options with
z=. You want to know more about spelling? Check
:help spell on Vim.
I have a lot of shorcuts on Vim. Remembering them all is impossible. I group them with mnemonics which are simpler to remember. For example, all my git related mnemonics are grouped under
:Gstatus. Most are obvious, but I've added some comments where not.
nnoremap <leader>gs :Gstatus<CR> nnoremap <leader>gc :Gcommit<CR> nnoremap <leader>gC :Gcommit -n<CR> " commit but ignore hooks nnoremap <leader>gP :Gpush<CR> nnoremap <leader>gfP :Gpush --force-with-lease<CR> nnoremap <leader>gp :Gpull<CR> nnoremap <leader>gf :Gfetch<CR> nnoremap <leader>gl :GV!<CR> " Git log for the current file nnoremap <leader>gL :GV<CR> " Full git log nnoremap <leader>gd :Gvdiff<CR> nnoremap <leader>gb :Gblame<CR> nnoremap <leader>gm :Git checkout master<CR> nnoremap <leader>g- :Git checkout -<CR> nnoremap <leader>grm :Grebase -i master<CR>
BTW, If you are interested those 2 use fugitive and gv
Fugitive is the premier Vim plugin for Git. Or maybe it's the premier Git plugin for Vim? Either way, it's "so awesome, it should be illegal". That's why it's called Fugitive.
The crown jewel of Fugitive is
:Git (or just
:G), which calls any
arbitrary Git command. If you know how to use Git at the command line, you
know how to use
:Git. It's vaguely akin to
:!git but with numerous
- The default behavior is to directly echo the command's output. Quiet
:Git addavoid the dreaded "Press ENTER or type command to continue" prompt.
:Git rebase -i, and other commands that invoke an editor do their editing in the current Vim instance.
:Git log, and other verbose, paginated commands have their output loaded into a temporary buffer. Force this behavior for any command with…
A git commit browser.
gitv is nice. But I needed a faster, and possibly simpler alternative that I can use with a project with thousands of commits.
Plug 'tpope/vim-fugitive' Plug 'junegunn/gv.vim'
:GVto open commit browser
- You can pass
git logoptions to the command, e.g.
:GV -S foobar -- plugins.
- You can pass
:GV!will only list commits that affected the current file
:GV?fills the location list with the revisions of the current file
:GV? can be used in visual mode to track the changes in the
<cr>on a commit to display the content of it
<cr>on commits to display the diff in the range
Oopens a new tab instead
[[to move between commits
.to start command-line with…
Vim's help is great. Not only that, most plugins you install come with a very well crafted help. Understanding how to navigate it makes your life easier. It is pretty easy:
:helpto see the global vim help (yeah, that's pretty obvious)
:help command/topic/shortcutto see its help. E.g.
- You'll see some words on the help are highlighted. Those are links and you can follow them with
CTRL+]. If you want to go back to where you were you can use
Let me explain that: Vim can do A LOT, you don't know how much (and neither do I). The only way to do it is to research and play with it. Many of the things I do on my
.vimrc come from other people's dotfiles.
There are literally thousands of dotfiles out there, people shares them (I do share mines!). If you are interested on improving your Vim's workflow go check them. Find famous Vim authors and check what they do. You'll be amazed on how much you will learn!