-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path.vimrc
127 lines (127 loc) · 3.62 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
116
117
118
119
120
121
122
123
124
125
126
127
" use utf-8 without BOM
set encoding=utf-8 nobomb
" enable pathogen
call pathogen#infect()
" Make Vim more useful
set nocompatible
" enable modeline
set modeline
set modelines=1
" use the `solarized` colorscheme
colorscheme solarized
" and make it use the dark background
set background=dark
" set the leader key
let mapleader=" "
" enable a ruler at the bottom of the screen
set ruler
" always display the status line
set laststatus=2
" set up the statusline
"set statusline=%n:\ %F\ %m%r%h%p\ %{synIDattr(synID(line('.'),col('.'),1),'name')}\ %=Line\ %l/%L,\ Column\ %c\ %y
" set up the statusline
set statusline=
" buffer number
set statusline+=[%n]
" file in buffer
set statusline+=\ %F
" modified or not
set statusline+=\ [%{getbufvar(bufnr('%'),'&mod')?'modified':'saved'}]
" readonly flag
set statusline+=%r
" helpfile or not
set statusline+=%h
" right align
set statusline+=%=
" Line number
set statusline+=Line\ %l/%L,
" Column number
set statusline+=\ Column\ %c
" Filetype
set statusline+=\ %y
" enable commandline completion when in command mode
set wildmenu
" Allow cursor keys in insert mode
set esckeys
" use 2 chars whitespace for tabs
set tabstop=2
set softtabstop=2
" use proper tabs
set noexpandtab
" enable loading the indent file for specific file types
filetype plugin indent on
" how many colums >> and << indent
set shiftwidth=2
" indent by multiples of shiftwidth
set shiftround
" don't wrap long lines
set nowrap
" enable autoindenting
set autoindent
" hightlight the line the cursor is on
set cursorline
" show invisibles
set list
" use ▸ followed by spaces to show tabs, use ¬ for end of line characters
set listchars=tab:⇥\ ,eol:¬,nbsp:_,trail:•,extends:»,precedes:«
" use the solarized 256 colorscheme
let g:solarized_termcolors=256
" use line numbers
set number
" use a 5 char wide gutter for linenumbers
set numberwidth=5
" use relative line numbers by default if possible
if exists("+relativenumber")
set relativenumber
endif
" start scrolling 4 lines before hitting the bottom of the screen
set scrolloff=4
" Ignore case when searching, but be smart about it
set ignorecase
set smartcase
" Highlight search results as they are found
set incsearch
" Highlight the last found search results
set hlsearch
" Clear last found search results
nnoremap <leader><space> :nohlsearch<CR>
" Show commands as they are typed
set showcmd
" Show the current mode
set showmode
" Don't show the intro message when starting Vim
set shortmess=atI
" Automatic commands
if has("autocmd")
" Enable file type detection
filetype on
" Treat .json files as .js
autocmd BufNewFile,BufRead *.json setfiletype json syntax=javascript
" Remove trailing whitespace before saving
autocmd BufWritePre * :%s/\s\+$//e
" Override automatic comment insertion on enter in insert mode and when
" using o/O in command mode
autocmd FileType * set formatoptions-=r formatoptions-=o
if exists("&relativenumber")
autocmd BufReadPost * set relativenumber
endif
" reload .vimrc when updating it
autocmd BufWritePost .vimrc nested source %
endif
" force using h/j/k/l instead of arrow keys
nnoremap <Left> :echoe "Use h"<CR>
nnoremap <Right> :echoe "Use l"<CR>
nnoremap <Up> :echoe "Use k"<CR>
nnoremap <Down> :echoe "Use j"<CR>
" disable arrow keys in insert mode to force a switch to command mode
inoremap <Left> <nop>
inoremap <Right> <nop>
inoremap <Up> <nop>
inoremap <Down> <nop>
" disable arrow keys in command mode to really unlearn using arrow keys
cnoremap <Left> <C-u>:echoe "Use C-w, C-u, or C-b"<CR>
cnoremap <Right> <C-u>:echoe "Use C-e"<CR>
cnoremap <Up> <C-u>:echoe "Use C-p"<CR>
cnoremap <Down> <C-u>:echoe "Use C-n"<CR>
" enable syntax highlighting
syntax on