Cleanup vim configs a bit

This commit is contained in:
Bill Niblock 2017-02-21 20:16:16 -05:00
parent b5260308fb
commit 66156b7a58
2 changed files with 81 additions and 133 deletions

134
vim/vimrc
View file

@ -1,89 +1,56 @@
"#========================#"
"# vimrc file for niblock #"
"#========================#"
" ==============================================================================
" vimrc file for niblock :: Use `:so %` to re-source after changes
" ==============================================================================
" Type :so % to refresh .vimrc after making 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
"######
"# General Settings
"##
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
" Be IMproved ( Why? https://goo.gl/2RiJoo )
set nocompatible
set foldmethod=syntax " Enable folding on a syntax level
" Necessary for Syntax hilighting and cool stuff
syntax on
filetype plugin indent on
set encoding=utf-8
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
" Auto-reload files changed outside Vim
set autoread
" Enable persistent undo
set undofile
" Shows you which commands you're typing
set showcmd
" Enable line numbers
set number
" Indendation modifications
" Auto indent; set spacing; use spaces
set autoindent
set expandtab
set smarttab
set tabstop=4
set shiftwidth=4
set softtabstop=4
" File-Type Specifics
augroup customfiletypes
" Clear old autocmds in group
augroup ruby_settings " Settings for Ruby and Ruby-like langs
autocmd!
" Set auto-indent to two spaces, always expand tabs
autocmd FileType ruby,eruby,yaml set sw=2 sts=2
augroup END
" Spacing
" Set width; word wrap; scroll mods
set scrolloff=5
set textwidth=80
set winwidth=80
set wrap
" Folding
" Enable folding; map fold-toggle to space when applicable
set foldmethod=syntax
nnoremap <silent> <Space> @=(foldlevel('.')?'za':"\<Space>")<CR>
vnoremap <Space> zf
" Enable auto-completion for vim commands
" :help wildmode and :help wildmenu for details
set wildmenu
set wildmode:longest:full,full
" Search modifications
" Incremental search; search hilighting
set ignorecase smartcase
set incsearch
set hlsearch
" Set default/backup colorscheme
" colorscheme desert
" Spelling, but only on by default for certain files
augroup spellcheckr
autocmd BufNewFile,BufRead *.md setlocal spell
autocmd BufNewFile,BufRead *.rdoc setlocal spell
autocmd BufNewFile,BufRead *.txt setlocal spell
autocmd BufNewFile,BufRead *.wiki setlocal spell
augroup spellcheckr " Spelling, for some files...
autocmd!
autocmd BufNewFile,BufRead *.md,*.rdoc,*.txt,*.wiki setlocal spell
augroup END
"######
"# Mappings
"##
"
" 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 = ","
@ -100,6 +67,10 @@ nnoremap <silent> <C-k> <C-w>k
nnoremap <silent> <C-j> <C-w>j
nnoremap <silent> <C-h> <C-w>h
" Toggle fold with space, if we're in a fold, otherwise just space
nnoremap <silent> <Space> @=(foldlevel('.')?'za':"\<Space>")<CR>
vnoremap <Space> zf
" Allow saving of files as sudo when I forgot to start vim using sudo.
cmap w!! w !sudo tee > /dev/null %
@ -118,11 +89,10 @@ command! -nargs=1 -complete=help H :tabnew | :set buftype=help | :h <args>
" Show buffer list and prompt to choose one
nnoremap <leader>b :ls<CR>:b<space>
"######
"# Plugins
"###
" ==============================================================================
" Plugins
" ==============================================================================
" New Way: Vim-Plug, add-ons configured in .vimrc-plugins
if filereadable(expand("~/.vimrc-plugins"))
source ~/.vimrc-plugins
endif
if filereadable(expand("~/.vimrc-plugins"))
source ~/.vimrc-plugins
endif

View file

@ -1,63 +1,41 @@
" ######
" # Plugin File for Vim Using
" # Vim-Plug: A minimalist Vim plugin manager
" ###
" ###
" Quick-Reference
" ===
" :PlugInstall - install plugins
" :PlugUpdate - install/update plugins
" :PlugUpgrade - upgrade vim-plug
" ###
" ######
" # Fetch & Install Self
" ###
" ==============================================================================
" vimrc-plugins: Plug-in configuration. Using vim-plug.
" ==============================================================================
" Fetch & Install Self
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall | source $MYVIMRC
endif
" ######
" # Fetch & Install Plugins
" ###
call plug#begin('~/.vim/bundle')
" Current list of plugins
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-vinegar'
Plug 'tpope/vim-tbone'
Plug 'tpope/vim-surround'
Plug 'vimwiki/vimwiki'
Plug 'tpope/vim-unimpaired'
Plug 'tpope/vim-commentary'
Plug 'ajh17/VimCompletesMe'
" Plug 'ap/vim-templates'
" Ruby Related
Plug 'tpope/vim-endwise'
Plug 'vim-ruby/vim-ruby'
" Appearance Related
Plug 'mhinz/vim-startify'
Plug 'bling/vim-airline'
Plug 'dikiaap/minimalist'
Plug 'junegunn/goyo.vim'
" Syntax Related
Plug 'scrooloose/syntastic'
Plug 'tmux-plugins/vim-tmux'
Plug 'rondale-sc/vim-spacejam'
" Current list of plugins
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-vinegar'
Plug 'tpope/vim-tbone'
Plug 'tpope/vim-surround'
Plug 'vimwiki/vimwiki'
Plug 'tpope/vim-unimpaired'
Plug 'tpope/vim-commentary'
Plug 'ajh17/VimCompletesMe'
" Ruby Related
Plug 'tpope/vim-endwise'
Plug 'vim-ruby/vim-ruby'
" Appearance Related
Plug 'mhinz/vim-startify'
Plug 'bling/vim-airline'
Plug 'dikiaap/minimalist'
Plug 'junegunn/goyo.vim'
" Syntax Related
Plug 'scrooloose/syntastic'
Plug 'tmux-plugins/vim-tmux'
Plug 'rondale-sc/vim-spacejam'
call plug#end()
" ######
" # Configs
" ###
" ==============================================================================
" Plugin Configuration
" ==============================================================================
" Colorscheme - minimalist configuration
set t_Co=256
@ -86,7 +64,7 @@ let g:syntastic_check_on_wq = 1
let g:syntastic_sh_checkers = [ 'shellcheck', 'sh' ]
" Vimwiki Configs
let g:vimwiki_list = [{'auto_tags': 1}]
let g:vimwiki_list = [{'path': '~/vimwiki/', 'auto_tags': 1}]
"" Insert my journal template, and the current date
nnoremap <silent><leader>tj :call NewJournal()<CR>
function! NewJournal()