-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_vimrc
93 lines (78 loc) · 1.98 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
" auto command setting
" defined autocmd delete before define autocmd,
" because defined autocmd ofen happen error.
autocmd!
syntax on
filetype plugin indent on
set number
set ruler
set cursorline
set cmdheight=2
set title
set wildmenu
set smartindent
"set autoindent
set autowrite
set tabstop=4
set softtabstop=2
set expandtab
set shiftwidth=2
set textwidth=100
set history=5000
" unlock Backspace key restricted
set backspace=eol,indent,start
" set search option
set ignorecase
set smartcase
set hlsearch
set incsearch
set statusline=1
set laststatus=2
set showmode
set showcmd
set showmatch
"normal mode key mapping
noremap ; :
noremap : ;
noremap j gj
noremap k gk
noremap gj j
noremap gk k
noremap [ %
noremap ] %
"insert mode key mapping
inoremap , ,<Space>
"auto input of daytime
inoremap <expr> ,df strftime('%Y-%m-%dT%H:%M:%S')
inoremap <expr> ,dd strftime('%Y-%m-%d')
inoremap <expr> ,dt strftime('%H:%M:%S')
"set smartchr
inoremap <expr> = smartchr#one_of('=', '== ', '=== ', '=')
inoremap <expr> ( smartchr#one_of('(' , '()', '(')
inoremap <expr> { smartchr#one_of('{' , '{}', '{{}}', '{')
inoremap <expr> [ smartchr#one_of('[' , '[]', '[[]]', '[')
nnoremap <C-h> :<C-u>help<Space>
nnoremap <C-h><C-h> :<C-u>help<Space><C-r><C-w><Enter>
nnoremap gc `[v`]
vnoremap gc :<C-u>normal gc<Enter>
onoremap gc :<C-u>normal gc<Enter>
"set autocmd
autocmd WinEnter * setlocal cursorline
autocmd WinLeave * setlocal nocursorline
"delete space before save
autocmd BufWritePre * :%s/\s\+$//ge
"move to line of last edit when file open
autocmd BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal g`\"" | endif
"set encode magic comment
autocmd BufNewFile *.rb 0r ~/.vim/templates/rb.tpl
"set chara code command
command! Cp932 edit ++enc=cp932
command! Eucjp edit ++enc=euc-jp
command! Iso2022jp edit ++enc=iso-2022-jp
command! Utf8 edit ++enc=utf-8
command! Jis Iso2022jp
command! Sjis Cp932
" load * config files
set runtimepath+=~/.vim/
runtime! conf/*.vim
let go_fmt_fail_silently = 1