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
22 "colorscheme solarized
24 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
26 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
27 set wildmenu " turn on wild menu
28 set ruler " Always show current positions along the bottom
29 "set number " turn on line numbers
30 set lz " do not redraw while running macros (much faster) (LazyRedraw)
31 set hid " you can change buffer without saving
32 set backspace=2 " make backspace work normal
33 set whichwrap+=<,>,h,l " backspace and cursor keys wrap to
34 set mouse=a " use mouse everywhere
35 set shortmess=atI " shortens messages to avoid 'press a key' prompt
36 set report=0 " tell us when anything is changed via :...
37 " make the splitters between windows be blank
38 set fillchars=vert:\ ,stl:\ ,stlnc:\
40 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
42 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
43 set showmatch " show matching brackets
44 set mat=5 " how many tenths of a second to blink matching brackets for
45 set nohlsearch " do not highlight searched for phrases
46 set incsearch " BUT do highlight as you type you search phrase
47 set listchars=tab:\|\ ,trail:.,extends:>,precedes:<,eol:$ " what to show when I hit :set list
48 set so=10 " Keep 10 lines (top/bottom) for scope
49 set novisualbell " don't blink
50 set noerrorbells " no noises
51 "set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [ASCII=\%03.3b]\ [HEX=\%02.2B]\ [POS=%04l,%04v][%p%%]\ [LEN=%L]
52 set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [POS=%04l,%04v][%p%%]
53 set laststatus=2 " always show the status line
55 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
56 " Text Formatting/Layout
57 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
58 set fo=tcrqn " See Help (complex)
60 set tabstop=4 " tab spacing (settings below are just to unify it)
61 set softtabstop=4 " unify
62 set shiftwidth=4 " unify
63 set expandtab " space instead of tabs please!
64 set nowrap " do not wrap lines
65 autocmd FileType c,cpp,slang set cindent
66 autocmd FileType c,cpp,slang set textwidth=79
69 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
71 " Enable folding, but by default make it act like folding is off, because folding is annoying in anything but a few rare cases
72 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
73 set foldenable " Turn on folding
74 set foldmethod=indent " Make folding indent sensitive
75 set foldlevel=100 " Don't autofold anything (but I can still fold manually)
76 set foldopen-=search " don't open folds when you search into them
77 set foldopen-=undo " don't open folds when you undo stuff
79 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
81 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
82 set mouse=a " mouse support in all modes
83 set mousehide " hide the mouse when typing text
85 " ,p and shift-insert will paste the X buffer, even on the command line
86 nmap <LocalLeader>p i<S-MiddleMouse><ESC>
87 imap <S-Insert> <S-MiddleMouse>
88 cmap <S-Insert> <S-MiddleMouse>
90 " this makes the mouse paste a block of text without formatting it
92 map <MouseMiddle> <esc>"*p
94 " Convenient for non italian keyboard
97 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
99 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
100 let b:match_ignorecase = 1
102 " make tab in v mode ident code
106 " make tab in normal mode ident code
107 nmap <tab> I<tab><esc>
108 nmap <s-tab> ^i<bs><esc>
110 "Easy to access esc key
114 " paste mode - this will avoid unexpected effects when you
115 " cut or copy some text from one window and paste it in Vim.
118 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
120 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
121 let perl_extended_vars=1 " highlight advanced perl vars inside strings
123 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
125 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
126 " Select range, then hit :SuperRetab($width) - by p0g and FallingCow
127 function! SuperRetab(width) range
128 silent! exe a:firstline . ',' . a:lastline . 's/\v%(^ *)@<= {'. a:width .'}/\t/g'
131 "switch spellcheck languages
132 let g:myLangList = [ "none", "it", "en_us" ]
133 function! MySpellLang()
134 "loop through languages
135 if !exists( "b:myLang" )
138 let b:myLang = b:myLang + 1
139 if b:myLang >= len(g:myLangList) | let b:myLang = 0 | endif
141 if b:myLang== 0 | setlocal spell nospell | endif
142 if b:myLang== 1 | setlocal spell spelllang=it | endif
143 if b:myLang== 2 | setlocal spell spelllang=en_us | endif
145 echo "language spell:" g:myLangList[b:myLang]
148 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
150 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
151 " alt-i (normal mode) inserts a single char, and then switches back to normal
153 map <F10> <ESC>ggVG:call SuperRetab()<left>
154 " encypt the file (toggle)
156 map <F8> :call MySpellLang()<CR>
157 map <F7> :TlistOpen<ESC>
158 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
160 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
161 autocmd BufEnter * :syntax sync fromstart " ensure every file does syntax highlighting (full)
162 autocmd BufNewFile *.sh call append(0, "#!/bin/bash")
163 autocmd BufNewFile *.pl call append(0, "#!/usr/bin/perl")
164 autocmd BufNewFile *.py call append(0, "#!/bin/python")
166 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
168 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
169 iab xdate <c-r>=strftime("%d/%m/%y %H:%M:%S")<cr>
172 "iab cha \chapter{}<ESC>i
173 "iab sub \subsection{}
176 "iab enu \begin{enumerate}<CR>\end{enumerate}<ESC>O
177 "iab footn \footnote{}
178 "iab tabb \begin{tabbing}<CR>\end{tabbing}<ESC>O
180 """""""""""""""""""""""""""
181 set titlestring=%t%(\ %M%)%(\ (%{expand(\"%:~:h\")})%)%(\ %a%)\ -\ %{v:servername}
186 if &term == "screen" || &term == "xterm"
193 let addons_base = expand('$HOME') . '/.vim/addons'
194 exec 'set runtimepath+='.addons_base.'/vim-addon-manager'
196 " unix based os users may want to use this code checking out VAM
197 " if !isdirectory(addons_base.'/vim-addon-manager')
198 " exec '!p='.shellescape(addons_base).'; mkdir -p "$p" && cd "$p" && git clone --depth 1 git://github.com/MarcWeber/vim-addon-manager.git'
201 " commenting try .. endtry because trace is lost if you use it.
202 " There should be no exception anyway
205 let g:solarized_termcolors=256
206 call vam#ActivateAddons(['github:altercation/vim-colors-solarized'])
207 call vam#ActivateAddons(['surround','checksyntax','snipmate','snipmate-snippets','gnupg','LargeFile','taglist-plus'], {'auto_install' : 0})
208 " pluginA could be github:YourName see vam#install#RewriteName()
216 \ '^\%(R\|r\)$': [ 'Screen_vim__gnu_screentmux', 'Vim-R-plugin' ],
218 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
219 " experimental: run after gui has been started (gvim) [3]
220 " option1: au VimEnter * call SetupVAM()
221 " option2: au GUIEnter * call SetupVAM()
222 " See BUGS sections below [*]