summaryrefslogtreecommitdiff
path: root/.vimrc
blob: 86f383df361bd5563f691abe9075edea7d69cdd8 (plain)
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
116
" General
set nocompatible
set autoread
set hidden
set showmode
set showcmd
set number
set history=1000
set gcr=a:blinkon0
set grepprg="grep -nH $*"
let g:tex_flavor = "latex"
set laststatus=2
set visualbell
set background=dark
set runtimepath=~/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.vim/after
set autowrite
set autoread
set ttyfast
syntax on

" Make search better
set gdefault
set ignorecase
set smartcase
set hlsearch
noremap <silent> <Leader>, :noh<cr>
set incsearch
set showmatch

" X11 clipboard support
set pastetoggle=<F2> "to preserve indentation
vnoremap <C-c> "*y
map <silent><Leader>p :set paste<CR>o<esc>"*]p:set nopaste<cr>"
map <silent><Leader><S-p> :set paste<CR>O<esc>"*]p:set nopaste<cr>"

" Disable folding
set nofoldenable

" Turn off swap files
set noswapfile
set nobackup
set nowb

" Indentation
set autoindent
set smartindent
set smarttab
set shiftwidth=8
set softtabstop=8
set tabstop=8
set expandtab
filetype plugin on
filetype indent on
noremap p p=`[<C-o>
noremap P P=`[<C-o>

" Per-project indentation
au BufRead,BufEnter ~/repositories/linux/*.{c,h} set noexpandtab

set nowrap
set linebreak

set splitbelow
set splitright

" NERDTree stuffs
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
let NERDTreeIgnore = ['\.o$','\.so$','\.class$','\.png$','\.jpg$']

" Completion
set wildmode=list:longest
set wildmenu
set wildignore=*.o,*.obj,*~
set wildignore+=vim/backups
set wildignore+=*sass-cache*
set wildignore+=*DS_Store*
set wildignore+=vendor/cache/**
set wildignore+=log/**
set wildignore+=tmp/**
set wildignore+=*.png,*.jpeg,*.gif

" Scrolling
set scrolloff=8
set sidescrolloff=15
set sidescroll=1

" Key mapping
no <Up> <Nop>
no <Down> <Nop>
no <Left> <Nop>
no <Right> <Nop>
no <Delete> <Nop>
ino <Up> <Nop>
ino <Down> <Nop>
ino <Left> <Nop>
ino <Right> <Nop>
ino <Delete> <Nop>
vno <Up> <Nop>
vno <Down> <Nop>
vno <Left> <Nop>
vno <Right> <Nop>
vno <Delete> <Nop>
nmap <Leader>s :source ~/.vimrc<CR>
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
nnoremap <silent> <Leader>b :TagbarToggle<CR>
nnoremap <silent> <Leader>n :NERDTreeToggle<CR>
nnoremap <silent> <Leader>c :silent !ctags -R .<CR><C-L>
nnoremap <silent> <Leader>t :tag 
nnoremap qq :quit<CR>
let mapleader = " "

" Email options
au BufRead /tmp/mutt-* set tw=72