2019-02-19 19:35:03 +00:00
|
|
|
set autochdir
|
2015-06-03 21:39:41 +00:00
|
|
|
set nocompatible
|
2019-02-19 19:35:03 +00:00
|
|
|
" Allow backspacing over everything in insert mode.
|
|
|
|
set backspace=indent,eol,start
|
|
|
|
set number
|
|
|
|
set relativenumber
|
|
|
|
|
|
|
|
set history=200 " keep 200 lines of command line history
|
|
|
|
set ruler " show the cursor position all the time
|
|
|
|
set showcmd " display incomplete commands
|
|
|
|
set wildmenu " display completion matches in a status line
|
|
|
|
|
|
|
|
set ttimeout " time out for key codes
|
|
|
|
set ttimeoutlen=100 " wait up to 100ms after Esc for special key
|
|
|
|
|
|
|
|
"[Turn backup off and value of history]"
|
|
|
|
set nobackup
|
|
|
|
set noswapfile
|
|
|
|
set history=1000
|
|
|
|
set nowritebackup
|
|
|
|
set undolevels=5000
|
|
|
|
|
|
|
|
|
2015-06-03 21:39:41 +00:00
|
|
|
"[Define the leader key]"
|
|
|
|
let mapleader=","
|
2015-09-30 22:26:57 +00:00
|
|
|
let maplocalleader=","
|
2015-06-03 21:39:41 +00:00
|
|
|
"[Reselect visual block after indent/outdent]"
|
|
|
|
vnoremap < <gv
|
|
|
|
vnoremap > >gv
|
|
|
|
"[Improve up/down movement on wrapped lines]"
|
2018-08-01 20:52:59 +00:00
|
|
|
"[If preceded by a count, jump actual lines. Also if > 5, save to jumplist]"
|
|
|
|
nnoremap <expr> j v:count ? (v:count > 5 ? "m'" . v:count : '') . 'j' : 'gj'
|
|
|
|
nnoremap <expr> k v:count ? (v:count > 5 ? "m'" . v:count : '') . 'k' : 'gk'
|
2015-06-03 21:39:41 +00:00
|
|
|
"[Easy split navigation]"
|
|
|
|
nnoremap <C-j> <C-W>j
|
|
|
|
nnoremap <C-k> <C-W>k
|
|
|
|
nnoremap <C-h> <C-W>h
|
|
|
|
nnoremap <C-l> <C-W>l
|
2015-08-08 20:44:49 +00:00
|
|
|
nnoremap <C-Up> <C-W>k
|
|
|
|
nnoremap <C-Down> <C-W>j
|
|
|
|
nnoremap <C-Left> <C-W>h
|
|
|
|
nnoremap <C-Right> <C-W>l
|
2015-06-03 21:39:41 +00:00
|
|
|
"[Locate the desired objects in the center of the screen]"
|
|
|
|
nnoremap <silent> n nzz
|
|
|
|
nnoremap <silent> N Nzz
|
|
|
|
nnoremap <silent> * *zz
|
|
|
|
nnoremap <silent> # #zz
|
|
|
|
"[New line under/bellow current line without jump to insert-mode]"
|
|
|
|
nnoremap <leader>o o<Esc>
|
|
|
|
nnoremap <leader>O O<Esc>
|
2019-02-19 19:35:03 +00:00
|
|
|
"[Clear search highlights]"
|
|
|
|
nnoremap // :nohlsearch<CR>
|
|
|
|
" Don't use Ex mode, use Q for formatting.
|
|
|
|
map Q gq
|
|
|
|
"[Reflow current paragraph]"
|
|
|
|
"[http://stevelosh.com/blog/2010/09/coming-home-to-vim/]"
|
|
|
|
nnoremap <leader>q gqip
|
|
|
|
|
|
|
|
|
|
|
|
" Show @@@ in the last line if it is truncated.
|
|
|
|
set display=truncate
|
|
|
|
|
|
|
|
" Show a few lines of context around the cursor. Note that this makes the
|
|
|
|
" text scroll if you mouse-click near the start or end of the window.
|
|
|
|
set scrolloff=5
|
|
|
|
|
|
|
|
let base16colorspace=256
|
|
|
|
colorscheme base16-default-dark
|
|
|
|
|
|
|
|
" Do incremental searching when it's possible to timeout.
|
|
|
|
if has('reltime')
|
|
|
|
set incsearch
|
2015-06-03 21:39:41 +00:00
|
|
|
endif
|
2019-02-19 19:35:03 +00:00
|
|
|
|
|
|
|
" LaTeX ftdetect
|
|
|
|
let g:tex_flavor = "latex"
|
|
|
|
|
|
|
|
" Switch syntax highlighting on when the terminal has colors or when using the
|
|
|
|
" GUI (which always has colors).
|
|
|
|
if &t_Co > 2 || has("gui_running")
|
|
|
|
" Revert with ":syntax off".
|
|
|
|
syntax on
|
|
|
|
|
|
|
|
" I like highlighting strings inside C comments.
|
|
|
|
" Revert with ":unlet c_comment_strings".
|
|
|
|
let c_comment_strings=1
|
2015-06-03 21:39:41 +00:00
|
|
|
endif
|
2019-02-19 19:35:03 +00:00
|
|
|
|
|
|
|
" Only do this part when compiled with support for autocommands.
|
2017-10-19 05:09:25 +00:00
|
|
|
if has("autocmd")
|
2017-10-26 15:57:35 +00:00
|
|
|
|
2019-02-19 19:35:03 +00:00
|
|
|
" Enable file type detection.
|
|
|
|
" Use the default filetype settings, so that mail gets 'tw' set to 72,
|
|
|
|
" 'cindent' is on in C files, etc.
|
|
|
|
" Also load indent files, to automatically do language-dependent indenting.
|
|
|
|
" Revert with ":filetype off".
|
|
|
|
filetype plugin indent on
|
2017-10-26 15:57:35 +00:00
|
|
|
|
2019-02-19 19:35:03 +00:00
|
|
|
" Put these in an autocmd group, so that you can revert them with:
|
|
|
|
" ":augroup vimStartup | au! | augroup END"
|
|
|
|
augroup vimStartup
|
|
|
|
au!
|
2017-10-26 15:57:35 +00:00
|
|
|
|
2019-02-19 19:35:03 +00:00
|
|
|
" 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).
|
|
|
|
autocmd BufReadPost *
|
|
|
|
\ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
|
|
|
|
\ | exe "normal! g`\""
|
|
|
|
\ | endif
|
2018-02-26 08:13:20 +00:00
|
|
|
|
2019-02-19 19:35:03 +00:00
|
|
|
augroup END
|
2017-10-26 15:57:35 +00:00
|
|
|
|
2019-02-19 19:35:03 +00:00
|
|
|
endif " has("autocmd")
|