-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
118 lines (93 loc) · 3.55 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
set hlsearch
set number relativenumber
syntax on
imap jk <ESC>
" colorscheme Tomorrow-Night-Bright
set runtimepath^=~/.vim/bundle/ctrlp.vim
filetype plugin indent on
set tabstop=4
set shiftwidth=4
set expandtab
function! AddSubtract(char, back)
let pattern = &nrformats =~ 'alpha' ? '[[:alpha:][:digit:]]' : '[[:digit:]]'
call search(pattern, 'cw' . a:back)
execute 'normal! ' . v:count1 . a:char
silent! call repeat#set(":\<C-u>call AddSubtract('" .a:char. "', '" .a:back. "')\<CR>")
endfunction
nnoremap <silent> <C-a> :<C-u>call AddSubtract("\<C-a>", '')<CR>
nnoremap <silent> <Leader><C-a> :<C-u>call AddSubtract("\<C-a>", 'b')<CR>
nnoremap <silent> <C-x> :<C-u>call AddSubtract("\<C-x>", '')<CR>
nnoremap <silent> <Leader><C-x> :<C-u>call AddSubtract("\<C-x>", 'b')<CR>
noremap ; :
" nnoremap : ;
" Below config is from
" https://www.youtube.com/watch?v=XA2WjJbmmoM&t=1454s
" https://github.com/changemewtf/no_plugins/blob/master/no_plugins.vim
" enter the current millenium
set nocompatible
" enable syntax and plugins (for netrw)
syntax enable
filetype plugin on
" FINDING FILES:
" Search down into subfolders
" Provides tab-completion for all file-related tasks
set path+=**
" Display all matching files when we tab complete
set wildmenu
" Create the `tags` file (may need to install ctags first)
command! MakeTags !ctags -R .
" Sudo
" :w !sudo tee %
" Vim快速选中、删除、复制引号或括号中的内容
" ci'、ci"、ci(、ci[、ci{、ci< - 分别更改这些配对标点符号中的文本内容
" di'、di"、di(或dib、di[、di{或diB、di< - 分别删除这些配对标点符号中的文本内容
" yi'、yi"、yi(、yi[、yi{、yi< - 分别复制这些配对标点符号中的文本内容
" vi'、vi"、vi(、vi[、vi{、vi< - 分别选中这些配对标点符号中的文本内容
" Rectangle insert
" https://stackoverflow.com/questions/1174274/how-can-i-prepend-text-in-the-middle-of-the-line-to-multiple-lines-in-vim
" Autocomplete
" - ^x^n for JUST this file
" - ^x^f for filenames (works with our path trick!)
" - ^x^] for tags only
" - ^n for anything specified by the 'complete' option
"
" Autocomplete file path
" In INSERT MODE
" C-x C-f
"
hi ColorColumn ctermbg=NONE ctermfg=red
match ColorColumn /\%>79v.*\%<81v/
set cursorline
hi CursorLine term=bold cterm=bold guibg=Grey40 ctermbg=239
" "https://github.com/junegunn/vim-plug/wiki/tips#automatic-installation
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
" https://github.com/junegunn/vim-plug/wiki/tutorial
" Now run :PlugInstall to install the plugins.
call plug#begin('~/.vim/plugged')
" https://github.com/junegunn/seoul256.vim
Plug 'junegunn/seoul256.vim'
Plug 'easymotion/vim-easymotion'
Plug 'jeffkreeftmeijer/vim-numbertoggle'
Plug 'https://github.com/tpope/vim-commentary.git'
Plug 'tpope/vim-surround'
call plug#end()
let g:seoul256_background = 233
"let g:seoul256_current_bg = black
silent! colo seoul256
" https://stackoverflow.com/questions/7501092/can-i-map-alt-key-in-vim#answer-24047539
" easymotion
let g:EasyMotion_do_mapping = 0 " Disable default mappings
set winaltkeys=no
map <ESC>j <Plug>(easymotion-f)
nmap <ESC>j <Plug>(easymotion-overwin-f)
nmap cc Vgc0j
nmap , yyp
map <F6> :setlocal spell! spelllang=en_us<CR>
nnoremap S :%s//g<Left><Left>
set fileencodings=utf-8,gb2312,gb18030,gbk,ucs-bom,cp936,latin1
set enc=utf8
set fencs=utf8,gbk,gb2312,gb18030