forked from gee-forr/vim-files
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
115 lines (100 loc) · 4.39 KB
/
vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
call pathogen#infect()
au BufWritePost .vimrc so ~/.vimrc " automatically reload vimrc when it's saved
"" Some general editor stuff
"set clipboard=unnamed " send yanks to the OS clipboard
set nocompatible " choose no compatibility with legacy vi
set nobackup " Do not keep a backup file
set encoding=utf-8
set showcmd " display incomplete commands
set scrolloff=7 " Never scroll to the edge of the window
set history=50 " Keep the last 50 commands
set t_ti= t_te= " Do not clear the screen when exiting vim, and preserve the window
au FocusLost * :wa " Autosave on losing focus (doesn't seem to work in the terminal)
syntax enable
filetype plugin indent on " load file type plugins + indentation
" Store temporary files in a central spot
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
"" Folding
"set nofoldenable
"set fdl=0
"set foldmethod=indent
"" Whitespace
set nowrap " don't wrap lines
set tabstop=2 shiftwidth=2 " a tab is two spaces (or set this to 4)
set expandtab " use spaces, not tabs (optional)
set shiftround " Always indent/outdent to nearest tabstop
set backspace=indent,eol,start " backspace through everything in insert mode
set pastetoggle=<leader>pt " "Set to toggle paste on and off.
"" Searching
set hlsearch " highlight matches
set incsearch " incremental searching
set ignorecase " searches are case insensitive...
set smartcase " ... unless they contain at least one capital letter
set gdefault " Make global search and replace the default (use /g to make it singular)
set wildmenu
set wildignore+=*/.hg/*,*/.svn/*,*.swp,*.swo
"" Editor window dressing
colorscheme solarized
set t_Co=256 " 256 colours
set cursorline " Highlight current line
set ruler " Show a ruler
"set number " Show line numbers
set relativenumber " Show lines numbers relative to where you are
au InsertEnter * :set nu " absolute line numbers in insert mode,
au InsertLeave * :set rnu " relative otherwise for easy movement
set showmatch " Show matching brackets
set guifont=Inconsolata:h18 "Set the font to Inconsolata at 18pt. (Yes, it's huge)
set bg=dark " Dark background
"set bg=light " Light background
set listchars=tab:▸\ ,eol:¬,trail:⋅,extends:❯,precedes:❮ " Make the list chars less hideous (and more like textmate)
set showbreak=↪
function! CurDir()
let curdir = substitute(getcwd(), '/home/gabrielf/', "~/", "g")
return curdir
endfunction
set laststatus=2 " Show statusline on second last line
set statusline=\ [%F%m%r%h\ %w]\ \ \ [CWD:%r%{CurDir()}%h]\ \ \ [Type=%Y]\ \ \ %{fugitive#statusline()}\ \ \ [Line:%l/%L:%c\ %p%%]\
"" Tab shortcuts
map <leader>tn :tabnew %<cr> " New
map <leader>tc :tabclose<cr> " Close
map <leader>tm :tabmove
map <leader>te :tabe
map <leader><right> :tabn<cr> " Select tab to the right
map <leader><left> :tabp<cr> " Select tab to the left
"" Make working with brackets a little easier
"imap { {}<left>
"imap ( ()<left>
"imap [ []<left>
"" Be clever about pasting from somewhere into the terminal
"" This detects a paste from the pasteboard and will temporarily
"" set pastetoggle
"" Doesn't work with things like tmux and screen
if &term =~ "xterm.*"
let &t_ti = &t_ti . "\e[?2004h"
let &t_te = "\e[?2004l" . &t_te
function XTermPasteBegin(ret)
set pastetoggle=<Esc>[201~
set paste
return a:ret
endfunction
map <expr> <Esc>[200~ XTermPasteBegin("i")
imap <expr> <Esc>[200~ XTermPasteBegin("")
cmap <Esc>[200~ <nop>
cmap <Esc>[201~ <nop>
endif
"" Make vim jump to the last known line
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal! g'\"" | endif
endif
"" Fix silly typos to DWIM, not DWIS
map :W :w
map :Wq :wq
map :WQ :WQ
"" Load up bundle specfic configuration
"" -- doesn't clutter up the rest of the vimrc this way.
runtime! bundle_config/*.vim
""" Highlight trailing whitespace
"highlight TrailWhitespace ctermbg=red guibg=red
"match TrailWhitespace /\s\+$\| \+\ze\t/