-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
177 lines (155 loc) · 4.42 KB
/
vimrc
File metadata and controls
177 lines (155 loc) · 4.42 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
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
syntax on
" highlight current line, but only in active window
augroup CursorLineOnlyInActiveWindow
autocmd!
autocmd VimEnter,WinEnter,BufWinEnter * setlocal cursorline
autocmd WinLeave * setlocal nocursorline
augroup END
" line
set number
set relativenumber
set nowrap
" tab
set expandtab
set shiftwidth=4
set softtabstop=4
set tabstop=4
set smartindent " autoindent/smartindent
" others
set noswapfile
set nobackup
set undodir=~/.vim/undodir
set backspace=indent,eol,start " 'backspace'
" search
" set ignorecase
" set smartcase
set incsearch
set hlsearch
" clipboard
set pastetoggle=<F2> " set paste
" mouse
set mouse=nv
map <F3> <ESC>:exec &mouse!=""? "set mouse=" : "set mouse=nv"<CR>
" set clipboard=unnamedplus
" set mouse=a
source ~/.vim/tabline.vim
" set colorcolumn=80
" highlight ColorColumn ctermbg=0 guibg=lightgrey
" [vim-pug](https://github.com/junegunn/vim-plug)
" automatically install vim-plug
if empty(glob('~/.vim/autoload/plug.vim'))
silent execute '!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
call plug#begin('~/.vim/plugged')
" Copilot
Plug 'github/copilot.vim'
" vim enhancement
" obsolete for vim 8.2.2345
Plug 'tmux-plugins/vim-tmux-focus-events'
Plug 'roxma/vim-tmux-clipboard'
Plug 'tpope/vim-obsession'
" file manager
" Plug 'francoiscabrol/ranger.vim'
Plug 'ptzz/lf.vim'
" Plug 'voldikss/vim-floaterm'
Plug 'ctrlpvim/ctrlp.vim'
" coding enhancement
Plug 'morhetz/gruvbox'
" Plug 'neoclide/coc.nvim', {'branch': 'release'}
" :CocInstall coc-jedi
Plug 'jiangmiao/auto-pairs'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-fugitive'
Plug 'Vimjas/vim-python-pep8-indent'
" misc
" Plug 'easymotion/vim-easymotion'
" Plug 'vim-airline/vim-airline'
call plug#end()
" :w<CR>:so %<CR>
" :PlugClean
" :PlugInstall
" :PlugUpdate
colorscheme gruvbox
set background=dark
set t_ut=""
" set term=screen-256color
set timeoutlen=1000 ttimeoutlen=50
" source $VIMRUNTIME/defaults.vim
let mapleader = " "
" nnoremap <leader>b :ls<CR>:b
" vertical colorcolumn
nnoremap <silent><leader>c :<C-u>let &l:cc = &l:cc =~# '[0-9]' ? '' : col('.')<CR>
" others
nnoremap <leader>l :redr!<CR>
nnoremap <leader>n :noh<CR>
" Quicker window movement
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l
" " i_CTRL-V: Alt+<char> results in ^[<char>
" execute "set <M-a>=a"
" execute "set <M-e>=e"
" execute "set <M-i>=i"
" execute "set <M-o>=o"
" execute "set <M-x>=x"
" " number +/-
" nnoremap <M-a> <C-a>
" nnoremap <M-x> <C-x>
" " jump forward/backward
" nnoremap <M-o> <C-o>
" nnoremap <M-i> <C-i>
" " save change before deletions
" inoremap <C-u> <C-g>u<C-u>
" " inoremap <C-w> <C-g>u<C-w>
" " home/end
" inoremap <M-a> <C-o>0
" inoremap <M-e> <C-o>$
" tabpage
nnoremap <Tab> gt
nnoremap <S-Tab> gT
" lineput
nnoremap <leader>p :pu<CR>
nnoremap <leader>P :pu!<CR>
" paste
nnoremap <leader>t :set paste<CR>
nnoremap <leader>T :set paste!<CR>
" source ~/.vimrc
nnoremap <leader>v :so ~/.vimrc<CR>
let g:netrw_bufsettings = 'noma nomod nu nobl nowrap ro'
" plugin settings
" lf.vim
nnoremap <leader>w :LfWorkingDirectory<CR>
let g:lf_width = 1.0
let g:lf_height = 1.0
" ctrlp.vim
let g:ctrlp_map = '<c-p>'
" let g:ctrlp_cmd = 'CtrlPBuffer'
nnoremap <leader>b :CtrlPBuffer<CR>
" " coc.nvim
" " let g:coc_disable_startup_warning = 1
" " GoTo code navigation.
" nmap <silent> gd <Plug>(coc-definition)
" nmap <silent> gy <Plug>(coc-type-definition)
" nmap <silent> gi <Plug>(coc-implementation)
" nmap <silent> gr <Plug>(coc-references)
" inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
" inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
" vim-surround
" e.g. yss-
" Code block for markdown
autocmd FileType markdown let b:surround_45 = "```\n\r\n```"
" Block comment for python
autocmd FileType python let b:surround_45 = "\"\"\"\n\r\n\"\"\""
" vim-commentary
" autocmd FileType <filetype> setlocal commentstring=#\ %s
" vim-easymotion
" map <BSlash> <Plug>(easymotion-prefix)
" " vim-airline
" let g:airline#extensions#tabline#enabled = 1
" let g:airline#extensions#tabline#formatter = 'unique_tail_improved' " d/file.txt
" let g:airline#extensions#tabline#tab_nr_type = 1 " tab number
" let g:airline#extensions#tabline#buffer_idx_mode = 1 " buffer number
" :w<CR>:so %<CR>