1 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4 set nocompatible " get out of horrible vi-compatible mode
5 filetype indent plugin on | syn on
6 set history=1000 " How many lines of history to remember
7 set cf " enable error files and error jumping
8 set ffs=unix,dos,mac " support all three, in this order
9 set viminfo+=! " make sure it can save viminfo
10 set isk+=_,@,- " none of these should be word dividers, so make them not be
11 set nobackup " real man don't use backups ;)
12 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
14 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
15 syntax on " syntax highlighting on
21 "let g:solarized_termcolors=256
23 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
25 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
26 set wildmenu " turn on wild menu
27 set ruler " Always show current positions along the bottom
28 "set number " turn on line numbers
29 set lz " do not redraw while running macros (much faster) (LazyRedraw)
30 set hid " you can change buffer without saving
31 set backspace=2 " make backspace work normal
32 set whichwrap+=<,>,h,l " backspace and cursor keys wrap to
33 set shortmess=atI " shortens messages to avoid 'press a key' prompt
34 set report=0 " tell us when anything is changed via :...
35 " make the splitters between windows be blank
36 set fillchars=vert:\ ,stl:\ ,stlnc:\
38 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
40 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
41 set showmatch " show matching brackets
42 set mat=5 " how many tenths of a second to blink matching brackets for
43 set nohlsearch " do not highlight searched for phrases
44 set incsearch " BUT do highlight as you type you search phrase
45 set listchars=tab:\|\ ,trail:.,extends:>,precedes:<,eol:$ " what to show when I hit :set list
46 set so=10 " Keep 10 lines (top/bottom) for scope
47 set novisualbell " don't blink
48 set noerrorbells " no noises
49 "set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [ASCII=\%03.3b]\ [HEX=\%02.2B]\ [POS=%04l,%04v][%p%%]\ [LEN=%L]
50 set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [POS=%04l,%04v][%p%%]
51 set laststatus=2 " always show the status line
53 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
54 " Text Formatting/Layout
55 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
56 set fo=tcrqn " See Help (complex)
58 set tabstop=4 " tab spacing (settings below are just to unify it)
59 set softtabstop=4 " unify
60 set shiftwidth=4 " unify
61 set expandtab " space instead of tabs please!
62 set nowrap " do not wrap lines
63 autocmd FileType c,cpp,slang set cindent
64 autocmd FileType c,cpp,slang set textwidth=79
67 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
69 " Enable folding, but by default make it act like folding is off, because folding is annoying in anything but a few rare cases
70 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
71 set foldenable " Turn on folding
72 set foldmethod=indent " Make folding indent sensitive
73 set foldlevel=100 " Don't autofold anything (but I can still fold manually)
74 set foldopen-=search " don't open folds when you search into them
75 set foldopen-=undo " don't open folds when you undo stuff
77 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
79 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
80 set mouse=a " mouse support in all modes
81 set mousehide " hide the mouse when typing text
83 " ,p and shift-insert will paste the X buffer, even on the command line
84 nmap <LocalLeader>p i<S-MiddleMouse><ESC>
85 imap <S-Insert> <S-MiddleMouse>
86 cmap <S-Insert> <S-MiddleMouse>
88 " this makes the mouse paste a block of text without formatting it
90 map <MouseMiddle> <esc>"*p
92 " Convenient for non italian keyboard
95 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
97 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
98 let b:match_ignorecase = 1
100 " make tab in v mode ident code
104 " make tab in normal mode ident code
105 nmap <tab> I<tab><esc>
106 nmap <s-tab> ^i<bs><esc>
108 "Easy to access esc key
112 " paste mode - this will avoid unexpected effects when you
113 " cut or copy some text from one window and paste it in Vim.
116 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
118 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
119 let perl_extended_vars=1 " highlight advanced perl vars inside strings
121 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
123 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
124 " Select range, then hit :SuperRetab($width) - by p0g and FallingCow
125 function! SuperRetab(width) range
126 silent! exe a:firstline . ',' . a:lastline . 's/\v%(^ *)@<= {'. a:width .'}/\t/g'
129 "switch spellcheck languages
130 let g:myLangList = [ "none", "it", "en_us" ]
131 function! MySpellLang()
132 "loop through languages
133 if !exists( "b:myLang" )
136 let b:myLang = b:myLang + 1
137 if b:myLang >= len(g:myLangList) | let b:myLang = 0 | endif
139 if b:myLang== 0 | setlocal spell nospell | endif
140 if b:myLang== 1 | setlocal spell spelllang=it | endif
141 if b:myLang== 2 | setlocal spell spelllang=en_us | endif
143 echo "language spell:" g:myLangList[b:myLang]
146 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
148 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
149 " alt-i (normal mode) inserts a single char, and then switches back to normal
151 map <F10> <ESC>ggVG:call SuperRetab()<left>
152 " encypt the file (toggle)
154 map <F8> :call MySpellLang()<CR>
155 map <F7> :TlistOpen<ESC>
156 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
158 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
159 autocmd BufEnter * :syntax sync fromstart " ensure every file does syntax highlighting (full)
160 autocmd BufNewFile *.sh call append(0, "#!/bin/bash")
161 autocmd BufNewFile *.pl call append(0, "#!/usr/bin/perl")
162 autocmd BufNewFile *.py call append(0, "#!/bin/python")
164 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
166 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
167 iab xdate <c-r>=strftime("%d/%m/%y %H:%M:%S")<cr>
170 "iab cha \chapter{}<ESC>i
171 "iab sub \subsection{}
174 "iab enu \begin{enumerate}<CR>\end{enumerate}<ESC>O
175 "iab footn \footnote{}
176 "iab tabb \begin{tabbing}<CR>\end{tabbing}<ESC>O
178 """""""""""""""""""""""""""
179 set titlestring=%t%(\ %M%)%(\ (%{expand(\"%:~:h\")})%)%(\ %a%)\ -\ %{v:servername}
184 if &term == "screen" || &term == "xterm"
191 let addons_base = expand('$HOME') . '/.vim/addons'
192 exec 'set runtimepath+='.addons_base.'/vim-addon-manager'
196 " Plugins that should be always enabled
197 call vam#ActivateAddons(['surround','checksyntax','snipmate','snipmate-snippets','gnupg','LargeFile','taglist-plus'], {'auto_install' : 0})
205 " Enable addons with vim-addon-manager using file type recognition
207 \ '^\%(R\|r\)$': [ 'Screen_vim__gnu_screentmux', 'Vim-R-plugin' ],
209 au FileType * for l in values(filter(copy(ft_addons), string(expand('<amatch>')).' =~ v:key')) | call vam#ActivateAddons(l, {'force_loading_plugins_now':1}) | endfor