Skip to content

Instantly share code, notes, and snippets.

@shukebeta
Last active June 22, 2020 10:50
Show Gist options
  • Save shukebeta/3891de58371792fa5243ef23a159e038 to your computer and use it in GitHub Desktop.
Save shukebeta/3891de58371792fa5243ef23a159e038 to your computer and use it in GitHub Desktop.
my .vimrc
"curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
set nocompatible
let g:XkbSwitchEnabled = 1
let g:XkbSwitchLib = '/usr/local/lib/libg3kbswitch.so'
function! BuildComposer(info)
if a:info.status != 'unchanged' || a:info.force
if has('nvim')
!cargo build --release --locked
else
!cargo build --release --locked --no-default-features --features json-rpc
endif
endif
endfunction
call plug#begin('~/.vim/plugged')
Plug 'lyokha/vim-xkbswitch'
Plug 'euclio/vim-markdown-composer', { 'do': function('BuildComposer') }
Plug 'tpope/vim-surround'
Plug 'tpope/vim-characterize'
call plug#end()
let g:XkbSwitchEnabled = 1
let g:XkbSwitchLib = '/usr/local/lib/libg3kbswitch.so'
" add by xhat
set encoding=utf-8
set termencoding=utf-8
set fencs=ucs-bom,utf8,gb18030,gbk,gb2312,big5,euc-jp,euc-kr,latin1,cp936
set number
set relativenumber
" 搜索不区分大小写,但键入了大写则自动区分大小写
set ignorecase smartcase
" 空格键向上滚屏 光标不变
nnoremap <SPACE> 2<C-e>
noremap <C-j> 3<C-e>
noremap <C-k> 3<C-y>
" ctrl+h l 分别在插入模式下左右移动
imap <C-h> <ESC>i
imap <C-l> <ESC>la
set ambiwidth=double
" 状态栏格式定义
set laststatus=2
" 不折叠
" set foldlevelstart=99
set nu
" 搜索不区分大小写,但键入了大写则自动区分大小写
set ignorecase smartcase
noremap qq <ESC>:q!<CR>
noremap tsq <ESC>:wq<CR>
" 空格键向上滚屏 光标不变
nnoremap <SPACE> 2<C-e>
noremap <C-j> 3<C-e>
noremap <C-k> 3<C-y>
" 无需设置,alt+h l 即可在插入模式下左右移动
map vv <ESC>:w<cr>
set expandtab
set shiftwidth=4
set tabstop=4
" auto indent
set cindent
set nocompatible
set bs=2
" 语法高亮
syntax enable
" 换行不注释
set paste
" don't backup
set nobackup
" hls = highlight search
set hls
" Don't generate swap file
set noswapfile
" Treat every number as decimal digits (所有数字都当成十进制)
set nrformats=
" Remove trailing white spaces when saving to disk, except files with the following extension.
let blacklist = ['markdown', 'ruby', 'perl']
autocmd BufWritePre * if index(blacklist, &ft) < 0 | %s/\s\+$//e
" Display spaces whose ASCII value are 160 in red background
highlight NonBreakingSpace ctermbg=red guibg=red
match NonBreakingSpace / / " /C+V,xa0/
" Show the ASCII value of the current character
set statusline=%<%f%h%m%r%=%b\ 0x%B\ \ %l,%c%V\ %P
set laststatus=2 " https://vim.fandom.com/wiki/Showing_the_ASCII_value_of_the_current_character
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment