" Run in vim compatible mode (newer options and behaviour). set nocompatible " Enable colouring for dark background terminals. set background=dark " Enable syntax highlighting and coloring. syntax enable " Enable filetype detection, plugins, and indention. filetype plugin indent on " Begin searching while typing. set incsearch " Ignore case while searching. set ignorecase " Use intelligent case while searching. " If search string contains an upper case letter, disable ignorecase. set smartcase " Insert spaces for tabs according to shiftwidth. set smarttab " Use indent from current line when starting a new one. set autoindent " Use smart indenting when starting a new line. set smartindent " Highlight search results in buffer. set hlsearch " Don't convert tab in space set noexpandtab " Allow backspace over ... set backspace=indent,eol,start " Strings to use in list mode. set listchars=tab:>-,extends:>,precedes:<,trail:-,nbsp:%,eol:$ " Disable line wrapping. set nowrap " Fold set foldenable " Turn on folding set foldmethod=indent " Make folding indent sensitive set foldlevel=100 " Don't autofold anything (but I can still fold manually) set foldopen-=search " don't open folds when you search into them set foldopen-=undo " don't open folds when you undo stuff " When closing a block, show the matching bracket. set showmatch " Include angle brackets in matching. set matchpairs+=<:> " Do not redraw the screen while macros are running. set lazyredraw " Save files before performing certain actions. set autowrite " Show current mode in the status line. set showmode " Show the command in the status line. set showcmd " Start scrolling at this number of lines from the bottom. set scrolloff=2 " Start scrolling horizontally at this number of columns. set sidescrolloff=5 " Status line takes up this many lines. " Make the status line always visible. set laststatus=2 " Always show the ruler. set ruler " Indicates a fast terminal connection. set ttyfast " Enables wildmenu tab completion. set wildmenu " Type of wildmenu. set wildmode=longest:full,list:full " Massively detailed viminfo file. set viminfo='500,f1,:100,/100 " Look for embedded modelines at the top of the file. set modeline " Only look at this number of lines for modeline set modelines=10 " Try to detect file formats. " Unix for new files and autodetect for the rest. set fileformats=unix,dos,mac " Command history size. set history=50 " Disable the splash screen (and some various tweaks for messages). set shortmess=aTItoO " Enable the popup menu. set mousem=popup " Status line definition. set statusline=[%n]\ %<%f%m%r\ %w\ %y\ \ <%{&fileformat}>%=[%o]\ %l,%c%V\/%L\ \ %P " Disable the beeping. set noerrorbells " Set the terminal window title. set title " Make p in Visual mode replace the selected text with the "" register. vnoremap p :let current_reg = @"gvs=current_reg " One line comments. map ,# :s/^/#/ :nohlsearch map ,/ :s/^/\/\// :nohlsearch map ,> :s/^/> / :nohlsearch map ," :s/^/\"/ :nohlsearch map ,% :s/^/%/ :nohlsearch map ,! :s/^/!/ :nohlsearch map ,; :s/^/;/ :nohlsearch map ,- :s/^/--/ :nohlsearch " To remove map ,c :s/^\/\/\\|^--\\|^> \\|^[#"%!;]// :nohlsearch " Wrapping comments map ,* :s/^\(.*\)$/\/\* \1 \*\// :nohlsearch map ,( :s/^\(.*\)$/\(\* \1 \*\)/:nohlsearch map ,< :s/^\(.*\)$// :nohlsearch " To remove map ,d :s/^\([/(]\*\\|\)$/\2/:nohlsearch " hotkey F7 to toggle highlighting of real TABs map :set invlist list? " call spell function map :call MySpellLang() " toggle hlsearch map :set invhlsearch hlsearch? " hotkey F10 to toggle past mode map :set invpaste paste? " hotkey F11 to toggle line numbers map :set invnumber number? "switch spellcheck languages let g:myLangList = [ "none", "it", "en_us" ] function! MySpellLang() "loop through languages if !exists( "b:myLang" ) let b:myLang=0 endif let b:myLang = b:myLang + 1 if b:myLang >= len(g:myLangList) | let b:myLang = 0 | endif if b:myLang== 0 | setlocal spell nospell | endif if b:myLang== 1 | setlocal spell spelllang=it | endif if b:myLang== 2 | setlocal spell spelllang=en_us | endif echo "language spell:" g:myLangList[b:myLang] endf