2015-10-10 15:34:29 +02:00
|
|
|
""
|
|
|
|
"" Environment
|
|
|
|
""
|
|
|
|
|
|
|
|
set directory=$XDG_CACHE_HOME/vim,~/,/tmp
|
|
|
|
set backupdir=$XDG_CACHE_HOME/vim,~/,/tmp
|
|
|
|
set viminfo+=n$XDG_CACHE_HOME/vim/viminfo
|
|
|
|
set rtp=$XDG_CONFIG_HOME/vim,$XDG_CONFIG_HOME/vim/after,$VIM,$VIMRUNTIME
|
|
|
|
let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc"
|
|
|
|
|
2013-11-22 18:20:32 +01:00
|
|
|
|
|
|
|
""
|
2015-10-10 15:34:29 +02:00
|
|
|
"" Plugins
|
2013-11-22 18:20:32 +01:00
|
|
|
""
|
|
|
|
|
2015-10-10 15:34:29 +02:00
|
|
|
set rtp+=$XDG_CACHE_HOME/vim/plugins/Vundle.vim
|
|
|
|
call vundle#begin('$XDG_CACHE_HOME/vim/plugins')
|
|
|
|
|
|
|
|
Plugin 'VundleVim/Vundle.vim'
|
|
|
|
Plugin 'kien/ctrlp.vim'
|
|
|
|
Plugin 'townk/vim-autoclose'
|
|
|
|
Plugin 'tpope/vim-fugitive'
|
|
|
|
Plugin 'sjl/gundo.vim'
|
|
|
|
Plugin 'itchyny/lightline.vim'
|
|
|
|
Plugin 'tpope/vim-markdown'
|
|
|
|
Plugin 'scrooloose/nerdtree'
|
|
|
|
Plugin 'jistr/vim-nerdtree-tabs'
|
|
|
|
Plugin 'ervandew/supertab'
|
|
|
|
Plugin 'majutsushi/tagbar'
|
|
|
|
Plugin 'scrooloose/syntastic'
|
|
|
|
|
|
|
|
call vundle#end()
|
|
|
|
|
2013-11-22 18:20:32 +01:00
|
|
|
|
|
|
|
""
|
|
|
|
"" Plugins
|
|
|
|
""
|
|
|
|
" Lightline
|
|
|
|
let g:lightline = {
|
|
|
|
\"active": {
|
|
|
|
\ "left": [[ "mode", "paste" ], ["fugitive", "filename", "readonly", "ctrlpmark"]],
|
|
|
|
\ "right": [ ["syntastic", "lineinfo"], ["percent"], ["fileformat", "fileencoding", "filetype"]]
|
2014-07-21 03:20:44 +02:00
|
|
|
\ },
|
2013-11-22 18:20:32 +01:00
|
|
|
\"component": {
|
2015-10-10 15:34:29 +02:00
|
|
|
\"readonly": '%{&filetype=="help"?"":&readonly?"∅":""}',
|
2013-11-22 18:20:32 +01:00
|
|
|
\"modified": '%{&filetype=="help"?"":&modified?"+":&modifiable?"":"-"}'
|
|
|
|
\ },
|
|
|
|
\'component_visible_condition': {
|
|
|
|
\"readonly": '(&filetype!="help"&& &readonly)',
|
|
|
|
\"modified": '(&filetype!="help"&&(&modified||!&modifiable))'
|
|
|
|
\ },
|
|
|
|
\"component_expand": {
|
|
|
|
\ "syntastic": "SyntasticStatuslineFlag",
|
|
|
|
\ },
|
|
|
|
\"component_type": {
|
|
|
|
\ "syntastic": "error",
|
|
|
|
\ },
|
|
|
|
\"component_function": {
|
|
|
|
\ "filename": "Filename",
|
2015-10-10 15:34:29 +02:00
|
|
|
\ "fugitive": "Fugitive",
|
2013-11-22 18:20:32 +01:00
|
|
|
\ "fileformat": "Fileformat",
|
|
|
|
\ "filetype": "Filetype",
|
|
|
|
\ "fileencoding": "Fileencoding",
|
|
|
|
\ "mode": "Mode",
|
|
|
|
\ "ctrlpmark": "CtrlPMark",
|
2015-10-10 15:34:29 +02:00
|
|
|
\ }
|
2013-11-22 18:20:32 +01:00
|
|
|
\ }
|
|
|
|
|
|
|
|
let g:syntastic_check_on_open = 1 " Syntactic
|
|
|
|
let g:syntastic_enable_signs = 1 "
|
|
|
|
let g:syntastic_python_checkers = ["flake8", "python"] "
|
2014-01-14 00:24:49 +01:00
|
|
|
let g:syntastic_python_python_exe = 'python3' "
|
2013-11-22 18:20:32 +01:00
|
|
|
|
|
|
|
let g:tagbar_status_func = "TagbarStatusFunc" " Tagbar
|
|
|
|
let g:tagbar_compact = 1 "
|
|
|
|
let g:tagbar_iconchars = ["▸", "▾"] "
|
|
|
|
|
|
|
|
let g:miniBufExplMapWindowNavVim = 1 " MiniBufferExplorer
|
|
|
|
let g:miniBufExplMapWindowNavArrows = 1 "
|
|
|
|
let g:miniBufExplMapCTabSwitchBufs = 1 "
|
|
|
|
let g:miniBufExplModSelTarget = 1 "
|
|
|
|
|
|
|
|
let g:nerdtree_tabs_open_on_gui_startup = 0 " NerdTree
|
|
|
|
let g:nerdtree_tabs_open_on_console_startup = 0 "
|
|
|
|
|
|
|
|
let g:ctrlp_clear_cache_on_exit=0 " CtrlP
|
|
|
|
let g:ctrlp_status_func = {"main": "CtrlPStatusMain", "prog": "CtrlPStatusProg"} "
|
|
|
|
let g:ctrlp_custom_ignore = {"dir": "\v[\/]\.(git|hg|svn|ve)$"} "
|
|
|
|
|
|
|
|
""
|
|
|
|
"" Impostazioni generali
|
|
|
|
""
|
|
|
|
|
|
|
|
set spell spelllang=it " Controllo ortografico...
|
|
|
|
set nospell " ...solo quando serve
|
|
|
|
|
|
|
|
set nocompatible " Disabilita la compatibilità con vi
|
2014-07-21 03:20:44 +02:00
|
|
|
set backspace=2 " Fix per il DEL nel terminale
|
2013-11-22 18:20:32 +01:00
|
|
|
set hidden " Nasconde i buffers
|
|
|
|
set history=1000 " Aumenta la cronologia
|
|
|
|
set incsearch " Ricerca incrementale
|
|
|
|
set hlsearch " Evidenzia i risultati della ricerca
|
|
|
|
|
|
|
|
set ignorecase " Ricerca case insensitive...
|
|
|
|
set smartcase " ...per i termini minuscoli
|
|
|
|
set laststatus=2 "
|
|
|
|
|
|
|
|
set mouse=a " Abilita il supporto al mouse
|
|
|
|
set showcmd " Mostra il comando mentre lo digit
|
|
|
|
set ruler " Mostra la posizione della linea/colonna
|
|
|
|
set vb t_vb= " Disabilita i beep
|
|
|
|
|
|
|
|
set nobackup " Disabilita i backup ~
|
2014-01-07 16:35:10 +01:00
|
|
|
set noswapfile " Disabilita i file di Swap
|
2013-11-22 18:20:32 +01:00
|
|
|
set writebackup " Abilita backup temporanei
|
|
|
|
|
2015-10-10 15:34:29 +02:00
|
|
|
set undodir=$XDG_CACHE_HOME/vim/undo " Mantiene la cronologia
|
2013-11-22 18:20:32 +01:00
|
|
|
set undofile "
|
|
|
|
|
|
|
|
set wildmenu " Autocompletamento dei comandi
|
2014-03-16 19:48:55 +01:00
|
|
|
set encoding=utf-8 " Codifica
|
2013-11-22 18:20:32 +01:00
|
|
|
set nomodeline " Sicurezza
|
|
|
|
set tabpagemax=10 " Limita il numero di tab a 10
|
|
|
|
set showmatch " Evidenzia le parentesi selezionate
|
|
|
|
set ffs=unix,mac " Formato Unix e Mac per i file
|
|
|
|
set clipboard=unnamed " Integrazione con la clipboard
|
|
|
|
set ttyfast " Migliora il redrawing in xterm
|
|
|
|
filetype indent plugin on " Riconoscimento del tipo del file
|
|
|
|
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " Altri file da ignorare
|
|
|
|
|
|
|
|
set shiftwidth=4 " Tab
|
|
|
|
set tabstop=4 "
|
|
|
|
set noexpandtab "
|
|
|
|
|
|
|
|
set number " Numerazione
|
|
|
|
set autoindent " Indentazione
|
|
|
|
set smartindent "
|
|
|
|
set noshowmode "
|
|
|
|
|
|
|
|
syntax on " Abilita il syntax-highlighter
|
|
|
|
|
|
|
|
set go-=r " Nascondi barre di scorrimento
|
|
|
|
set go-=L "
|
|
|
|
|
|
|
|
|
|
|
|
syntax enable "
|
|
|
|
hi NonText guifg=bg "
|
|
|
|
|
|
|
|
set titlestring=%t%(\ %M%)%(\ (%{expand(\"%:p:h\")})%)%(\ %a%) " Barra del titolo senza “-VIM”
|
|
|
|
|
|
|
|
|
|
|
|
""
|
|
|
|
"" Funzioni
|
|
|
|
""
|
|
|
|
|
|
|
|
function! Fugitive()
|
|
|
|
if &ft !~? 'nerdtree\|gundo\|tagbar' && exists("*fugitive#head")
|
|
|
|
let _ = fugitive#head()
|
|
|
|
return strlen(_) ? "⭠ "._ : ""
|
|
|
|
endif
|
|
|
|
return ''
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! Modified()
|
|
|
|
return &ft =~ "help" ? "" : &modified ? "+" : &modifiable ? "" : "-"
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! Readonly()
|
|
|
|
return &ft !~? "help" && &readonly ? "RO" : ""
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! Filename()
|
|
|
|
let fname = expand('%:t')
|
|
|
|
return fname == 'ControlP' ? g:lightline.ctrlp_item :
|
|
|
|
\ fname == '__Tagbar__' ? g:lightline.fname :
|
|
|
|
\ fname =~ '__Gundo\|NERD_tree' ? '' :
|
|
|
|
\ ('' != fname ? fname : '[No Name]') .
|
|
|
|
\ ('' != Modified() ? ' ' . Modified() : '')
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! Fileformat()
|
|
|
|
return winwidth(0) > 70 ? &fileformat : ""
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! Filetype()
|
|
|
|
return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype : "no ft") : ""
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! Fileencoding()
|
|
|
|
return winwidth(0) > 70 ? (strlen(&fenc) ? &fenc : &enc) : ""
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! Mode()
|
|
|
|
let fname = expand("%:t")
|
|
|
|
return fname == "__Tagbar__" ? "Tagbar" :
|
|
|
|
\ fname == "ControlP" ? "CtrlP" :
|
|
|
|
\ fname == "__Gundo__" ? "Gundo" :
|
|
|
|
\ fname == "__Gundo_Preview__" ? "Gundo Preview" :
|
|
|
|
\ fname =~ "NERD_tree" ? "NERDTree" :
|
|
|
|
\ winwidth(0) > 60 ? lightline#mode() : ""
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! CtrlPMark()
|
|
|
|
if expand("%:t") =~ "ControlP"
|
|
|
|
call lightline#link("iR"[g:lightline.ctrlp_regex])
|
|
|
|
return lightline#concatenate([g:lightline.ctrlp_prev, g:lightline.ctrlp_item
|
|
|
|
\ , g:lightline.ctrlp_next], 0)
|
|
|
|
else
|
|
|
|
return ""
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! CtrlPStatusMain(focus, byfname, regex, prev, item, next, marked)
|
|
|
|
let g:lightline.ctrlp_regex = a:regex
|
|
|
|
let g:lightline.ctrlp_prev = a:prev
|
|
|
|
let g:lightline.ctrlp_item = a:item
|
|
|
|
let g:lightline.ctrlp_next = a:next
|
|
|
|
return lightline#statusline(0)
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! CtrlPStatusProg(str)
|
|
|
|
return lightline#statusline(0)
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! TagbarStatusFunc(current, sort, fname, ...) abort
|
|
|
|
let g:lightline.fname = a:fname
|
|
|
|
return lightline#statusline(0)
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
|
|
""
|
|
|
|
"" Mapping
|
|
|
|
""
|
|
|
|
|
|
|
|
map <C-k> <C-w><Up> " Navigazione tra le finestre
|
|
|
|
map <C-j> <C-w><Down> "
|
|
|
|
map <C-l> <C-w><Right> "
|
|
|
|
map <C-h> <C-w><Left> "
|
|
|
|
|
|
|
|
map <F2> :GundoToggle<CR> " Apri Gundo
|
|
|
|
map <F3> :call ToggleSpell()<CR> " Controllo ortografico
|
|
|
|
map <F5> :NERDTreeTabsToggle<CR> " Apri NERDTree
|
|
|
|
map <F6> :TagbarToggle<CR> " Apri Tagbar
|
|
|
|
map <D-e> :q!<CR> " Esci senza salvare
|
|
|
|
|
|
|
|
|
|
|
|
""
|
|
|
|
"" Varie
|
|
|
|
""
|
|
|
|
|
2015-10-10 15:34:29 +02:00
|
|
|
set tags=$XDG_CACHE_HOME/vim/tags " Tags
|