Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 245 lines (204 sloc) 10.288 kB
7cb2674 Modified vimrc
alessioalex authored
1 " Environment {
2
3 " Basics {
4 set nocompatible " Forget compatibility with vi - must be first line
5 set background=dark " Assume a dark background
6 " }
296e3c1 vimrc modifs
alessioalex authored
7
7cb2674 Modified vimrc
alessioalex authored
8 " Windows Compatible {
9 " On Windows, also use '.vim' instead of 'vimfiles'
10 " this makes synchronization across (heterogeneous) systems easier.
11 if has('win32') || has('win64')
12 set runtimepath=$HOME/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/.vim/after
13 endif
14 " }
15
296e3c1 vimrc modifs
alessioalex authored
16 " Includes {
17
18 " Custom functions library
19 source $HOME/.vim/includes/functions.vim
20
21 " This file contains all the abbreviations
22 source $HOME/.vim/includes/abbreviations.vim
23
24 " This file contains all the plugin customizations
25 source $HOME/.vim/includes/plugin_settings.vim
26 " }
27
044301f Changed the close tag plugin and fixed once and for all html indentat…
alessioalex authored
28 " Setup Bundle Support {
29 " The next two lines ensure that the ~/.vim/bundle/ system works
30 call pathogen#runtime_append_all_bundles()
31 call pathogen#helptags()
32 " }
33
7cb2674 Modified vimrc
alessioalex authored
34 " }
35
36 " General {
37 filetype plugin indent on " Automatically detect file types
38 syntax on " Turn on syntax highlighting
39 set mouse=a " Automatically enable mouse usage
296e3c1 vimrc modifs
alessioalex authored
40 set mousehide " Hide mouse when typing
41 set splitbelow " Splits window BELOW current window
888e6a5 Open new split on the right by default (instead of left)
alessioalex authored
42 set splitright " Open new split on the right
7cb2674 Modified vimrc
alessioalex authored
43 set autochdir " Automatically use the current file's directory as the working directory
44 set autowrite " Automatically write a file when leaving a modified buffer
6b8f707 Modified vimrc a bit.
alessioalex authored
45 set viewoptions=folds,options,cursor,unix,slash " Better unix / windows compatibility
46 set virtualedit=onemore " Allow for cursor beyond last character
47 set history=50 " Store last 50 commands in history (default is 20)
296e3c1 vimrc modifs
alessioalex authored
48 set timeoutlen=500 " Lower the timeout after typing the leader key
49 set hidden " Switch between buffers without saving
50 set visualbell " No beeping
51 set dictionary+=$HOME/.vim/includes/dictionary.txt "Custom autocomplete dictionary
52
2bb0e31 .ejs = .html (Node.js)
alessioalex authored
53 " ejs in Node.js is kindof like html
54 au BufRead,BufNewFile *.ejs set filetype=html
55
35bf9cd Added CoffeeScript plugin
alessio authored
56 " strange bug in Ubuntu seems the ft is not set automatically for CS
57 au BufRead,BufNewFile *.coffee set filetype=coffee
58
296e3c1 vimrc modifs
alessioalex authored
59 autocmd bufwritepost .vimrc source $MYVIMRC " Source the vimrc file after saving it
60 " Load a template from the templates folder - function defined in
61 " includes/functions.php
62 autocmd BufNewFile * silent! call LoadTemplate('%:e')
63
64 " Save template on exit and then reload it
65 " autocmd VimEnter * call LoadSession()
66 " autocmd VimLeave * call SaveSession()
67 "
68 " Save view on exit and then reload it
69 " au BufWinLeave * silent! mkview
70 " au BufWinEnter * silent! loadview
4cc4e14 Reorganized folder structure: used pathogen and git submodulesfor plu…
alessio authored
71
6b8f707 Modified vimrc a bit.
alessioalex authored
72 " Setting up the directories {
8d4c22d Vimrc modif
alessioalex authored
73 set nobackup " No backups
74 set nowritebackup " and again
75 set directory=$HOME/.vim/tmp//,. " Swap files location
76 set viewdir=$HOME/.vim/sessions " View files location
6b8f707 Modified vimrc a bit.
alessioalex authored
77 " }
78 " }
4cc4e14 Reorganized folder structure: used pathogen and git submodulesfor plu…
alessio authored
79
8d4c22d Vimrc modif
alessioalex authored
80 " Vim UI {
6f809f0 Changed to mustang colorscheme and modifed it a bit.
alessioalex authored
81 colorscheme mustang " Set the 'theme' - some alternatives would be
82 " vividchalk, molokai, desert, molokai-modified, synic, blackboard
8d4c22d Vimrc modif
alessioalex authored
83 set tabpagemax=15 " Only show 15 tabs
84 set showmode " Display the current mode
85 set cursorline " CursorLine color group for the current line
296e3c1 vimrc modifs
alessioalex authored
86 call OverLength() " 80 column concern trick from includes/functions.vim
87 call PopupMenuLikeIDE() " Completion popup menu like in an IDE from includes/functions.vim
88
8d4c22d Vimrc modif
alessioalex authored
89 if has('cmdline_info')
90 set ruler " show the ruler
91 set rulerformat=%30(%=\:b%n%y%m%r%w\ %l,%c%V\ %P%) " a ruler on steroids
92 set showcmd " show partial commands in status line and
93 " selected characters/lines in visual mode
94 endif
95
96 if has('statusline')
97 set laststatus=2 "Always show the status line
98
99 " Broken down into easily includeable segments
100 set statusline=%<%f\ " Filename
a4cdf3c Minor changes to the status line.
alessioalex authored
101 " set statusline+=\ [%{getcwd()}] " Current dir
8d4c22d Vimrc modif
alessioalex authored
102 set statusline+=%w%h%m%r " Options
103 set statusline+=%{fugitive#statusline()} " Git Hotness
104 set statusline+=\ [%{&ff}/%Y] " Filetype
26e8efc Modified statusline in vimrc
alessioalex authored
105 " set statusline+=\ [%{strftime(\"%l:%M:%S\ \%p,\ %a\ %b\ %d,\ %Y\")}]\
8d4c22d Vimrc modif
alessioalex authored
106 " Current time
26e8efc Modified statusline in vimrc
alessioalex authored
107 " set statusline+=\ [A=\%03.3b/H=\%02.2B] " ASCII / Hexadecimal value of char
a4cdf3c Minor changes to the status line.
alessioalex authored
108 set statusline+=[tabs=%{&ts}]
8d4c22d Vimrc modif
alessioalex authored
109 set statusline+=%=%-14.(line:%l,col:%c%V%)\ %p%% " Right aligned file nav info
110 endif
111
296e3c1 vimrc modifs
alessioalex authored
112 "Set a nice title
113 set titlestring=%t%(\ %M%)%(\ (%{expand(\"%:p:h\")})%)%(\ %a%)\ -\ %{v:servername}
8d4c22d Vimrc modif
alessioalex authored
114 set backspace=indent,eol,start " Intuitive backspace
2bb0e31 .ejs = .html (Node.js)
alessioalex authored
115 set linespace=3 " Prefer a slightly higer line height
8d4c22d Vimrc modif
alessioalex authored
116 set number " Show line numbers
117 set showmatch " Show matching brackets/parenthesis
118 set incsearch " Find as you type search
119 set hlsearch " Highlight search terms
1a3be23 More changes to the vimrc file.
alessioalex authored
120 set ignorecase " Case-insensitive searching.
121 set smartcase " But case-sensitive if expression contains a capital letter.
122 set wildmenu " Show list instead of just completing
123 set wildmode=list:longest,full " Command <Tab> completion, list matches, then longest common part, then all.
124 set whichwrap=b,s,h,l,<,>,[,] " Backspace and cursor keys wrap to
926cebc More vimrc changes
alessioalex authored
125 " set scrolljump=5 " Lines to scroll when cursor leaves screen
1a3be23 More changes to the vimrc file.
alessioalex authored
126 set scrolloff=5 " Minimum 5 lines of text above and below the cursor
127 set foldenable " Auto fold colde
128 set gdefault " The /g flag on :s substitutions by default
129 set list " View tabs, where line ends etc
130 set listchars=tab:>.,trail:.,extends:#,nbsp:. " Highlight problematic whitespace
131 " Tab displays as >.. & space as .
8d4c22d Vimrc modif
alessioalex authored
132 " }
133
1a3be23 More changes to the vimrc file.
alessioalex authored
134 " Formatting {
926cebc More vimrc changes
alessioalex authored
135 set nowrap " Don't wrap long lines
136 set smartindent " Do smart autoindenting when starting a new line
137 " works for C-like programs
138 set autoindent " Indent at the same level of the previous line
408a497 2 spaces instead of 4
alessioalex authored
139 set shiftwidth=2 " Use indents of 4 spaces
926cebc More vimrc changes
alessioalex authored
140 set expandtab " Tabs are spaces, not tabs
408a497 2 spaces instead of 4
alessioalex authored
141 set tabstop=2 " Number of spaces that a <Tab> in the file counts for
926cebc More vimrc changes
alessioalex authored
142 " an indentation every 4 columns
408a497 2 spaces instead of 4
alessioalex authored
143 set softtabstop=2 " Let backspace delete indent
926cebc More vimrc changes
alessioalex authored
144 set pastetoggle=<F12> " Sane indentation on pastes
145 " Remove trailing whitespaces and ^M chars
146 autocmd FileType c,cpp,java,php,js,python,twig,xml,yml autocmd BufWritePre <buffer> :call setline(1,map(getline(1,"$"),'substitute(v:val,"\\s\\+$","","")'))
88d8940 Added 2 spaces for ruby files and re-added tmp directory
alessio authored
147
148 " JavaScript & Ruby - set 2 spaces for tabs
b5131cb Removed web-indent plugin (buggy) and added Tabularize (+shortcuts)
alessioalex authored
149 au FileType javascript set shiftwidth=2
150 au FileType javascript set tabstop=2
151 au FileType javascript set softtabstop=2
88d8940 Added 2 spaces for ruby files and re-added tmp directory
alessio authored
152
153 au FileType ruby set shiftwidth=2
154 au FileType ruby set tabstop=2
155 au FileType ruby set softtabstop=2
926cebc More vimrc changes
alessioalex authored
156 " }
157
158 " Key (re)Mappings {
159
160 "The default leader is '\', but many people prefer ',' as it's in a standard
161 "location
162 " let mapleader = ','
163
164 " Making it so ; works like : for commands.
165 " Saves typing and eliminates :W style typos due to lazy holding shift.
166 nnoremap ; :
167
168 " Fix for navigating long lines
169 " Wrapped lines goes down/up to next row, rather than next line in file.
170 map <A-DOWN> gj
171 map <A-UP> gk
172 imap <A-UP> <ESC>gki
173 imap <A-DOWN> <ESC>gji
174
175 " Stupid shift key fixes
176 cmap W w
177 cmap WQ wq
178 cmap wQ wq
179 cmap Q q
180 cmap Tabe tabe
181
182 " Yank from the cursor to the end of the line, to be consistent with C and D.
183 nnoremap Y y$
184
185 " Code folding options
186 nmap <leader>f0 :set foldlevel=0<CR>
187 nmap <leader>f1 :set foldlevel=1<CR>
188 nmap <leader>f2 :set foldlevel=2<CR>
189 nmap <leader>f3 :set foldlevel=3<CR>
190 nmap <leader>f4 :set foldlevel=4<CR>
191 nmap <leader>f5 :set foldlevel=5<CR>
192 nmap <leader>f6 :set foldlevel=6<CR>
193 nmap <leader>f7 :set foldlevel=7<CR>
194 nmap <leader>f8 :set foldlevel=8<CR>
195 nmap <leader>f9 :set foldlevel=9<CR>
196
197 "Shortcut to fold tags with leader (usually \) + ft
198 nnoremap <leader>ft Vatzf
199
200 " Change Working Directory to that of the current file
201 cmap cwd lcd %:p:h
202 cmap cd. lcd %:p:h
203
204 " Visual shifting (does not exit Visual mode)
205 vnoremap < <gv
206 vnoremap > >gv
207
208 " Map escape to ,e
209 imap ,e <esc>
210
211 " Shortcut for editing .vimrc
212 nmap ,ev :tabedit $MYVIMRC<cr>
213
214 " Delete all buffers except the current one (via Derek Wyatt)
215 nmap <silent> ,da :exec "1," . bufnr('$') . "bd"<cr>
216
217 "Opens a vertical split and switches over (\v)
218 nmap <leader>v <C-w>v<C-w>l
219
220 " Jump between placeholders with CTRL+J
221 nnoremap <c-j> /<+.\{-1,}+><cr>c/+>/e<cr>
222 inoremap <c-j> <ESC>/<+.\{-1,}+><cr>c/+>/e<cr>
296e3c1 vimrc modifs
alessioalex authored
223
224 " Toggle highlight search with CTRL+S
225 " Function defined in includes/functions.vim
226 nmap <silent> <C-s> <Esc>:call ToggleHLSearch()<cr>
926cebc More vimrc changes
alessioalex authored
227 " }
228
229 " GUI Settings {
230 " GVIM- (here instead of .gvimrc)
231 if has('gui_running')
232 set guioptions-=m " Remove the menu & toolbar
233 set guioptions-=T
234 set lines=55 columns=158 " Set fullscreen for my desktop
235 else
236 set term=builtin_ansi " Make arrow and other keys work
237 endif
238 " }
239
240 " Use local vimrc if available {
241 if filereadable(expand("~/.vimrc.local"))
242 source ~/.vimrc.local
243 endif
1a3be23 More changes to the vimrc file.
alessioalex authored
244 " }
Something went wrong with that request. Please try again.