-
Notifications
You must be signed in to change notification settings - Fork 2
/
.vimrc
196 lines (148 loc) · 5.58 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
" .vimrc
" Maintainer: janus_wel <janus.wel.3@gmail.com>
" Last Change: 2009/02/27 01:58:38.
" initialization ----------------------------------------------------------
" get the personal directory for initialization
" and set it to script local variable 'vimpersonal'
" for compatibility between various operating systems
let s:vimpersonal = split(&runtimepath, ',')[0]
" set path to template files
let s:templatepath = s:vimpersonal . '/template'
" options -----------------------------------------------------------------
" compatible mode off
set nocompatible
" path setting
" add path to my bin
set path^=~/bin/
" timing to write
set noautowrite " set off writing a file automatically
set noautowriteall " completely
" backup
" backup directory
let &backupdir = s:vimpersonal . '/backup/'
set backup " backup feature on
set writebackup " make a backup file before overwriting a file
set backupcopy=auto " how backup files are created, best one
set backupext=~ " tail character to add a backup file
" display & information
set showtabline=2 " show tab bar always
set number " show line numbers
set noruler " not show row and column number of cursor
set title " display file name to edit
set laststatus=2 " show status line always
set showmode " show mode name
set cmdheight=1 " height of command-line is 1 row
set nolist " not show space characters (tab, line break)
set showmatch " show pair parenthesis, bracket
set scrolloff=3 " above and below cursor number is 3 line
" filename [filetype][fileencoding:fileformat][RO]?[+]? column:line/all-line[ percentage-of-buffer%]
set statusline=%t\ %y%{'['.(&fenc!=''?&fenc:&enc).':'.&ff.']'}%r%m%=%c:%l/%L[%3p%%]
" tab & space
set tabstop=4 " tab width
set shiftwidth=4 " tab width (cindent and <<, >>)
set softtabstop=0 " tab width (<Tab>), when this is 0, use tabstop
set autoindent " auto indent on
set expandtab " replace tab to space
" search
set incsearch " incremental search on
set hlsearch " highlight matched word
set ignorecase " pattern is performed as case insensitive normally
set smartcase " but as case sensitive if capital character is contained
set wrapscan " wrap
" backspacing
set backspace=indent,eol,start " allow backspacing over autoindent, line breakes, start of insert
" command-line completion
set wildmenu " command-line completion on
set wildmode=list:full " list all candidates and full completion
" character encoding
set encoding=utf-8 " inside Vim
set fileencoding=utf-8 " buffer default (for new file)
" character encodings for exist files
set fileencodings=utf-8,cp932,euc-jp,iso-2022-jp,utf-16,ucs-2-internal,ucs-2
" end-of-line format
set fileformat=unix " buffer default (for new file)
set fileformats=unix,dos,mac " EOL format for exist files
" filetype ----------------------------------------------------------------
filetype on " filetype detection on
filetype plugin on " for omni completion
filetype indent on " each filetype indent on
" syntax highlight --------------------------------------------------------
syntax enable " use syntax highlight
" color scheme: Janus.vim
colorscheme Janus " my color scheme
" let ---------------------------------------------------------------------
" <Leader>
let mapleader=','
" plugin: autodate.vim
" date format to insert automatically
let autodate_format='%Y/%m/%d %H:%M:%S'
" setting for bash (:help sh.vim)
let g:is_bash=1
" autocmd -----------------------------------------------------------------
" open QuickFix window automatically
augroup showQuickFixWindow
autocmd! showQuickFixWindow
autocmd QuickFixCmdPost make cwindow " make
autocmd QuickFixCmdPost vimgrep cwindow " internal grep
augroup END
" for [x]html
augroup xhtml
autocmd! xhtml
" reindent by <C-b>
" cludge: setting 'indentkeys' at ftplugin don't work in gvim
autocmd FileType html,xhtml setlocal indentkeys& indentkeys+=!
" key mappings
" ftplugin: html.vim
" complete closing tab
autocmd FileType html,xhtml inoremap <buffer><C-f> <Esc>:call InsertHTMLCloseTag()<CR>a<C-b>
" modify by HTML Tidy
autocmd FileType html,xhtml nnoremap <buffer><silent><Leader>h :call ModifyByHTMLTidy()<CR>
augroup END
" map ---------------------------------------------------------------------
" clear mappings
mapclear
mapclear!
" move cursor as it looks
nnoremap j gj
nnoremap k gk
vnoremap j gj
vnoremap k gk
" tabnew is hard to complete
nnoremap t :tabnew<Space>
" switch tab
nnoremap <C-h> gT
nnoremap <C-l> gt
" move tab
" TabShift.vim plugin
nnoremap <silent><C-p> :call TabShift(-1)<CR>
nnoremap <silent><C-n> :call TabShift(+1)<CR>
" line break
nnoremap <silent><S-k> i<CR><Esc>
" scroll matched word to middle of screen
nnoremap n nzz
nnoremap N Nzz
nnoremap * *zz
nnoremap # #zz
nnoremap g* g*zz
nnoremap g# g#zz
" source
nnoremap <silent><Leader>r :source ~/.vimrc<CR>
" make
nnoremap <silent><Leader>m :update<CR>:make<CR>
" path operation ---
" change directory
nnoremap <silent><Leader>c :cd %:p:h<CR>:pwd<CR>
" open explorer and select editing file
if has('win32')
nnoremap <silent><Leader>e :!start explorer /select,%:p<CR>
endif
" settings with plugin ---
" activate smart (keywords or omni) completion
" plugin: SmartComplete.vim
inoremap <C-n> <C-r>=SmartComplete()<CR>
" abbreviation ------------------------------------------------------------
" fix typo
abbreviate retrun return
abbreviate cosnt const
" script ------------------------------------------------------------------
" vim: ts=4 sw=4 sts=0 et