diff --git a/.gitmodules b/.gitmodules index ee17b37..e69de29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,42 +0,0 @@ -[submodule "vim/bundle/pathogen"] - path = vim/bundle/pathogen - url = https://github.com/tpope/vim-pathogen -[submodule "vim/bundle/fugitive"] - path = vim/bundle/fugitive - url = https://github.com/tpope/vim-fugitive -[submodule "vim/bundle/commentary"] - path = vim/bundle/commentary - url = https://github.com/tpope/vim-commentary -[submodule "vim/bundle/eunuch"] - path = vim/bundle/eunuch - url = https://github.com/tpope/vim-eunuch -[submodule "vim/bundle/vinegar"] - path = vim/bundle/vinegar - url = https://github.com/tpope/vim-vinegar -[submodule "vim/bundle/sleuth"] - path = vim/bundle/sleuth - url = https://github.com/tpope/vim-sleuth -[submodule "vim/bundle/endwise"] - path = vim/bundle/endwise - url = https://github.com/tpope/vim-endwise -[submodule "vim/bundle/tagbar"] - path = vim/bundle/tagbar - url = https://github.com/majutsushi/tagbar -[submodule "vim/bundle/pencil"] - path = vim/bundle/pencil - url = https://github.com/reedes/vim-pencil -[submodule "vim/bundle/snipmate"] - path = vim/bundle/snipmate - url = https://github.com/garbas/vim-snipmate -[submodule "vim/bundle/snipmate-tlib"] - path = vim/bundle/snipmate-tlib - url = https://github.com/tomtom/tlib_vim -[submodule "vim/bundle/snipmate-addon-mw-utils"] - path = vim/bundle/snipmate-addon-mw-utils - url = https://github.com/MarcWeber/vim-addon-mw-utils -[submodule "vim/bundle/filetype-nix"] - path = vim/bundle/filetype-nix - url = https://github.com/LnL7/vim-nix -[submodule "vim/bundle/supertab"] - path = vim/bundle/supertab - url = https://github.com/ervandew/supertab diff --git a/aliases b/bash/.aliases similarity index 100% rename from aliases rename to bash/.aliases diff --git a/bash_profile b/bash/.bash_profile similarity index 89% rename from bash_profile rename to bash/.bash_profile index 22f9020..fd7e6f8 100644 --- a/bash_profile +++ b/bash/.bash_profile @@ -10,10 +10,16 @@ export PS3='select: ' #{- ENVIRONMENT VARIABLES -}# # History preferences -export HISTSIZE=-1 -export HISTFILESIZE=-1 -export HISTFILE="$HOME/.history/bash" +if [ -w "$HOME/.history/bash" ]; then + if [ ! -d "$HOME/.history" ]; then + mkdir "$HOME/.history" + fi + touch "$HOME/.history/bash" +fi export HISTCONTROL="erasedups:ignoreboth" +export HISTFILE="$HOME/.history/bash" +export HISTFILESIZE=-1 +export HISTSIZE=-1 #{- SHELL OPTIONS -}# diff --git a/bashrc b/bash/.bashrc similarity index 100% rename from bashrc rename to bash/.bashrc diff --git a/functions b/bash/.functions similarity index 100% rename from functions rename to bash/.functions diff --git a/ghci/.ghci b/ghci/.ghci new file mode 100644 index 0000000..4972383 --- /dev/null +++ b/ghci/.ghci @@ -0,0 +1,6 @@ +-- Enable overloaded string literals +:set -XOverloadedStrings +-- Enable multiline formatting +:set +m +:set prompt "\ESC[1;35mλ\ESC[1;34m>\ESC[0m " +:set prompt2 "\ESC[1;34m|\ESC[1;35m>\ESC[0m " diff --git a/ghci/.haskeline b/ghci/.haskeline new file mode 100644 index 0000000..fa85bca --- /dev/null +++ b/ghci/.haskeline @@ -0,0 +1,8 @@ +bellStyle: NoBell +maxHistorySize: Just 100 +editMode: Vi +completionType: MenuCompletion +completionPaging: False +completionPromptLimit: Just 100 +listCompletionsImmediately: True +historyDuplicates: IgnoreAll diff --git a/kwm/.khdrc b/kwm/.khdrc new file mode 100644 index 0000000..eca9912 --- /dev/null +++ b/kwm/.khdrc @@ -0,0 +1,69 @@ +# Enable kwm compatibility khd kwm on +khd kwm on + +cmd + shift - q : kwmc quit +cmd + shift - r : kwmc config reload && khd -e "reload" + +cmd - return : "$HOME"/.kwm/iterm +cmd - escape : "$HOME"/.kwm/screensaver + +cmd + alt + ctrl - space : kwmc config focus-follows-mouse toggle + +cmd - h : kwmc window -f west +cmd - j : kwmc window -f south +cmd - k : kwmc window -f north +cmd - l : kwmc window -f east + +cmd + shift - h : kwmc window -s west +cmd + shift - j : kwmc window -s south +cmd + shift - k : kwmc window -s north +cmd + shift - l : kwmc window -s east + +cmd + ctrl - h : kwmc window -c expand 0.05 west +cmd + ctrl - j : kwmc window -c expand 0.05 south +cmd + ctrl - k : kwmc window -c expand 0.05 north +cmd + ctrl - l : kwmc window -c expand 0.05 east + +cmd + shift + ctrl - h : kwmc window -c reduce 0.05 west +cmd + shift + ctrl - j : kwmc window -c reduce 0.05 south +cmd + shift + ctrl - k : kwmc window -c reduce 0.05 north +cmd + shift + ctrl - l : kwmc window -c reduce 0.05 east + +cmd - tab : kwmc window -f next +cmd + shift - tab : kwmc window -f prev + +cmd - f : kwmc window -z fullscreen +cmd - r : kwmc tree rotate 90 + +cmd + ctrl - b : kwmc window -c type bsp +cmd + ctrl - m : kwmc window -c type monocle +cmd + ctrl - f : kwmc window -c type float + +cmd + shift - b : kwmc space -t bsp +cmd + shift - m : kwmc space -t monocle +cmd + shift - f : kwmc space -t float + +cmd - 1 : kwmc space -fExperimental 1 +cmd - 2 : kwmc space -fExperimental 2 +cmd - 3 : kwmc space -fExperimental 3 +cmd - 4 : kwmc space -fExperimental 4 +cmd - 5 : kwmc space -fExperimental 5 +cmd - 6 : kwmc space -fExperimental 6 +cmd - 7 : kwmc space -fExperimental 7 +cmd - 8 : kwmc space -fExperimental 8 +cmd - 9 : kwmc space -fExperimental 9 +cmd - 0 : kwmc space -fExperimental 10 + +cmd + shift - 1 : kwmc window -m space 1 +cmd + shift - 2 : kwmc window -m space 2 +cmd + shift - 3 : kwmc window -m space 3 +cmd + shift - 4 : kwmc window -m space 4 +cmd + shift - 5 : kwmc window -m space 5 +cmd + shift - 6 : kwmc window -m space 6 +cmd + shift - 7 : kwmc window -m space 7 +cmd + shift - 8 : kwmc window -m space 8 +cmd + shift - 9 : kwmc window -m space 9 +cmd + shift - 0 : kwmc window -m space 10 + +cmd - backspace : kwmc display -f next +cmd + shift - backspace : kwmc window -m display next diff --git a/kwm/.kwm/iterm b/kwm/.kwm/iterm new file mode 100755 index 0000000..9f21dbc --- /dev/null +++ b/kwm/.kwm/iterm @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +if [ $# -eq 0 ]; then + osascript <<< " + tell application \"iTerm2\" + create window with default profile + end tell + " +else + osascript <<< " + tell application \"iTerm2\" + create window with default profile command \"$*\" + end tell + " +fi diff --git a/kwm/.kwm/kwmrc b/kwm/.kwm/kwmrc new file mode 100644 index 0000000..b40dd7c --- /dev/null +++ b/kwm/.kwm/kwmrc @@ -0,0 +1,32 @@ +/*{-- Functional --}*/ +kwmc config tiling bsp +kwmc config spawn right + +/* Focus follows the mouse and the mouse follows focus */ +kwmc config focus-follows-mouse on +kwmc config mouse-follows-focus on + +/* Allow a window to be moved and resized by clicking with CMD held */ +kwmc config mouse-drag on +kwmc config mouse-drag mod cmd + +/* Automagically resize windows */ +kwmc config lock-to-container on + +/* Allow window focus to wrap */ +kwmc config cycle-focus on + +kwmc config float-non-resizable on +kwmc config standby-on-float on +kwmc config center-on-float on + +kwmc rule owner="iTerm2" properties={role="AXDialog"} + +/*{-- Cosmetic --}*/ +kwmc config padding 30 30 30 30 +kwmc config gap 30 30 + +kwmc config border focused on +kwmc config border focused size 3 +kwmc config border focused color 0xFFAE9DAB +kwmc config border focused radius 10 diff --git a/kwm/.kwm/screensaver b/kwm/.kwm/screensaver new file mode 100755 index 0000000..19eb10b --- /dev/null +++ b/kwm/.kwm/screensaver @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +osascript << EOF + tell application "ScreenSaverEngine" + activate + end tell +EOF diff --git a/kwm/.kwm/vim b/kwm/.kwm/vim new file mode 100755 index 0000000..2be6a76 --- /dev/null +++ b/kwm/.kwm/vim @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +osascript <<< " + tell application \"iTerm2\" + create window with default profile command \"/Users/andrew/.nix-profile/bin/vim \\\"$@\\\"\" + end tell +" diff --git a/python/.pythonrc b/python/.pythonrc new file mode 100644 index 0000000..8c57829 --- /dev/null +++ b/python/.pythonrc @@ -0,0 +1,48 @@ +#{- ~/.pythonrc -}# + +import atexit +import os +import readline +import sys + +blue = '\001\033[1;34m\002' +yellow = '\001\033[1;33m\002' + +magenta = '\001\033[1;35m\002' +red = '\001\033[1;31m\002' +reset = '\001\033[0m\002' + +# Primary prompt: (>>> ) in magenta +sys.ps1 = blue + '>' + reset + ' ' +# Secondary prompt: (... ) in red +sys.ps2 = yellow + '.' + reset + ' ' + +# Use ~/.history/python as a history file instead of ~/.python_history +def custom_readline(): + import atexit + try: + import readline + import rlcompleter + except ImportError: + return + + readline_doc = getattr(readline, '__doc__', '') + if readline_doc is not None and 'libedit' in readline_doc: + readline.parse_and_bind('bind ^I rl_complete') + else: + readline.parse_and_bind('tab: complete') + + try: + readline.read_init_file() + except OSError: + pass + + if readline.get_current_history_length() == 0: + history = os.path.join(os.path.expanduser('~'), '.history', 'python') + try: + readline.read_history_file(history) + except IOError: + pass + atexit.register(readline.write_history_file, history) + +sys.__interactivehook__ = custom_readline diff --git a/pythonrc b/pythonrc deleted file mode 100644 index 2f88b26..0000000 --- a/pythonrc +++ /dev/null @@ -1,17 +0,0 @@ -#{- ~/.pythonrc -}# - -import atexit -import os -import readline -import sys - -# Primary prompt: (>>> ) in magenta -sys.ps1 = '\033[1;35m>>>\033[0m ' -# Secondary prompt: (... ) in red -sys.ps2 = '\033[1;31m...\033[0m ' - -# Use ~/.history/python as a history file instead of ~/.python_history -history_file = os.path.join (os.environ['HOME'], '.history', 'python') -if os.path.exists(history_file): - readline.read_history_file(history_file) -atexit.register(readline.write_history_file, history_file) diff --git a/inputrc b/readline/.inputrc similarity index 100% rename from inputrc rename to readline/.inputrc diff --git a/profile b/sh/.profile similarity index 57% rename from profile rename to sh/.profile index 074005e..91ed393 100644 --- a/profile +++ b/sh/.profile @@ -2,10 +2,23 @@ #{- PROMPT -}# -# Primary prompt: ($/# ) in magenta -export PS1='\[\033[1;35m\]\$\[\033[0m\] ' -# Secondary prompt: (> ) in red -export PS2='\[\033[1;31\]m>\[\033[0m\] ' +magenta="\[\033[1;35m\]" +red="\[\033[1;31m\]" +no_color="\[\033[0m\]" + +# Primary prompt: ($/# ) +# Secondary prompt: (> ) +# Primary prompt is magenta on local machines, red on remote hosts +case $(hostname) in + pebble|stone|rock|boulder) + export PS1="${magenta}\$${no_color} " + export PS2="${red}>${no_color} " + ;; + *) + export PS1="$red\$$no_color " + export PS2="$magenta>$no_color " + ;; +esac #{- PATH -}# @@ -30,7 +43,13 @@ export LESSHISTFILE="-" export PYTHONSTARTUP="$HOME/.pythonrc" # History preferences -export HISTFILE="$HOME/.history/posh" +if [ -w "$HOME/.history/sh" ]; then + if [ ! -d "$HOME/.history" ]; then + mkdir "$HOME/.history" + fi + touch "$HOME/.history/sh" +fi +export HISTFILE="$HOME/.history/sh" export HISTSIZE=10000 #{- SOURCING -}# diff --git a/vim/.vim/bundle/commentary/CONTRIBUTING.markdown b/vim/.vim/bundle/commentary/CONTRIBUTING.markdown new file mode 100644 index 0000000..b3f0095 --- /dev/null +++ b/vim/.vim/bundle/commentary/CONTRIBUTING.markdown @@ -0,0 +1 @@ +See the [contribution guidelines for pathogen.vim](https://github.com/tpope/vim-pathogen/blob/master/CONTRIBUTING.markdown). diff --git a/vim/.vim/bundle/commentary/README.markdown b/vim/.vim/bundle/commentary/README.markdown new file mode 100644 index 0000000..5387ba6 --- /dev/null +++ b/vim/.vim/bundle/commentary/README.markdown @@ -0,0 +1,51 @@ +# commentary.vim + +Comment stuff out. Use `gcc` to comment out a line (takes a count), +`gc` to comment out the target of a motion (for example, `gcap` to +comment out a paragraph), `gc` in visual mode to comment out the selection, +and `gc` in operator pending mode to target a comment. You can also use +it as a command, either with a range like `:7,17Commentary`, or as part of a +`:global` invocation like with `:g/TODO/Commentary`. That's it. + +I wrote this because 5 years after Vim added support for mapping an +operator, I still couldn't find a commenting plugin that leveraged that +feature (I overlooked +[tcomment.vim](https://github.com/tomtom/tcomment_vim)). Striving for +minimalism, it weighs in at under 100 lines of code. + +Oh, and it uncomments, too. The above maps actually toggle, and `gcgc` +uncomments a set of adjacent commented lines. + +## Installation + +If you don't have a preferred installation method, I recommend +installing [pathogen.vim](https://github.com/tpope/vim-pathogen), and +then simply copy and paste: + + cd ~/.vim/bundle + git clone git://github.com/tpope/vim-commentary.git + +Once help tags have been generated, you can view the manual with +`:help commentary`. + +## FAQ + +> My favorite file type isn't supported! + +Relax! You just have to adjust `'commentstring'`: + + autocmd FileType apache setlocal commentstring=#\ %s + +## Self-Promotion + +Like commentary.vim? Follow the repository on +[GitHub](https://github.com/tpope/vim-commentary) and vote for it on +[vim.org](http://www.vim.org/scripts/script.php?script_id=3695). And if +you're feeling especially charitable, follow [tpope](http://tpo.pe/) on +[Twitter](http://twitter.com/tpope) and +[GitHub](https://github.com/tpope). + +## License + +Copyright (c) Tim Pope. Distributed under the same terms as Vim itself. +See `:help license`. diff --git a/vim/.vim/bundle/commentary/doc/commentary.txt b/vim/.vim/bundle/commentary/doc/commentary.txt new file mode 100644 index 0000000..b048569 --- /dev/null +++ b/vim/.vim/bundle/commentary/doc/commentary.txt @@ -0,0 +1,32 @@ +*commentary.txt* Comment stuff out + +Author: Tim Pope +License: Same terms as Vim itself (see |license|) + +Comment stuff out. Then uncomment it later. Relies on 'commentstring' to be +correctly set, or uses b:commentary_format if it is set. + + *gc* +gc{motion} Comment or uncomment lines that {motion} moves over. + + *gcc* +gcc Comment or uncomment [count] lines. + + *v_gc* +{Visual}gc Comment or uncomment the highlighted lines. + + *o_gc* +gc Text object for a comment (operator pending mode + only.) + + *gcgc* *gcu* +gcgc Uncomment the current and adjacent commented lines. +gcu + + *:Commentary* +:[range]Commentary Comment or uncomment [range] lines + +The |User| CommentaryPost autocommand fires after a successful operation and +can be used for advanced customization. + + vim:tw=78:et:ft=help:norl: diff --git a/vim/.vim/bundle/commentary/plugin/commentary.vim b/vim/.vim/bundle/commentary/plugin/commentary.vim new file mode 100644 index 0000000..0bef7cc --- /dev/null +++ b/vim/.vim/bundle/commentary/plugin/commentary.vim @@ -0,0 +1,103 @@ +" commentary.vim - Comment stuff out +" Maintainer: Tim Pope +" Version: 1.3 +" GetLatestVimScripts: 3695 1 :AutoInstall: commentary.vim + +if exists("g:loaded_commentary") || &cp || v:version < 700 + finish +endif +let g:loaded_commentary = 1 + +function! s:surroundings() abort + return split(get(b:, 'commentary_format', substitute(substitute( + \ &commentstring, '\S\zs%s',' %s','') ,'%s\ze\S', '%s ', '')), '%s', 1) +endfunction + +function! s:strip_white_space(l,r,line) abort + let [l, r] = [a:l, a:r] + if stridx(a:line,l) == -1 && stridx(a:line,l[0:-2]) == 0 && a:line[strlen(a:line)-strlen(r[1:]):-1] == r[1:] + return [l[0:-2], r[1:]] + endif + return [l, r] +endfunction + +function! s:go(type,...) abort + if a:0 + let [lnum1, lnum2] = [a:type, a:1] + else + let [lnum1, lnum2] = [line("'["), line("']")] + endif + + let [l_, r_] = s:surroundings() + let uncomment = 2 + for lnum in range(lnum1,lnum2) + let line = matchstr(getline(lnum),'\S.*\s\@ 2 && l.r !~# '\\' + let line = substitute(line, + \'\M'.r[0:-2].'\zs\d\*\ze'.r[-1:-1].'\|'.l[0].'\zs\d\*\ze'.l[1:-1], + \'\=substitute(submatch(0)+1-uncomment,"^0$\\|^-\\d*$","","")','g') + endif + if uncomment + let line = substitute(line,'\S.*\s\@ Commentary :call go(line("'<"),line("'>")) +nnoremap Commentary :set opfunc=gog@ +nnoremap CommentaryLine :set opfunc=goexe 'norm! 'v:count1.'g@_' +onoremap Commentary :call textobject(0) +nnoremap ChangeCommentary c:call textobject(1) +nmap CommentaryUndo CommentaryCommentary +command! -range -bar Commentary call s:go(,) + +if !hasmapto('Commentary') || maparg('gc','n') ==# '' + xmap gc Commentary + nmap gc Commentary + omap gc Commentary + nmap gcc CommentaryLine + nmap cgc ChangeCommentary + nmap gcu CommentaryCommentary +endif + +" vim:set et sw=2: diff --git a/vim/.vim/bundle/endwise/CONTRIBUTING.markdown b/vim/.vim/bundle/endwise/CONTRIBUTING.markdown new file mode 100644 index 0000000..b3f0095 --- /dev/null +++ b/vim/.vim/bundle/endwise/CONTRIBUTING.markdown @@ -0,0 +1 @@ +See the [contribution guidelines for pathogen.vim](https://github.com/tpope/vim-pathogen/blob/master/CONTRIBUTING.markdown). diff --git a/vim/.vim/bundle/endwise/README.markdown b/vim/.vim/bundle/endwise/README.markdown new file mode 100644 index 0000000..08f9d70 --- /dev/null +++ b/vim/.vim/bundle/endwise/README.markdown @@ -0,0 +1,42 @@ +# endwise.vim + +This is a simple plugin that helps to end certain structures +automatically. In Ruby, this means adding `end` after `if`, `do`, `def` +and several other keywords. In Vimscript, this amounts to appropriately +adding `endfunction`, `endif`, etc. There's also Bourne shell, VB +(don't ask), C/C++ preprocessor, and Lua support. + +A primary guiding principle in designing this plugin was that an +erroneous insertion is never acceptable. The behavior is only triggered +once pressing enter on the end of the line. When this happens, endwise +searches for a matching end structure and only adds one if none is +found. + +While the goal was to make it customizable, this turned out to be a tall +order. Every language has vastly different requirements. Nonetheless, +for those bold enough to attempt it, you can follow the model of the +autocmds in the plugin to set the three magic variables governing +endwise's behavior. + +## Installation + +If you don't have a preferred installation method, I recommend +installing [pathogen.vim](https://github.com/tpope/vim-pathogen), and +then simply copy and paste: + + cd ~/.vim/bundle + git clone git://github.com/tpope/vim-endwise.git + +## Self-Promotion + +Like endwise.vim? Follow the repository on +[GitHub](https://github.com/tpope/vim-endwise) and vote for it on +[vim.org](http://www.vim.org/scripts/script.php?script_id=2386). And if +you're feeling especially charitable, follow [tpope](http://tpo.pe/) on +[Twitter](http://twitter.com/tpope) and +[GitHub](https://github.com/tpope). + +## License + +Copyright (c) Tim Pope. Distributed under the same terms as Vim itself. +See `:help license`. diff --git a/vim/.vim/bundle/endwise/plugin/endwise.vim b/vim/.vim/bundle/endwise/plugin/endwise.vim new file mode 100644 index 0000000..23eb339 --- /dev/null +++ b/vim/.vim/bundle/endwise/plugin/endwise.vim @@ -0,0 +1,196 @@ +" Location: plugin/endwise.vim +" Author: Tim Pope +" Version: 1.2 +" License: Same as Vim itself. See :help license +" GetLatestVimScripts: 2386 1 :AutoInstall: endwise.vim + +if exists("g:loaded_endwise") || &cp + finish +endif +let g:loaded_endwise = 1 + +augroup endwise " {{{1 + autocmd! + autocmd FileType lua + \ let b:endwise_addition = 'end' | + \ let b:endwise_words = 'function,do,then' | + \ let b:endwise_pattern = '^\s*\zs\%(\%(local\s\+\)\=function\)\>\%(.*\\)\@!\|\<\%(then\|do\)\ze\s*$' | + \ let b:endwise_syngroups = 'luaFunction,luaStatement,luaCond' + autocmd FileType elixir + \ let b:endwise_addition = 'end' | + \ let b:endwise_words = 'do,fn' | + \ let b:endwise_pattern = '.*[^.:@$]\zs\<\%(do\(:\)\@!\|fn\)\>\ze\%(.*[^.:@$]\\)\@!' | + \ let b:endwise_syngroups = 'elixirBlockDefinition' + autocmd FileType ruby + \ let b:endwise_addition = 'end' | + \ let b:endwise_words = 'module,class,def,if,unless,case,while,until,begin,do' | + \ let b:endwise_pattern = '^\(.*=\)\?\s*\%(private\s\+\|protected\s\+\|public\s\+\|module_function\s\+\)*\zs\%(module\|class\|def\|if\|unless\|case\|while\|until\|for\|\|begin\)\>\%(.*[^.:@$]\\)\@!\|\