Initial commit

This commit is contained in:
Chuck Hawley (chawley/shawshank)
2017-10-10 16:53:19 -04:00
parent 54b83247e7
commit 029cee5f7c
19 changed files with 2950 additions and 1 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
spell/*
plugged/*

2503
.vim/autoload/plug.vim Normal file

File diff suppressed because it is too large Load Diff

Submodule .vim/plugged/syntastic added at 08adf11e81

1
.vim/plugged/tabular Submodule

Submodule .vim/plugged/tabular added at 00e1e7fcdb

Submodule .vim/plugged/vim-colorschemes added at eab315701f

Submodule .vim/plugged/vim-commentary added at 89f43af186

Submodule .vim/plugged/vim-mucomplete added at 8e1ddf51f4

Submodule .vim/plugged/vim-pandoc-syntax added at 56e8e41ef8

Submodule .vim/plugged/vim-polyglot added at 27903c5b86

Submodule .vim/plugged/vim-sensible added at 49ee364222

51
.vim/spell/en.utf-8.add Normal file
View File

@@ -0,0 +1,51 @@
Hadoop
MapReduce
HDFS
HQL
ODBC
PHP
etc
java
Offline
SQL
i.e.
sqoop
offline
Cuyahoga
Ubuntu
Debian
CentOS
online
Dialogue
Pantek
szechuan
IRC
Facebook
Royalton
Hadoop
MapReduce
HDFS
HQL
ODBC
PHP
etc
java
Offline
SQL
i.e.
sqoop
offline
Cuyahoga
Ubuntu
Debian
CentOS
online
Dialogue
Pantek
szechuan
IRC
Facebook
Royalton
blogspot
http
dotfiles

BIN
.vim/spell/en.utf-8.add.spl Normal file

Binary file not shown.

8
.vim/templates/markdown Normal file
View File

@@ -0,0 +1,8 @@
:insert
---
layout: post
title:
date:
categories:
---

16
.vim/templates/md Normal file
View File

@@ -0,0 +1,16 @@
:insert
# Title
Created:
Updated:
## Summary
---
## Reference(s):

22
.vim/templates/py Normal file
View File

@@ -0,0 +1,22 @@
:insert
#!/usr/bin/env python
#===============================================================================
#
# FILE:
#
# USAGE:
#
# DESCRIPTION:
#
# OPTIONS:
# REQUIREMENTS:
# NOTES:
# AUTHOR:
# ORGANIZATION:
# CREATED:
# REVISION:
#===============================================================================
set -o nounset # Treat unset variables as an error
.

26
.vim/templates/sh Normal file
View File

@@ -0,0 +1,26 @@
:insert
#!/usr/bin/env bash
#===============================================================================
#
# FILE:
# USAGE:
# DESCRIPTION:
# OPTIONS:
# REQUIREMENTS:
# NOTES:
# AUTHOR: C Hawley
# CREATED:
# REVISION:
#
#===============================================================================
set -o nounset # Treat unset variables as an error
# Check for empty argument
if [ -z "${1:-}" ]; then
arg="undefined"
else
arg=$1
fi
.

212
.vimrc Normal file
View File

@@ -0,0 +1,212 @@
set nocompatible " be iMproved, required
set number " turn on line numbers
set relativenumber " lines are numbered relative to current line
set scrolloff=8 " number of lines to keep above and below the cursor
set noerrorbells visualbell t_vb= " no sound on errors
autocmd! bufwritepost .vimrc source ~/.vimrc " When vimrc is edited, reload it
set autoread " set to auto read when a file is changed from the outside
set cursorcolumn " highlight current column
set cursorline " highlight current row
"set encoding=utf-8
"set history=300 " how many lines of history to remember
set incsearch " make search act like search in modern browsers
"set lbr " smarter line breaks
"set magic " set magic on, for regular expressions
set showmatch " show matching brackets when text indicator is over them
" ----------------------------------------------------------------------------------------------------
" From Vim Zero: https://www.oliversherouse.com/2017/08/21/vim_zero.html
" Built-In Functionality
" General
let mapleader = ','
set hidden " Allow background buffers without saving
set spell spelllang=en_us
set splitright " Split to right by default
" Text Wrapping
set textwidth=119
set colorcolumn=120
set nowrap
" Search and Substitute
set gdefault " use global flag by default in s: commands
set hlsearch " highlight searches
set ignorecase
set smartcase " don't ignore capitals in searches
nnoremap <leader><space> :nohls <enter>
" Tabs
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
" Mappings
" <ctrl>-H to move to previous buffer
nnoremap <C-H> :bp <enter>
" <ctrl>-L to move to next buffer
nnoremap <C-L> :bn <enter>
" comma-w to save buffer
nnoremap <Leader>w :w <enter>
" comma-q to quit buffer
nnoremap <Leader>q :bd <enter>
" bring up the copy buffer
noremap <Leader>x "+
" Plugins
"" Installation with VimPlug
if has("win32")
call plug#begin('~/vimfiles/plugged')
else
call plug#begin('~/.vim/plugged')
endif
""" Basics
Plug 'tpope/vim-sensible'
Plug 'sheerun/vim-polyglot'
Plug 'flazz/vim-colorschemes'
""" General Functionality
Plug 'lifepillar/vim-mucomplete'
Plug 'scrooloose/syntastic'
"Plug 'sirver/ultisnips'
"Plug 'honza/vim-snippets'
Plug 'tpope/vim-commentary'
"Plug 'chiel92/vim-autoformat'
""" Particular Functionality
"Plug 'junegunn/goyo.vim'
"Plug 'junegunn/limelight.vim'
Plug 'vim-pandoc/vim-pandoc-syntax'
Plug 'godlygeek/tabular'
call plug#end()
"" Colors
"set termguicolors
colorscheme slate
"" Autocompletion
set completeopt=menuone,noinsert,noselect
set shortmess+=c " Turn off completion messages
inoremap <expr> <c-e> mucomplete#popup_exit("\<c-e>")
inoremap <expr> <c-y> mucomplete#popup_exit("\<c-y>")
inoremap <expr> <cr> mucomplete#popup_exit("\<cr>")
let g:mucomplete#enable_auto_at_startup = 1
"" Pandoc
augroup pandoc_syntax
au! BufNewFile,BufFilePre,BufRead *.md set filetype=markdown.pandoc
au! BufNewFile,BufFilePre,BufRead *.markdown set filetype=markdown.pandoc
augroup END
let g:pandoc#syntax#conceal#use = 0
let g:pandoc#syntax#codeblocks#embeds#langs = ['python', 'vim', 'make', 'bash=sh', 'html', 'css', 'scss', 'javascript']
" ----------------------------------------------------------------------------------------------------
" ----------------------------------------------------------------------------------------------------
" => Statusline
" Ideas from http://got-ravings.blogspot.com/2008/08/vim-pr0n-making-statuslines-that-own.html
set laststatus=2 " always show statusline
set statusline= " clear on reload
set statusline+=[%n] " buffer number
set statusline+=\ %f " filename
set statusline+=\ [%{strlen(&fenc)?&fenc:'none'}, " file encoding
set statusline+=\ %{&ff}] " file format
set statusline+=\ %y " filetype
set statusline+=\ %H\ %m\ %r\ %W " flags
set statusline+=%= " left/right separator
set statusline+=l:%l/%L " cursor line/total lines
set statusline+=\ c:%c, " cursor column
set statusline+=\ %P " percent through file
" ----------------------------------------------------------------------------------------------------
" -----------------------------------------------------------------------------------------------------
" => Keymaps: Doing more things at once
" -----------------------------------------------------------------------------------------------------
" -----------------------------------------------------------------------------------------------------
" ===> Text bubbling (http://vimcasts.org/episodes/bubbling-text/)
" Bubble single lines
nmap <C-k> ddkP
nmap <C-j> ddp
" Bubble multiple lines
vmap <C-k> xkP`[V`]
vmap <C-j> xp`[V`]
" -----------------------------------------------------------------------------------------------------
" -----------------------------------------------------------------------------------------------------
" ===> More sane movement keys
nnoremap j gj
nnoremap k gk
" -----------------------------------------------------------------------------------------------------
" -----------------------------------------------------------------------------------------------------
" ===> Spellcheck
" Horrible colors! I hate spellchecker's red highlight, so I changed it
" (http://stackoverflow.com/questions/6008921/how-do-i-change-the-highlight-style-in-vim-spellcheck)
" Vim Colors: (http://alvinalexander.com/linux/vi-vim-editor-color-scheme-syntax)
" -----------------------------------------------------------------------------------------------------
hi clear SpellBad
hi clear SpellCap
hi clear SpellErrors
hi clear SpellLocal
hi clear SpellRare
hi SpellBad cterm=underline,bold ctermfg=Red
hi SpellCap cterm=underline,bold ctermfg=Red
hi SpellErrors cterm=underline,bold ctermfg=Red
" -----------------------------------------------------------------------------------------------------
" ===> Spell check only certain file types https://robots.thoughtbot.com/vim-spell-checking
" turn off for files with no extension
autocmd BufRead,BufNewFile * setlocal nospell
" turn off for files with any extension
autocmd BufRead,BufNewFile *.* setlocal nospell
" turn on for markdown files
autocmd BufRead,BufNewFile *.md setlocal spell
autocmd BufRead,BufNewFile *.mkd setlocal spell
autocmd BufRead,BufNewFile *.markdown setlocal spell
" turn on for text files
autocmd BufRead,BufNewFile *.txt setlocal spell
" -----------------------------------------------------------------------------------------------------
" -----------------------------------------------------------------------------------------------------
" => Templates
" Doing special things with certain filetypes
" -----------------------------------------------------------------------------------------------------
" shell scripts (.sh) ------------------------------------------------
autocmd BufNewFile *.sh so $HOME/.vim/templates/sh
autocmd BufNewFile *.sh %s/FILE:.*/\='FILE: '.expand('%')/e
autocmd BufNewFile *.sh exe "g/AUTHOR:.*/s//AUTHOR: C Hawley"
autocmd BufNewFile *.sh exe "g/CREATED:.*/s//CREATED: " .strftime("%c")
autocmd BufWritePre,filewritepre *.sh execute "normal ma"
autocmd BufWritePre,filewritepre *.sh exe "g/REVISION:.*/s//REVISION: " .strftime("%c")
autocmd bufWritePost,filewritepost *.sh execute "normal `a"
" python scripts (.py) ------------------------------------------------
autocmd BufNewFile *.py so $HOME/.vim/templates/py
autocmd BufNewFile *.py %s/FILE:.*/\='FILE: '.expand('%')/e
autocmd BufNewFile *.py exe "g/AUTHOR:.*/s//AUTHOR: C Hawley"
autocmd BufNewFile *.py exe "g/CREATED:.*/s//CREATED: " .strftime("%c")
autocmd BufWritePre,filewritepre *.py execute "normal ma"
autocmd BufWritePre,filewritepre *.py exe "g/REVISION:.*/s//REVISION: " .strftime("%c")
autocmd bufWritePost,filewritepost *.py execute "normal `a"
" markdown documents (.md,*.mkd) -------------------------------------
autocmd BufNewFile *.md,*.mkd so $HOME/.vim/templates/md
autocmd BufNewFile *.md,*.mkd exe "g/Created:.*/s//Created: " .strftime("%c")
autocmd BufWritePre,filewritepre *.md,*.mkd execute "normal ma"
autocmd BufWritePre,filewritepre *.md,*.mkd exe "g/Updated:.*/s//Updated: " .strftime("%c")
autocmd bufWritePost,filewritepost *.md,*.mkd execute "normal `a"
" markdown documents (.markdown - jekyll blog) -----------------------
autocmd BufNewFile *.markdown so $HOME/.vim/templates/markdown
autocmd BufNewFile *.markdown exe "g/date:.*/s//date: " .strftime("%c")
autocmd BufWritePre,filewritepre *.markdown execute "normal ma"
autocmd BufWritePre,filewritepre *.markdown exe "g/Updated:.*/s//Updated: " .strftime("%c")
autocmd bufWritePost,filewritepost *.markdown execute "normal `a"

