-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvim
177 lines (149 loc) · 4.22 KB
/
vim
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
" some global settings, plugins, and so on---------------{{{
let mapleader = ","
let maplocalleader = "\\"
" encodings
if has("win32")
set encoding=utf-8
set termencoding=utf-8
set fileencoding=utf-8
set fileencodings=utf-8,chinese,cp936
language messages zh_CN.utf-8
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
endif
call plug#begin('~/.vim/plugged')
Plug 'morhetz/gruvbox'
Plug 'honza/vim-snippets'
Plug 'bling/vim-airline'
Plug 'kien/ctrlp.vim'
Plug 'majutsushi/tagbar'
Plug 'sjl/badwolf'
Plug 'SirVer/ultisnips'
Plug 'Lokaltog/vim-easymotion'
Plug 'pangloss/vim-javascript'
Plug 'mxw/vim-jsx'
Plug 'rust-lang/rust.vim'
Plug 'tpope/vim-rails'
Plug 'tpope/vim-bundler'
Plug 'tpope/vim-fugitive'
Plug 'vim-scripts/paredit.vim'
" Plug 'kovisoft/slimv'
Plug 'kyuhi/vim-emoji-complete'
" python indent
Plug 'hynek/vim-python-pep8-indent'
Plug 'tpope/vim-fireplace'
Plug 'guns/vim-clojure-static'
Plug 'leafgarland/typescript-vim'
call plug#end()
filetype plugin indent on
syntax on
set t_Co=256
" colorscheme moloka
colorscheme gruvbox
set background=dark
" vim-airline
let g:airline#extensions#tabline#enabled=1
set laststatus=2
" snips
" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<S-tab>"
" If you want :UltiSnipsEdit to split your window.
" let g:UltiSnipsEditSplit="vertical"
" set the indent style of haskell
let g:haskell_indent_if = 0
let g:haskell_indent_case = 2
let g:haskell_indent_let = 4
let g:haskell_indent_where = 6
let g:haskell_indent_do = 3
let g:haskell_indent_in = 0
set incsearch
set nu
set relativenumber
set autoindent
if has("vms")
set nobackup
else
set backup
endif
set showcmd
set ruler
set hidden
set sw=4
set ts=4
set expandtab
set listchars=tab:»·,trail:·,eol:¬
if has("gui_running")
set guioptions-=T
" set guioptions-=m
if has("gui_gtk")
set guifont=Inconsolata\ Medium\ 12
elseif has("gui_win32")
set guifont=consolas:h12
endif
endif
" }}}
" begin script
" maps
nnoremap <leader>ev :80split $MYVIMRC<cr>
nnoremap <leader>sv :source $MYVIMRC<cr>
nnoremap <leader>cl :close<cr>
nnoremap <leader>z :e.<cr>
nnoremap <leader>q :bd<cr>
nnoremap <leader>j :bn<cr>
nnoremap <leader>k :bp<cr>
nnoremap <leader>" viw<esc>a"<esc>hbi"<esc>le
nnoremap <leader>' viw<esc>a'<esc>hbi'<esc>le
" quick edit, located the parent dir quickly
nnoremap <leader>ee :e <C-R>=expand("%:p:h") . "/"<cr>
cnoremap <leader>ee <C-R>=expand("%:p:h") . "/"<cr>
inoremap <c-l> <c-o>zz
inoremap jk <esc>
inoremap <esc> <nop>
nnoremap H ^
nnoremap L $
cnoremap <C-A> <Home>
cnoremap <C-F> <Right>
cnoremap <C-B> <Left>
cnoremap <C-E> <End>
set cedit=<C-G>
" quick mapping to easy motion' move command
nmap cd <leader><leader>s
nnoremap yd :set list! <cr>
set list
" end of script
" some useful tips
" :retab »» re format tab and space
" :set list »» show all invisible
" :%s/\s\+$/ »» remove all trailing space
" comment for different filetypes ---------------{{{
augroup comments
au!
" comment short key
autocmd FileType javascript nnoremap <buffer> <localleader>c I//<esc>
autocmd FileType javascript nnoremap <buffer> <localleader>z ^xx<esc>
autocmd FileType python nnoremap <buffer> <localleader>c I#<esc>
autocmd FileType python nnoremap <buffer> <localleader>z ^x<esc>
" auto fold in vimL using comments
autocmd FileType vim setlocal foldmethod=marker
autocmd FileType python setlocal sw=4 ts=4 expandtab
autocmd FileType haskell setlocal sw=4 ts=4 expandtab
autocmd FileType css setlocal sw=2 ts=2 expandtab
autocmd FileType scss setlocal sw=2 ts=2 expandtab
autocmd FileType javascript setlocal sw=2 ts=2 expandtab
augroup END
let g:jsx_ext_required = 0
" }}}
" tags set
set tags+=tags;/tags
" tagbar set , need tagbar install first
nnoremap <F8> :TagbarToggle<cr>
" use Unite to search rec file
nnoremap <c-p> :Unite file_rec <cr>
nnoremap <c-o> :Unite buffer <cr>
nnoremap <leader>u :Unite
" slimv
let g:slimv_swank_cmd = '!xterm -e sbcl --load ~/.vim/plugged/slimv/slime/start-swank.lisp &'
" let g:slimv_lisp = '~/sbcl/bin/sbcl'
" let g:slimv_impl = 'sbcl'