dotfiles/config/vim/vimconfig

88 lines
1.5 KiB
Plaintext
Raw Normal View History

2019-04-28 02:27:36 +00:00
""" VIM SETTINGS """
set encoding=utf-8
set title
set number
set ruler
set wrap
set scrolloff=10
set ignorecase
set smartcase
set incsearch
set hlsearch
set tabstop=4
set shiftwidth=4
set expandtab
set visualbell
set noerrorbells
set backspace=indent,eol,start
set hidden
set updatetime=250
set cursorcolumn
set splitbelow
set number relativenumber
syntax enable
" From http://stackoverflow.com/a/5004785/2766106
set list
set listchars=tab:╾╌,trail:·,extends:↦,precedes:↤,nbsp:_
set showbreak=↪
filetype on
filetype plugin on
filetype indent on
set wildmode=longest,list
set showcmd
" Put plugins and dictionaries in this dir (also on Windows)
let vimDir = '$HOME/.cache/vim'
let &runtimepath.=','.vimDir
" theme
source $HOME/.cache/vim/colorscheme.vim
" Keep undo history across sessions by storing it in a file
if has('persistent_undo')
let myUndoDir = expand(vimDir . '/undodir')
" Create dirs
call system('mkdir ' . vimDir)
call system('mkdir ' . myUndoDir)
let &undodir = myUndoDir
set undofile
endif
" Allow saving of files as sudo when I forgot to start vim using sudo.
" From https://stackoverflow.com/a/7078429
cmap w!! w !sudo tee > /dev/null %
imap jk <Esc>
vmap <Enter> <Esc>
nmap <Enter> o<Esc>
nmap <C-H> :bp<CR>
nmap <C-L> :bn<CR>
if has('nvim')
" nmap <C-K> 20k
" nmap <C-J> 20j
noremap <silent> <C-K> :call smooth_scroll#up(20, 5, 1)<CR>
noremap <silent> <C-J> :call smooth_scroll#down(20, 5, 1)<CR>
else
nmap <C-K> kkkkkkkkkkkkkkkkkkkkk
nmap <C-J> jjjjjjjjjjjjjjjjjjjjj
endif