139 lines
2.9 KiB
VimL
139 lines
2.9 KiB
VimL
""""""""""""""""""""""
|
|
" __ _____ __ __ "
|
|
" \ \ / /_ _| \/ | "
|
|
" \ V / | || |\/| | "
|
|
" \_/ |___|_| |_| "
|
|
" "
|
|
""""""""""""""""""""""
|
|
set nocp
|
|
|
|
so ~/.vim/user/files.vim
|
|
|
|
colorscheme desert
|
|
|
|
set tsr+=~/.vim/thesaurus/thesaurus-vim-en
|
|
set dict+=/usr/share/dict/words
|
|
|
|
set foldmethod=syntax
|
|
set foldlevelstart=5
|
|
|
|
set backspace=indent,eol ",start
|
|
|
|
set splitbelow
|
|
set splitright
|
|
|
|
nnoremap :W<CR> :w<CR>
|
|
|
|
set conceallevel=0
|
|
|
|
" Use 4 spaces
|
|
set tabstop=8 softtabstop=0 expandtab shiftwidth=8 smarttab
|
|
|
|
" Except for makefiles
|
|
autocmd FileType make setlocal noexpandtab
|
|
|
|
" Search up to / for tags file
|
|
set tags=./tags;/
|
|
|
|
" *** BINDINGS ***
|
|
|
|
" Beautful escapes
|
|
inoremap jj <Esc>l
|
|
inoremap jk <Esc>l
|
|
inoremap kj <Esc>l
|
|
|
|
" C comment
|
|
nnoremap // m`I//<Esc>``:s-////--<Cr>
|
|
|
|
" Current-file keywords
|
|
inoremap <C-J> <C-X><C-N>
|
|
|
|
" Line numbers
|
|
set number relativenumber
|
|
|
|
set ignorecase smartcase
|
|
set autoindent smartindent
|
|
|
|
"Yank to clipboard
|
|
nnoremap <C-C> "+yy
|
|
vnoremap <C-C> "+y
|
|
|
|
" List buffers
|
|
nnoremap <Leader>b :ls<CR>:b<Space>
|
|
|
|
nnoremap <C-I> ^
|
|
|
|
nnoremap U ~
|
|
nnoremap ~ U
|
|
|
|
" Paste last yank (not delete))
|
|
nnoremap "p "0p
|
|
|
|
" Window jumps
|
|
nnoremap <C-J> <C-W><C-J>
|
|
nnoremap <C-K> <C-W><C-K>
|
|
nnoremap <C-L> <C-W><C-L>
|
|
nnoremap <C-H> <C-W><C-H>
|
|
|
|
nnoremap ! :!
|
|
|
|
" Map directions to end/beginning of lines
|
|
nnoremap yl y$
|
|
nnoremap yh y^
|
|
nnoremap dl d$
|
|
nnoremap dh d^
|
|
|
|
" <C-P> will replace text after the cursor with unnamed reg contents
|
|
nnoremap <C-P> m`v$hp``y$
|
|
|
|
" Generate and display a printable version
|
|
nnoremap <Leader>PP :ha > ~/.vim.ps<CR>:!xdg-open ~/.vim.ps<CR>
|
|
vnoremap <Leader>PP :ha > ~/.vim.ps<CR>:!xdg-open ~/.vim.ps<CR>
|
|
|
|
" Return spelling corrections
|
|
iab ruetn return
|
|
iab reteun return
|
|
iab reutner return
|
|
|
|
nnoremap cw ciw
|
|
nnoremap ciw cw
|
|
|
|
" Swap current word with next
|
|
nnoremap gs "xdiwdwep"xp
|
|
" Inverted
|
|
nnoremap gb dawbP
|
|
|
|
nnoremap <Leader>gd :!git diff %<CR>
|
|
nnoremap <Leader>gD :!git diff<CR>
|
|
nnoremap <Leader>gB :!git blame %<CR>
|
|
nnoremap <Leader>gc :!git commit -m ""<Left>
|
|
nnoremap <Leader>gh :!git --help<CR>
|
|
nnoremap <Leader>gl :!git log<CR>
|
|
nnoremap <Leader>gp :!git push<CR>
|
|
nnoremap <Leader>gu :!git add -u<CR>
|
|
nnoremap <Leader>ga :!git add %<CR>
|
|
|
|
nnoremap <Leader>r :source ~/.vimrc<CR>
|
|
nnoremap <Leader>v :tabedit~/.vimrc<CR>
|
|
nnoremap <Leader>n :tabedit~/.notes<CR>
|
|
|
|
autocmd BufNewFile,BufRead * if expand('%:t') !~ '\.' | setl spell | endif
|
|
|
|
" Expand %% to the current files dir
|
|
cabbr <expr> %% expand('%:p:h')
|
|
|
|
cnoreabbrev vimc tabedit ~/.vimrc
|
|
|
|
" Skeletons "
|
|
if has ("autocmd")
|
|
augroup templates
|
|
autocmd BufNewFile *.cpp 0r ~/.vim/templates/skeleton.cpp
|
|
autocmd BufNewFile *.c 0r ~/.vim/templates/skeleton.c
|
|
autocmd BufNewFile *.sh 0r ~/.vim/templates/skeleton.sh
|
|
autocmd BufNewFile *.lisp 0r ~/.vim/templates/skeleton.lisp
|
|
autocmd BufNewFile *.py 0r ~/.vim/templates/skeleton.py
|
|
autocmd BufNewFile *.rb 0r ~/.vim/templates/skeleton.rb
|
|
autocmd BufNewFile makefile 0r ~/.vim/templates/makefile
|
|
augroup END
|
|
endif
|