dotfiles/.vimrc2

46 lines
1.6 KiB
Plaintext

" vundle
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'https://gitee.com/dictxiong/Vundle.vim'
Plugin 'https://gitee.com/dictxiong/onedark.vim'
call vundle#end()
filetype plugin indent on
" end vundle
colorscheme onedark
syntax on
set cursorline
set autoindent
set smartindent
set expandtab "spaces instead of tabs
set tabstop=4 softtabstop=4 shiftwidth=4
autocmd FileType c,cpp,nix,yaml setlocal tabstop=2 softtabstop=2 shiftwidth=2
set backspace=indent,eol,start
set number "line numbers
set history=1000
set ignorecase "when searching
set smartcase "but not when containing upper case chars
set linebreak
"set termguicolors "true color
set completeopt=preview,menu "auto complete
set laststatus=2 "always show statusline
hi User1 ctermfg=14 ctermbg=236
hi User2 ctermfg=237 ctermbg=214
hi User3 ctermfg=15 ctermbg=2
au InsertEnter * hi User3 ctermfg=15 ctermbg=5
au InsertLeave * hi User3 ctermfg=15 ctermbg=2
set statusline=%3*\ %{mode()}\ %*[%n][%F](%{\"\".(&fenc==\"\"?&enc:&fenc).((exists(\"+bomb\")\ &&\ &bomb)?\"+\":\"\").\"\"},%{&ff},%Y)%2*%r%1*%m%*%<%=\'0x%B\'\ [Line:%l/%L,Col:%c][%p%%]
nnoremap <silent> <C-n> :let [&nu, &rnu] = [!&rnu, &nu+&rnu==1]<cr>
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid, when inside an event handler
" (happens when dropping a file on gvim) and for a commit message (it's
" likely a different one than last time).
" Taken from /usr/share/vim/vim81/defaults.vim
autocmd BufReadPost *
\ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
\ | exe "normal! g`\""
\ | endif