dotfiles/auto/vim/.vimrc

80 lines
2.0 KiB
VimL
Raw Permalink Normal View History

2020-09-28 06:45:49 +00:00
filetype plugin indent on
syntax on
autocmd CmdwinEnter * noremap <buffer> <CR> <CR>
2022-01-30 00:16:23 +00:00
autocmd FileType rust,c,cpp,java,python,sh,tex set noexpandtab colorcolumn=101 textwidth=100
2021-10-13 22:45:44 +00:00
autocmd FileType markdown set noexpandtab colorcolumn=81 textwidth=80
autocmd FileType markdown,tex set ai spell
2020-09-28 06:45:49 +00:00
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>r :set relativenumber!<CR>
2020-09-28 06:45:49 +00:00
nnoremap <silent> <leader>s :call ToggleSpellCheck()<CR>
nnoremap <silent> <leader>u :update<CR>
2020-09-28 06:45:49 +00:00
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