View File

@@ -1,2 +1,12 @@
# dotfiles-vim
My vim settings and plugins
Breaking this out of my dotfiles repo to try to get a handle on multiple configurations from multiple machines.
I also want to finally have a `.vimrc` in which I understand each and every line. After years of collecting snips and
scraps from other people's dotfiles, I want to make sure that I am aware of what my `.vimrc` is doing.
This configuration is based heavily on the guide I found here: [Vim Zero](https://www.oliversherouse.com/2017/08/21/vim_zero.html)
which does exactly what I am aiming to do here: wipe the slate clean and start over.
Whenever possible, I've noted the URL from which I found the setting or snippet. I try to insist that not everything
is self-explanatory.

91
setup.sh Executable file
View File

@@ -0,0 +1,91 @@
#!/usr/bin/env bash
#===============================================================================
#
# FILE: setup.sh
# USAGE: ./setup.sh
# DESCRIPTION: after pulling/cloning dotfiles repo, this script will check/create
# symlinks for for dotfiles. It checks for the presence of installed
# software (i.e. won't symlink a dotfile for applications that aren't
# installed) and will remove links for applications that are no longer
# installed. Safe to run after every git pull
# OPTIONS:
# REQUIREMENTS: This script replies on the 'command' command. Basically, it will run
# `command -v <dotfile>` and if there is no output, it assumes the app
# isn't installed. So this won't work for apps that aren't in your $PATH
# reference: http://www.cyberciti.biz/faq/unix-linux-shell-find-out-posixcommand-exists-or-not/
# NOTES:
# AUTHOR: C Hawley
# CREATED: 2015-10
# REVISION: Tue 10 Oct 2017 04:37:37 PM EDT
#
#===============================================================================
set -o nounset # Treat unset variables as an error
# specify where your dotfiles live
dotfiledir="$HOME/dotfiles-vim"
# function to handle checking for existings links/files and updating
link() {
echo "symlinking ${1}"
# check for existing symlinks
if [ -h "${HOME}"/"${1}" ]; then
echo " - There's already a symlink named ${1}. Diff'ing."
# If there's an existing sylink, check if it's different than the dotfile
if [[ $(diff --brief "${HOME}"/"${1}" "${dotfiledir}"/"${1}") ]]; then
# If the links are different, ask if it should be replaced
echo " - Old link and new link are different:"
echo -n " - Replace existing symlink "${1}"? [Y/N] "
read replace
if [ "${replace}" = "Y" ] || [ "${replace}" = "y" ]; then
# If yes, unlink the old file and link the new one and exit
echo " - Unlinking old file and linking new file"
unlink "${HOME}"/"${1}"
ln -s "${dotfiledir}"/"${1}" "${HOME}"/"${1}"
fi
else
# If the link is the same, just exit function
echo " - Old link and new link are the same."
fi
# check for existing file/directory
elif [ -f "${HOME}"/"${1}" ] || [ -d "${HOME}"/"${1}" ]; then
echo " - There's already a file or directory named ${1}. Diff'ing."
if [[ $(diff --brief "${HOME}"/"${1}" "${dotfiledir}"/"${1}") ]]; then
echo " - Old file/dir and new link are different:"
echo -n " - Rename "${1}" and create new link? [Y/N] "
read replace
if [ "${replace}" = "Y" ] || [ "${replace}" = "y" ]; then
echo " - Renaming old file/dir and linking new file"
mv "${HOME}"/"${1}" "${HOME}"/"${1}"_original
ln -s "${dotfiledir}"/"${1}" "${HOME}"/"${1}"
fi
fi
else
# If there is no existing file, create one and exit
echo " - Creating link for ${1}"
ln -s "${dotfiledir}"/"${1}" "${HOME}"/"${1}"
fi
}
clear
echo "------------------------------------------"
echo " .vim/.vimrc repo setup script "
echo "------------------------------------------"
echo " Setting up symlinks "
echo "------------------------------------------"
echo ""
# link .vimrc
#-------------------------------------------------------------------------------
if [ $(command -v vim) ]; then
link .vim
link .vimrc
else
echo "... vim not installed"
fi
echo ""
echo "------------------------------------------"
echo "Done. "
echo "------------------------------------------"