dotfiles/vim/vimrc

99 lines
3.7 KiB
VimL
Raw Normal View History

2017-02-22 01:16:16 +00:00
" ==============================================================================
" vimrc file for niblock :: Use `:so %` to re-source after changes
" ==============================================================================
" ==============================================================================
" General Settings
" ==============================================================================
set nocompatible " Be IMproved (https://goo.gl/2RiJoo)
syntax on " Syntax hilighting
filetype plugin indent on " Recognize filetype, indent, plugin files
set encoding=utf-8 " Character encoding
set autoread " Auto-reload files changed outside Vim
set autochdir " Auto-change to local file directory
set undofile " Enable persistent undo
set showcmd " Shows you which commands you're typing
set number " Enable line numbers
set scrolloff=5 " 5 lines of scroll buffer space
set autoindent " Enable auto-indentation
set expandtab " Use spaces instead of tab characters
set tabstop=4 " How many spaces a tab is
set shiftwidth=4 " How many spaces to shift
set softtabstop=4 " How many spaces to use when editing
set textwidth=80 " How long a line is
set winwidth=80 " Minimum width of a window
set wrap " Wrap text
set foldmethod=syntax " Enable folding on a syntax level
set wildmenu " Enable wildmenu
set wildmode:longest:full,full " Configure wildmenu
set ignorecase smartcase " Search: ignore case, unless case matters
set incsearch " Zoom to search results as I type
set hlsearch " Hilight search results
augroup ruby_settings " Settings for Ruby and Ruby-like langs
2016-10-09 00:02:14 +00:00
autocmd!
2016-11-05 23:18:12 +00:00
autocmd FileType ruby,eruby,yaml set sw=2 sts=2
2016-10-09 00:02:14 +00:00
augroup END
2015-04-11 20:14:53 +00:00
2017-02-22 01:16:16 +00:00
augroup spellcheckr " Spelling, for some files...
autocmd!
autocmd BufNewFile,BufRead *.md,*.rdoc,*.txt,*.wiki setlocal spell
2017-01-28 01:52:36 +00:00
augroup END
2015-04-11 20:14:53 +00:00
2017-02-22 01:16:16 +00:00
" Some netrw configuration
" let g:netrw_liststyle=3
" let g:netrw_browse_split=4
" let g:netrw_winsize=25
" ==============================================================================
" Mappings
" ==============================================================================
" Map Leader key
let mapleader = ","
2016-08-20 23:51:09 +00:00
" Make moving up/down work on wrapped lines of text
nnoremap <silent> j gj
nnoremap <silent> k gk
nnoremap <silent> ^ g^
nnoremap <silent> $ g$
2015-04-11 20:14:53 +00:00
2016-08-20 23:51:09 +00:00
" Move between splits with CTRL+h/j/k/l
nnoremap <silent> <C-l> <C-w>l
nnoremap <silent> <C-k> <C-w>k
nnoremap <silent> <C-j> <C-w>j
nnoremap <silent> <C-h> <C-w>h
2017-02-22 01:16:16 +00:00
" Toggle fold with space, if we're in a fold, otherwise just space
nnoremap <silent> <Space> @=(foldlevel('.')?'za':"\<Space>")<CR>
vnoremap <Space> zf
2015-05-24 19:40:04 +00:00
" Allow saving of files as sudo when I forgot to start vim using sudo.
cmap w!! w !sudo tee > /dev/null %
" Remap ESC in insert mode
inoremap jk <esc>
2015-11-04 01:38:01 +00:00
2015-11-06 22:55:09 +00:00
" Remove Trailing Whitespaace
nnoremap <silent> <leader>rtw :%s/\s\+$//e<CR>
2016-11-05 23:18:12 +00:00
2016-11-21 17:26:01 +00:00
" Easy mapping for Startify
nnoremap <silent> <leader>s :Startify<CR>
" Open help topics in a full new tab
2017-01-28 01:52:36 +00:00
command! -nargs=1 -complete=help H :tabnew | :set buftype=help | :h <args>
2016-11-21 17:26:01 +00:00
" Show buffer list and prompt to choose one
nnoremap <leader>b :ls<CR>:b<space>
2017-02-22 01:16:16 +00:00
" ==============================================================================
" Plugins
" ==============================================================================
2016-11-05 23:18:12 +00:00
2017-02-22 01:16:16 +00:00
if filereadable(expand("~/.vimrc-plugins"))
source ~/.vimrc-plugins
endif