-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
117 lines (103 loc) · 3.2 KB
/
vimrc
File metadata and controls
117 lines (103 loc) · 3.2 KB
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
" Vimscript file settings ------------------------------------------------ {{{
augroup filetype_vim
autocmd!
autocmd FileType vim setlocal foldmethod=marker
augroup END
" }}}
" Support for Bundle Plugin ---------------------------------------------- {{{
" Do this before using Vundle:
" $ mkdir -p ~/.vim/bundle && git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" Enable Vundle
Plugin 'VundleVim/Vundle.vim'
" Enable Rust programming language highlight
Plugin 'racer-rust/vim-racer'
Plugin 'rust-lang/rust.vim'
" Solarized Color Theme
Plugin 'altercation/vim-colors-solarized'
" Vim Tomorrow Theme
Plugin 'chriskempson/vim-tomorrow-theme'
Plugin 'chriskempson/base16-vim'
" Vim markdown support
Plugin 'godlygeek/tabular'
Plugin 'plasticboy/vim-markdown'
call vundle#end()
" }}}
filetype plugin indent on
syntax on
set number
set cursorline
set ruler
set tabstop=4 shiftwidth=4 expandtab
filetype indent on
" Highlight 80th column
set colorcolumn=80
" Use solarized dark theme
"set background=dark
"colorscheme solarized
" Use tomorrow night theme
colorscheme tomorrow-night
set hlsearch incsearch
" Set encodings ---------------------------------------------------------- {{{
set encoding=utf-8
set fileencodings=ucs-bom,utf-8,cp936,chinese,latin-1
set fileencoding=gb2312
if has("win32")
set fileencoding=chinese
set guifont=Consolas:h11
else
set fileencoding=utf-8
endif
set termencoding=utf-8
" }}}
" 解决菜单乱码
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
" 解决 console 输出乱码
language message zh_CN.utf-8
" For SQC File
"nnoremap <leader>j o * ------------------------------------------------------------------------------<cr> * 修改日期:xxxx-xx-xx<cr> * 修改人员:ckx<cr> * 修改描述:<cr> * 版本信息:<ver><cr> * 专 题 包:<esc>
"" My test script -------------------------------------------------- {{{
" Set leader and localleader
let mapleader = "-"
let maplocalleader = "\\"
" Delete current line
nnoremap <leader>d dd
" Move current line above
nnoremap <leader>_ yykPjjdd
" Make current line upper case
nnoremap <leader>u VU
" Quickly edit vimrc
nnoremap <leader>ev :sp $MYVIMRC<cr>
nnoremap <leader>sv :source $MYVIMRC<cr>
" Quote current word
nnoremap <leader>" viw<esc>a"<esc>bi"<esc>lel
nnoremap <leader>' viw<esc>a'<esc>bi'<esc>lel
" Quote the selected word
vnoremap <leader>" <esc>`<i"<esc>`>a"<esc>
vnoremap <leader>' <esc>`<i'<esc>`>a'<esc>
" Highlight tab or trailing whitespace as error
highlight BadSpaces ctermbg=red guibg=red
nnoremap <leader>w :match BadSpaces /\v\s+$\|\t/<cr>
nnoremap <leader>W :match none<cr>
" Common typos
iabbrev adn and
" Comment out the current line for different file type
" Use <localleader>c for these comment cmd
augroup testgroup
autocmd!
autocmd FileType javascript nnoremap <buffer> <localleader>c I//<esc>
autocmd FileType python nnoremap <buffer> <localleader>c I#<esc>
autocmd FileType sqc nnoremap <buffer> <localleader>c I/*<esc>A*/<esc>
augroup END
" print foo(bar)
" }}}
" Method to format xml
" -------------------------------------------
" :%s/></>\r</g
" :0
" =:$
" -------------------------------------------