Skip to content

Latest commit

 

History

History
117 lines (97 loc) · 5.96 KB

README.md

File metadata and controls

117 lines (97 loc) · 5.96 KB

vim-tweaks

My personal configuration tweaks for VIm editor

About

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.

Main features

  • 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

Configuration

The following option are optional, if you want to change their values, put it in your .vimrc.

Prefilled URL for command UpdateVimrc

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'

Altered filetypes

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:

Default command abbreviations

To disable them, simply use let g:vim_tweaks__default_abbreviations = 0

Default keyboard mapping

To disable them, simply use let g:vim_tweaks__default_mapping = 0

Default autocommands

To disable them, simply use let g:vim_tweaks__default_autocommands = 0

Default options for vim editor

To disable them, simply use let g:vim_tweaks__default_options_vim = 0

Default options for vim plugins

To disable them, simply use let g:vim_tweaks__default_options_plugins = 0

Functions

  • 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.

Commands

  • :UpdateVimrc, prompt for an URL, then update the .vimrc file with it (see configuration section to prefill with your favorite)

Default command abbreviations

(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)

Default keyboard mapping

(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