dotfiles/vim/.vimrc

85 lines
2.0 KiB
VimL
Raw Normal View History

2020-09-28 06:45:49 +00:00
" vim-plug
call plug#begin()
Plug 'chriskempson/base16-vim'
call plug#end()
colorscheme base16-default-dark
filetype plugin indent on
syntax on
autocmd CmdwinEnter * noremap <buffer> <CR> <CR>
autocmd FileType c,java set colorcolumn=81 textwidth=80
autocmd FileType markdown set ai spell colorcolumn=81 textwidth=80
autocmd FileType rust set noexpandtab
set encoding=utf-8
set termencoding=utf-8
set fileencodings=ucs-bom,utf-8,chinese
let mapleader=" "
nnoremap <space> <nop>
nnoremap Y y$
nnoremap <CR> :
vnoremap <CR> :
nnoremap <silent> <leader>f 1z=
nnoremap <silent> <leader>h :noh<CR>:echo "Stopped search highlighting."<CR>
nnoremap <silent> <leader>i :call ToggleIntuitiveLineMovement()<CR>
nnoremap <silent> <leader>l :set list!<CR>
nnoremap <silent> <leader>q gwap
nnoremap <silent> <leader>s :call ToggleSpellCheck()<CR>
nnoremap <silent> <leader>w :update<CR>
set backspace=indent,eol,start " powerful backspace
set complete+=kspell " dictionary completion
set cpo+=J " sentences are separated by two spaces
set display=lastline " show as much as possible when it doesn't fit
set hlsearch
set incsearch
set listchars=eol:$,tab:>-,trail
set mouse=a
set number
set relativenumber
set showcmd
set spelllang=en_us,cjk
hi Normal ctermfg=white ctermbg=none
hi Search ctermfg=yellow ctermbg=black
hi IncSearch ctermfg=black ctermbg=yellow
hi LineNr ctermfg=10 ctermbg=0
hi CursorLineNr ctermfg=12 ctermbg=0
hi Visual ctermfg=16 ctermbg=yellow
hi Pmenu ctermfg=NONE ctermbg=236
hi PmenuSel ctermfg=0 ctermbg=10
set tabstop=4
set shiftwidth=4
set timeout ttimeoutlen=25
function! ToggleSpellCheck()
set spell!
if &spell
echo "Spell check is now on."
else
echo "Spell check is now off."
endif
endfunction
function! ToggleIntuitiveLineMovement()
if mapcheck("jk")==""
echo "Intuitive line movement is now on."
nnoremap j gj
nnoremap k gk
inoremap <down> <C-o>gj
inoremap <up> <C-o>gk
else
echo "Intuitive line movement is now off."
nunmap j
nunmap k
iunmap <down>
iunmap <up>
endif
endfunction