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
I'm not going to lie to you; fugitive.vim may very well be the best Git wrapper of all time. Check out these features:
Bring up an enhanced version of
git status with
:G (also known as
g? to bring up a list of maps for numerous operations
including diffing, staging, committing, rebasing, and stashing.
View any blob, tree, commit, or tag in the repository with
:Gtabedit, ...). Edit a file in the index and
write to it to stage the changes. Use
:Gdiffsplit to bring up the staged
version of the file side by side with the working tree version and use
Vim's diff handling capabilities to stage a subset of the file's
Commit, merge, and rebase with
the current Vim instance to edit commit messages and the rebase todo…
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.
- 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!