diff --git a/.dotconfig b/.dotconfig deleted file mode 100644 index ba30f603..00000000 --- a/.dotconfig +++ /dev/null @@ -1 +0,0 @@ -export DOTHOME=/home/vagrant/.dotfiles diff --git a/README.md b/README.md index dcdcde7e..ea384bfd 100644 --- a/README.md +++ b/README.md @@ -66,10 +66,11 @@ git clone git://github.com/Tarrasch/zsh-autoenv ~/.zsh/bundle/zsh-autoenv ### Shell * [alias-tips](https://github.com/djui/alias-tips): A plugin to help remembering those aliases you defined once * [base-16-shell](https://github.com/chriskempson/base16-shell): A shell script to change your shell's default ANSI colors but most importantly, colors 17 to 21 of your shell's 256 colorspace (if supported by your terminal) - * [cdk](https://github.com/deathbeam/dotfiles/tree/experimental/zsh/.zsh/bundle/cdk): Runs `k` on directory change + * [cdls](https://github.com/deathbeam/dotfiles/tree/experimental/zsh/.zsh/bundle/cdls): Runs `ls -A` on directory change * [fzf](https://github.com/junegunn/fzf): A command-line fuzzy finder written in Go * [k](https://github.com/supercrabtree/k): k is the new l, yo - * [vi-mode](https://github.com/deathbeam/dotfiles/tree/experimental/zsh/.zsh/bundle/vi-mode): Runs `k` on directory change + * [vi-mode](https://github.com/deathbeam/dotfiles/tree/experimental/zsh/.zsh/bundle/vi-mode): Enhanced Vi mode for zsh + with history substring search support * [zim](https://github.com/Eriner/zim): ZIM - Zsh IMproved ### Vim diff --git a/dunst/.config/dunst/dunstrc b/dunst/.config/dunst/dunstrc index 250d3261..98f73090 100644 --- a/dunst/.config/dunst/dunstrc +++ b/dunst/.config/dunst/dunstrc @@ -1,46 +1,48 @@ +; vim:ft=dosini + [global] - alignment = left - allow_markup = yes - bounce_freq = 0 - browser = /usr/bin/firefox -new-tab - dmenu = /usr/bin/dmenu -p dunst: - font = Terminus 12 - format = "%s\n%b" - geometry = "0-15+40" - history_length = 20 - horizontal_padding = 10 - idle_threshold = 120 - ignore_newline = no - indicate_hidden = yes - line_height = 0 - monitor = 0 - follow = keyboard - padding = 10 - separator_color = frame - separator_height = 1 - show_age_threshold = 60 - show_indicators = yes - shrink = no - sort = yes - startup_notification = true - sticky_history = yes - transparency = 0 - word_wrap = yes +alignment = left +allow_markup = yes +bounce_freq = 0 +browser = /usr/bin/firefox -new-tab +dmenu = /usr/bin/dmenu -p dunst: +font = Terminus 12 +format = "%s\n%b" +geometry = "0-15+40" +history_length = 20 +horizontal_padding = 10 +idle_threshold = 120 +ignore_newline = no +indicate_hidden = yes +line_height = 0 +monitor = 0 +follow = keyboard +padding = 10 +separator_color = frame +separator_height = 1 +show_age_threshold = 60 +show_indicators = yes +shrink = no +sort = yes +startup_notification = true +sticky_history = yes +transparency = 0 +word_wrap = yes [frame] - width = 0 +width = 0 [urgency_low] - background = "#002b36" - foreground = "#839496" - timeout = 10 +background = "#002b36" +foreground = "#839496" +timeout = 10 [urgency_normal] - background = "#073642" - foreground = "#93a1a1" - timeout = 20 +background = "#073642" +foreground = "#93a1a1" +timeout = 20 [urgency_critical] - background = "#268bd2" - foreground = "#eee8d5" - timeout = 0 +background = "#268bd2" +foreground = "#eee8d5" +timeout = 0 diff --git a/irssi/.irssi/config b/irssi/.irssi/config index 37857013..bada5cb9 100644 --- a/irssi/.irssi/config +++ b/irssi/.irssi/config @@ -1,3 +1,5 @@ +# vim:foldmethod=marker:set ft=conf: + settings = { core = { real_name = "Tomas Slusny"; @@ -51,3 +53,11 @@ statusbar = { empty = { disabled = "yes"; }; }; }; + +keyboard = ( + { + key = "^R"; + id = "command"; + data = "history_search "; + } +); diff --git a/irssi/.irssi/scripts/autorun/history_search.pl b/irssi/.irssi/scripts/autorun/history_search.pl new file mode 100644 index 00000000..48cbe63a --- /dev/null +++ b/irssi/.irssi/scripts/autorun/history_search.pl @@ -0,0 +1,146 @@ +# Search within your typed history as you type (like ctrl-R in bash) +# Usage: +# * First do: /bind ^R /history_search +# * Then type ctrl-R and type what you're searching for +# * Optionally, you can bind something to "/history_search -forward" to go forward in the results + +# Copyright 2007-2009 Wouter Coekaerts +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +use strict; +use Irssi 20070804; +use Irssi::TextUI; + +use vars qw($VERSION %IRSSI); +$VERSION = '2.1'; +%IRSSI = ( + authors => 'Wouter Coekaerts', + contact => 'coekie@irssi.org', + name => 'history_search', + description => 'Search within your typed history as you type (like ctrl-R in bash)', + license => 'GPLv2 or later', + url => 'http://wouter.coekaerts.be/irssi/', +); + +# is the searching enabled? +my $enabled = 0; +# the typed text (the query) last time a key was pressed +my $prev_typed; +# the position in the input of where the typed text started. +# everything before it is not typed by the user but added by this script as part of the result +my $prev_startpos; +# the current list of matches +my @matches; +# at what place are we in @matches? +my $current_match_index; + +Irssi::command_bind('history_search', sub { + my ($data, $server, $item) = @_; + if ($data !~ /^ *(-forward)? *$/) { + Irssi::print("history_search: Unknown arguments: $data"); + return; + } + my $forward = $1 eq '-forward'; + + if (! $enabled) { + $enabled = 1; + $prev_typed = ''; + $prev_startpos = 0; + @matches = (); + $current_match_index = -1; + } else { + if ($forward) { + if ($current_match_index + 1 < scalar(@matches)) { + $current_match_index++; + } + } else { # backwards + if ($current_match_index > 0) { + $current_match_index--; + } + } + } +}); + +Irssi::signal_add_last 'gui key pressed' => sub { + my ($key) = @_; + + if ($key == 10 || $key == 13 || $key == 27) { # enter or escape + $enabled = 0; + } + + return unless $enabled; + + # get the content of the input line + my $prompt = Irssi::parse_special('$L'); + my $pos = Irssi::gui_input_get_pos(); + + # stop if the cursor is before the position where the typing started (e.g. if user pressed backspace more than he typed characters) + if ($pos < $prev_startpos) { + $enabled = 0; + return; + } + + # get the part of the input line that the user typed (strip the part before and after which this script added) + my $typed = substr($prompt, $prev_startpos, ($pos-$prev_startpos)); + + if ($typed ne $prev_typed) { # something changed + # find matches + find_matches($typed); + + # start searching from the end again + $current_match_index = scalar(@matches) - 1; + } + + # if nothing was found, just show what the user typed + # else, show the current match + my $result = ($current_match_index == -1) ? $typed : $matches[$current_match_index]; + + # update the input line + my $startpos = index(lc($result), lc($typed)); + Irssi::gui_input_set($result); + Irssi::gui_input_set_pos($startpos + length($typed)); + + # remember for next time + $prev_typed = $typed; + $prev_startpos = $startpos; +}; + +# find matches for the given user-typed text, and put it in @matches +sub find_matches($) { + my ($typed) = @_; + if (Irssi::version() > 20090117) { + $typed = lc($typed); + my @history; + if ($prev_typed ne '' && index($typed, lc($prev_typed)) != -1) { # previous typed plus more + @history = @matches; # only search in previous results + } else { + @history = Irssi::active_win->get_history_lines(); + } + @matches = (); + for my $history_line (@history) { + my $startpos = index(lc($history_line), $typed); + if ($startpos != -1) { + push @matches, $history_line; + } + } + } else { # older irssi version, can only get the last match + @matches = (); + my $last_match = Irssi::parse_special('$!' . $typed . '!'); + if ($last_match ne '') { + push @matches, $last_match; + } + } +} diff --git a/irssi/.irssi/scripts/autorun/nickcolor.pl b/irssi/.irssi/scripts/autorun/nickcolor.pl new file mode 100644 index 00000000..ff9915d1 --- /dev/null +++ b/irssi/.irssi/scripts/autorun/nickcolor.pl @@ -0,0 +1,145 @@ +use strict; +use Irssi 20020101.0250 (); +use vars qw($VERSION %IRSSI); +$VERSION = "2"; +%IRSSI = ( + authors => "Timo Sirainen, Ian Peters, David Leadbeater", + contact => "tss\@iki.fi", + name => "Nick Color", + description => "assign a different color for each nick", + license => "Public Domain", + url => "http://irssi.org/", + changed => "Sun 15 Jun 19:10:44 BST 2014", +); + +# Settings: +# nickcolor_colors: List of color codes to use. +# e.g. /set nickcolor_colors 2 3 4 5 6 7 9 10 11 12 13 +# (avoid 8, as used for hilights in the default theme). + +my %saved_colors; +my %session_colors = {}; + +sub load_colors { + open my $color_fh, "<", "$ENV{HOME}/.irssi/saved_colors"; + while (<$color_fh>) { + chomp; + my($nick, $color) = split ":"; + $saved_colors{$nick} = $color; + } +} + +sub save_colors { + open COLORS, ">", "$ENV{HOME}/.irssi/saved_colors"; + + foreach my $nick (keys %saved_colors) { + print COLORS "$nick:$saved_colors{$nick}\n"; + } + + close COLORS; +} + +# If someone we've colored (either through the saved colors, or the hash +# function) changes their nick, we'd like to keep the same color associated +# with them (but only in the session_colors, ie a temporary mapping). + +sub sig_nick { + my ($server, $newnick, $nick, $address) = @_; + my $color; + + $newnick = substr ($newnick, 1) if ($newnick =~ /^:/); + + if ($color = $saved_colors{$nick}) { + $session_colors{$newnick} = $color; + } elsif ($color = $session_colors{$nick}) { + $session_colors{$newnick} = $color; + } +} + +# This gave reasonable distribution values when run across +# /usr/share/dict/words + +sub simple_hash { + my ($string) = @_; + chomp $string; + my @chars = split //, $string; + my $counter; + + foreach my $char (@chars) { + $counter += ord $char; + } + + my @colors = split / /, Irssi::settings_get_str('nickcolor_colors'); + $counter = $colors[$counter % @colors]; + + return $counter; +} + +sub sig_public { + my ($server, $msg, $nick, $address, $target) = @_; + + # Has the user assigned this nick a color? + my $color = $saved_colors{$nick}; + + # Have -we- already assigned this nick a color? + if (!$color) { + $color = $session_colors{$nick}; + } + + # Let's assign this nick a color + if (!$color) { + $color = simple_hash $nick; + $session_colors{$nick} = $color; + } + + $color = sprintf "\003%02d", $color; + $server->command('/^format pubmsg {pubmsgnick $2 {pubnick ' . $color . '$0}}$1'); +} + +sub cmd_color { + my ($data, $server, $witem) = @_; + my ($op, $nick, $color) = split " ", $data; + + $op = lc $op; + + if (!$op) { + Irssi::print ("No operation given (save/set/clear/list/preview)"); + } elsif ($op eq "save") { + save_colors; + } elsif ($op eq "set") { + if (!$nick) { + Irssi::print ("Nick not given"); + } elsif (!$color) { + Irssi::print ("Color not given"); + } elsif ($color < 2 || $color > 14) { + Irssi::print ("Color must be between 2 and 14 inclusive"); + } else { + $saved_colors{$nick} = $color; + } + } elsif ($op eq "clear") { + if (!$nick) { + Irssi::print ("Nick not given"); + } else { + delete ($saved_colors{$nick}); + } + } elsif ($op eq "list") { + Irssi::print ("\nSaved Colors:"); + foreach my $nick (keys %saved_colors) { + Irssi::print (chr (3) . "$saved_colors{$nick}$nick" . + chr (3) . "1 ($saved_colors{$nick})"); + } + } elsif ($op eq "preview") { + Irssi::print ("\nAvailable colors:"); + foreach my $i (2..14) { + Irssi::print (chr (3) . "$i" . "Color #$i"); + } + } +} + +load_colors; + +Irssi::settings_add_str('misc', 'nickcolor_colors', '2 3 4 5 6 7 9 10 11 12 13'); +Irssi::command_bind('color', 'cmd_color'); + +Irssi::signal_add('message public', 'sig_public'); +Irssi::signal_add('event nick', 'sig_nick'); diff --git a/x11/.xinitrc b/x11/.xinitrc index 798736c4..f3457e69 100755 --- a/x11/.xinitrc +++ b/x11/.xinitrc @@ -33,7 +33,7 @@ mopidy & dropbox start & # Set nice wallpaper -feh --bg-scale "~/.wallpaper" +feh --bg-scale ~/.wallpaper # Start clipboard manager daemon ~/.config/dmenu/clipmenu/clipmenud & diff --git a/zsh/.zsh/bundle/cdk/cdk.plugin.zsh b/zsh/.zsh/bundle/cdk/cdk.plugin.zsh deleted file mode 100644 index 44f05ccd..00000000 --- a/zsh/.zsh/bundle/cdk/cdk.plugin.zsh +++ /dev/null @@ -1,8 +0,0 @@ -_cdk_chpwd_handler () { - emulate -L zsh - command -v k >/dev/null 2>&1 && k -} - -autoload -U add-zsh-hook -add-zsh-hook chpwd _cdk_chpwd_handler -_cdk_chpwd_handler diff --git a/zsh/.zsh/bundle/cdls/cdls.plugin.zsh b/zsh/.zsh/bundle/cdls/cdls.plugin.zsh new file mode 100644 index 00000000..7da611ca --- /dev/null +++ b/zsh/.zsh/bundle/cdls/cdls.plugin.zsh @@ -0,0 +1,8 @@ +_cdls_chpwd_handler () { + emulate -L zsh + ls -A +} + +autoload -U add-zsh-hook +add-zsh-hook chpwd _cdls_chpwd_handler +_cdls_chpwd_handler diff --git a/zsh/.zshrc b/zsh/.zshrc index 4333c15c..9f4c2e98 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -82,6 +82,18 @@ # Load base16 theme [ -z $BASE16_THEME ] && base16_solarized-dark + unalias z + z() { + local dir + dir="$(fasd -Rdl "$1" | fzf -1 -0 --height 40% --no-sort +m)" && cd "${dir}" || return 1 + } + + unalias v + v() { + local file + file="$(fasd -Rfl "$1" | fzf -1 -0 --height 40% --no-sort +m)" && vim "${file}" || return 1 + } + # }}} # User configuration {{{