Last active
February 3, 2016 17:22
-
-
Save phaberest/6d81e9df0b94de41982c to your computer and use it in GitHub Desktop.
My new vim configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Setting up plug - the vim plugin bundler | |
let PlugIsInstalled=1 | |
let plugfile=expand('~/.vim/autoload/plug.vim') | |
if !filereadable(plugfile) | |
echo "Installing Plug..." | |
echo "" | |
silent !mkdir -p ~/.vim/bundle | |
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim | |
let PlugIsInstalled=0 | |
endif | |
set nocompatible " be iMproved, required | |
filetype off " required | |
call plug#begin('~/.vim/plugged') | |
"################" | |
"#CUSTOM PLUGINS#" | |
"################" | |
Plug 'tpope/vim-surround' " Surround things with things. | |
Plug 'gcmt/breeze.vim' " Jump between HTML tags | |
Plug 'ctrlpvim/ctrlp.vim' " Open files with fuzzy search | |
Plug 'vim-ctrlspace/vim-ctrlspace' " Another all-around search | |
Plug 'airblade/vim-gitgutter' " Highlight git edits | |
Plug 'terryma/vim-multiple-cursors' " Sublime like multiple cursors | |
Plug 'joonty/vim-phpqa' " PHP quality checking tools | |
Plug 'mileszs/ack.vim' " Search files using Ack | |
Plug 'tomtom/tcomment_vim' " Comment using shortcuts | |
"Plug 'scrooloose/nerdcommenter' " Used before tcomment | |
Plug 'scrooloose/syntastic' " Syntax highlighter | |
Plug 'tpope/vim-fugitive' " Git wrapper | |
Plug 'honza/vim-snippets' " It says snippets... | |
Plug 'SirVer/ultisnips' " Snippets too | |
Plug 'sjl/gundo.vim' " Undo with super powers | |
Plug 'vim-airline/vim-airline' " The cool status bar down there | |
Plug 'vim-airline/vim-airline-themes' " Ehm... | |
Plug 'mkarmona/colorsbox' " Theme | |
Plug 'wakatime/vim-wakatime' " Wakatime | |
Plug 'tobyS/pdv' " PHP Documentor | |
Plug 'ryanoasis/vim-devicons' " 'Cause I'm cool with icons | |
Plug 'scrooloose/nerdtree' " Sidebar | |
Plug 'junegunn/vim-easy-align' " Auto aligner | |
Plug 'bronson/vim-trailing-whitespace' " Trailing whitespaces are bad. | |
Plug 'hail2u/vim-css3-syntax' " Guess it. | |
Plug 'tpope/vim-markdown' " Markdown syntax highlighting | |
Plug 'nathanaelkane/vim-indent-guides' " Indent guides are coo...ehm...useful. | |
Plug 'elzr/vim-json' " Json syntax and tools | |
Plug 'frace/vim-bubbles' " Move lines up/down, indent/unindent | |
Plug 'mattn/webapi-vim' " Required for gist-vim to work - An Interface to WEB APIs | |
Plug 'mattn/gist-vim' " Get/Save/Edit Github gists from vim | |
" All of your plugins must be added before the following line | |
if PlugIsInstalled == 0 | |
echo "Installing plugs, please ignore key map error messages" | |
echo "" | |
:PlugInstall | |
endif | |
call plug#end() " required |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" GENERAL | |
set runtimepath+=~/.vim | |
set backup " Enables backups | |
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp | |
set backupskip=/tmp/*,/private/tmp/* | |
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp | |
set writebackup | |
set splitright | |
set splitbelow | |
set clipboard=unnamed | |
let backspace=2 | |
" Vundle and other plugins | |
so ~/.vimplugins.vim | |
" Theme | |
"colorscheme badwolf " https://github.com/sjl/badwolf/ | |
set t_Co=256 " 256 colors | |
colorscheme colorsbox-stnight | |
set background=dark | |
syntax enable " enable syntax processing | |
set encoding=utf8 | |
"set tabstop=4 shiftwidth=4 expandtab " number of visual spaces per TAB | |
"set softtabstop=4 " number of spaces in tab when editing | |
"set expandtab " tabs are spaces | |
set nocompatible " not compatible with vi | |
set autoread " detect when a file is changed | |
" make backspace behave in a sane manner | |
set backspace=indent,eol,start | |
" set a map leader for more key combos | |
let mapleader = ',' | |
let g:mapleader = ',' | |
set history=1000 " change history to 1000 | |
set textwidth=120 | |
" Tab control | |
set noexpandtab " insert tabs rather than spaces for <Tab> | |
set smarttab " tab respects 'tabstop', 'shiftwidth', and 'softtabstop' | |
set tabstop=4 " the visible width of tabs | |
set softtabstop=4 " edit as if the tabs are 4 characters wide | |
set shiftwidth=4 " number of spaces to use for indent and unindent | |
set shiftround " round indent to a multiple of 'shiftwidth' | |
set completeopt+=longest | |
if has('mouse') | |
set mouse=a | |
set ttymouse=xterm2 | |
endif | |
" UI | |
"set mouse=a " Impedisce la copia dei numeri in selezione | |
set laststatus=2 " Statusbar sempre visibile | |
" Set this to the name of your terminal that supports mouse codes. | |
" Must be one of: xterm, xterm2, netterm, dec, jsbterm, pterm | |
"set ttymouse=xterm2 | |
set rnu " relative number (better movements) | |
set showcmd " show command in bottom bar | |
set cursorline " highlight current line | |
filetype plugin indent on " load filetype-specific indent files (pathogen = remove plugin) | |
set wildmenu " visual autocomplete for command menu | |
" This is a pretty cool feature I didn't know Vim had. | |
" You know how Vim automatically autocompletes things | |
" like filenames when you, for instance, run :e ~/.vim<TAB> ? | |
" Well it will provide a graphical menu of all the matches | |
" you can cycle through if you turn on wildmenu. | |
set wildmode=list:longest " complete files like a shell | |
set lazyredraw " redraw only when we need to. | |
set showmatch " highlight matching [{()}] | |
" SEARCH | |
set incsearch " search as characters are entered | |
set hlsearch " highlight matches | |
set ignorecase " case insensitive searching | |
set smartcase " case-sensitive if expresson contains a capital letter | |
set nolazyredraw " don't redraw while executing macros | |
set magic " Set magic on, for regex | |
set showmatch " show matching braces | |
set mat=2 " how many tenths of a second to blink | |
" error bells | |
set noerrorbells | |
set visualbell | |
set t_vb= | |
set tm=500 | |
" turn off search highlight | |
nnoremap <leader><space> :nohlsearch<CR> | |
" MOVIMENTI | |
" move vertically by visual line | |
nnoremap j gj | |
nnoremap k gk | |
" move to beginning/end of line | |
nnoremap B ^ | |
nnoremap E $ | |
" $/^ doesn't do anything | |
nnoremap $ <nop> | |
nnoremap ^ <nop> | |
" highlight last inserted text | |
nnoremap gV `[v`] | |
" It visually selects the block of characters you added last | |
" time you were in INSERT mode. | |
let mapleader="," " leader is comma | |
" jk is escape (premuti contemporaneamente) | |
inoremap jk <esc> | |
inoremap <ctrl>/ <leader>c<space> | |
nnoremap <ctrl>/ <leader>c<space> | |
vnoremap <ctrl>/ <leader>c<space> | |
" toggle gundo | |
nnoremap <leader>u :GundoToggle<CR> | |
" Serve gundo.vim https://github.com/sjl/gundo.vim.git | |
" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe. | |
let g:UltiSnipsExpandTrigger="<tab>" | |
let g:UltiSnipsJumpForwardTrigger="<c-b>" | |
let g:UltiSnipsJumpBackwardTrigger="<c-z>" | |
" If you want :UltiSnipsEdit to split your window. | |
let g:UltiSnipsEditSplit="vertical" | |
" 80 colums ruler | |
highlight OverLength ctermbg=red ctermfg=white guibg=#592929 | |
match OverLength /\%81v.\+/ | |
" do not history when leavy buffer | |
set hidden | |
" airline options | |
let g:airline#extensions#tabline#enabled=1 | |
let g:airline_powerline_fonts=1 | |
let g:airline_left_sep='' | |
let g:airline_right_sep='' | |
let g:airline_theme='base16' | |
" don't hide quotes in json files | |
let g:vim_json_syntax_conceal = 0 | |
" FIXME: (broken) ctrl s to save | |
noremap <C-S> :update<CR> | |
vnoremap <C-S> <C-C>:update<CR> | |
inoremap <C-S> <Esc>:update<CR> | |
" Find | |
map <C-f> / | |
" indend / deindent after selecting the text with (⇧ v), (.) to repeat. | |
vnoremap <Tab> > | |
vnoremap <S-Tab> < | |
" comment / decomment & normal comment behavior | |
vmap <C-m> gc | |
" Disable tComment to escape some entities | |
let g:tcomment#replacements_xml={} | |
" Text wrap simpler, then type the open tag or '," | |
vmap <C-w> S | |
" Cut, Paste, Copy | |
vmap <C-x> d | |
vmap <C-v> p | |
vmap <C-c> y | |
" Undo, Redo (broken) | |
nnoremap <C-z> :undo<CR> | |
inoremap <C-z> <Esc>:undo<CR> | |
nnoremap <C-y> :redo<CR> | |
inoremap <C-y> <Esc>:redo<CR> | |
" Tabs | |
"let g:airline_theme='badwolf' | |
nnoremap <C-b> :tabprevious<CR> | |
inoremap <C-b> <Esc>:tabprevious<CR>i | |
nnoremap <C-n> :tabnext<CR> | |
inoremap <C-n> <Esc>:tabnext<CR>i | |
nnoremap <C-t> :tabnew<CR> | |
inoremap <C-t> <Esc>:tabnew<CR>i | |
nnoremap <C-k> :tabclose<CR> | |
inoremap <C-k> <Esc>:tabclose<CR>i | |
" NERDTree | |
nnoremap <Leader>` :NERDTreeToggle<CR> | |
" lazy ':' | |
map \ : | |
map ; : | |
" let mapleader = ',' | |
nnoremap <Leader>p :set paste<CR> | |
nnoremap <Leader>o :set nopaste<CR> | |
noremap <Leader>g :GitGutterToggle<CR> | |
" multiple cursors | |
let g:multi_cursor_use_default_mapping=0 | |
" Default mapping | |
let g:multi_cursor_next_key='<C-n>' | |
let g:multi_cursor_prev_key='<C-p>' | |
let g:multi_cursor_skip_key='<C-x>' | |
let g:multi_cursor_quit_key='<Esc>' | |
function! NumberToggle() | |
if(&relativenumber == 1) | |
set number | |
else | |
set relativenumber | |
endif | |
endfunc | |
nnoremap <Leader>n :call NumberToggle()<cr> | |
nnoremap <F2> :set invpaste paste?<CR> | |
set pastetoggle=<F2> | |
set showmode | |
autocmd FocusLost * :set number | |
autocmd FocusGained * :set relativenumber | |
autocmd InsertEnter * :set number | |
autocmd InsertLeave * :set relativenumber | |
autocmd BufNewFile,BufReadPost *.md set filetype=markdown | |
let g:webdevicons_conceal_nerdtree_brackets = 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment