My personal configuration tweaks for VIm editor
This plugin contains my custom tweaks on VIm configuration. I've put them in a separate git repository because I use Vundle in my .vimrc. I'm using iTerm2 on Mac, with a black theme (colors could be different in other consoles). I'm french so my shortcuts are for Mac azerty keyboards.
- Search for word(s) in a directory and to navigate into results
- Custom statusline with full filepath
- Allows to move the current line up / down
- When opening a file, the cursor goes where it was the last time
- Paste a text on another do not replace the clipboard
- Disable swap files (temporary files with tilde)
- Auto-remove trailing spaces when saving a file
- Force indentation with spaces (2), not tabulation
- the à key (french keyboards) works as 0 (begin of current line)
- Tabular plugin requires no parameters with my custom key mapping
- Syntastic plugin is set to show errors by default
- Allow to update your .vimrc by downloading a new one
The following option are optional, if you want to change their values, put it in your .vimrc.
Curl is used to download the file, you will need to confirm the URL and the replacement. Default value:
let g:vim_tweaks__vimrc_url='https://raw.githubusercontent.com/webastien/vim/master/.vimrc'
You can tell VIm to consider some files as a given filetype (:h filetype
for more info). It's useful for syntax coloration and plugin based on filetypes. This plugin configure this filetypes alteration with a single dict variable. Keys are desired filetype, values are list of file pattern which will be associated with. Default value:
let g:vim_tweaks__filetypes = {
\ 'dosini': [ '*.info', '*.ini' ],
\ 'ruby': [ 'Vagrantfile', 'Capfile' ],
\ 'sshconfig': [ '*/.ssh/config.d/*/config' ],
\ 'php': [ '*.inc', '*.module', '*.theme', '*.install', '*.engine', '*.profile', '*.view', '*.test' ]
\ }
Only applied if default autocommands have not been disabled.
Note:
- Those PHP filetypes work with Drupal
- This Ruby detection is useful when using Vagrant and Capistrano
- "sshconfig" detection is based on my SSH config organization.
To disable them, simply use let g:vim_tweaks__default_abbreviations = 0
To disable them, simply use let g:vim_tweaks__default_mapping = 0
To disable them, simply use let g:vim_tweaks__default_autocommands = 0
To disable them, simply use let g:vim_tweaks__default_options_vim = 0
To disable them, simply use let g:vim_tweaks__default_options_plugins = 0
- AbbrebiationRemoveTrailingSpace(), (internal use) helper function to remove the trailing space of an abbreviation
- CommandAbbreviation(original, abbreviation), (internal use) helper function for my command abbreviations
- LastPosition(), replace the cursor on the last position in the file
- SmartHome(), toggle start of line / first nonblank character of the line
- TabAuto(), execute
tabularize
with auto-detected parameters (Tabular plugin) - UpdateVimrc(url), update the .vimrc file with the given URL
- WordSearch(), search a word (the one under the cursor by default) in the given directory, recursively
To call them without a custom key map, simply type :call WordSearch()
for example.
- :UpdateVimrc, prompt for an URL, then update the
.vimrc
file with it (see configuration section to prefill with your favorite)
(Can be disabled with option g:vim_tweaks__default_abbreviations
.)
- h, open VIm help in a new tab if the current file is not a VIm help
- e, prefill the edit command with the full current path (reduced if in home)
(Can be disabled with option g:vim_tweaks__default_mapping
.)
- CTRLF to search something, somewhere
- F6 Go to previous result of this search
- F7 Go to next result of this search
- F2 Toggle autopreview
- SHIFTQ Return to last edited line
- SPACE Fold / Unfold
- SHIFTC Comment / Uncomment line or selected block
- CTRLSPACE (insert mode) Autocompletion
- CTRLT New tab
- CTRLW Close tab
- LEFT Previous tab
- RIGHT Next tab
- UP Previous pane
- DOWN Next pane
- SHIFTLEFT Move the current tab on the left
- SHIFTRIGHT Move the current tab on the right
- SHIFTK Page up
- SHIFTJ Page down
- SHIFTH Begin of line
- SHIFTL End of line
- TAB / SHIFTTAB Indent more / less current line or selected block
- CTRLK Move the current line up
- CTRLJ Move the current line down
- F3 Jump to declaration of the function / class / ... under the cursor
- F4 Jump to declaration of the function / class / ... given by prompt
- F5 Create / Refresh tags list of the project
- F8 Toggle file outline
- + Auto align with tabular (detect ":" or "=" context)
- ; Turn off searched terms highlighting
- F9 Toggle mouse support
- F10 Get the highlight group of the element under the cursor