changeset 425:350f7a55ff33

Improve fish configuration.
author Ludovic Chabant <ludovic@chabant.com>
date Wed, 28 Mar 2018 20:07:21 -0700
parents d8086f81b9c8
children 67f14a8c2304
files fish/completions/tmuxinator.fish fish/config.fish install.py
diffstat 3 files changed, 65 insertions(+), 49 deletions(-) [+]
line wrap: on
line diff
--- a/fish/completions/tmuxinator.fish	Tue Mar 27 21:34:25 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-function __fish_tmuxinator_using_command
-  set cmd (commandline -opc)
-  if [ (count $cmd) -gt 1 ]
-    if [ $argv[1] = $cmd[2] ]
-      return 0
-    end
-  end
-  return 1
-end
-
-set __fish_tmuxinator_program_cmd (commandline -o)[1]
-
-function __fish_tmuxinator_program
-  eval "$__fish_tmuxinator_program_cmd $argv"
-end
-
-complete -f -c $__fish_tmuxinator_program_cmd                                                -a '(__fish_tmuxinator_program completions start)'
-complete -f -c $__fish_tmuxinator_program_cmd -n '__fish_use_subcommand'                  -x -a "(__fish_tmuxinator_program commands)"
-complete -f -c $__fish_tmuxinator_program_cmd -n '__fish_tmuxinator_using_command start'     -a "(__fish_tmuxinator_program completions start)"
-complete -f -c $__fish_tmuxinator_program_cmd -n '__fish_tmuxinator_using_command open'      -a "(__fish_tmuxinator_program completions open)"
-complete -f -c $__fish_tmuxinator_program_cmd -n '__fish_tmuxinator_using_command copy'      -a "(__fish_tmuxinator_program completions copy)"
-complete -f -c $__fish_tmuxinator_program_cmd -n '__fish_tmuxinator_using_command delete'    -a "(__fish_tmuxinator_program completions delete)"
-
-abbr --add mux "tmuxinator"
--- a/fish/config.fish	Tue Mar 27 21:34:25 2018 -0700
+++ b/fish/config.fish	Wed Mar 28 20:07:21 2018 -0700
@@ -1,37 +1,33 @@
 
 # Environment variables {{{
 
-set -g -x fish_greeting 'Hello.'
+set -x fish_greeting 'Hello.'
 
-# Homebrew.
-#set -g -x PATH /usr/local/sbin $PATH
-#set -g -x PATH /usr/local/bin $PATH
- 
 # My own stuff.
 if test -d $HOME/.local/bin
-    set -g -x PATH $HOME/.local/bin $PATH
+    set -x PATH $HOME/.local/bin $PATH
 end
 if test -d $HOME/bin
-    set -g -x PATH $HOME/bin $PATH
+    set -x PATH $HOME/bin $PATH
 end
-set -g -x OS MacOSX
-set -g -x EDITOR vim
-set -g -x TERM screen-256color-bce
+set -x OS MacOSX
+set -x EDITOR vim
+#set -x TERM screen-256color-bce
 
 # Python.
-set -g -x VIRTUAL_ENV_DISABLE_PROMPT 1
+set -x VIRTUAL_ENV_DISABLE_PROMPT 1
 
-# Go.
-set -g -x GOPATH /usr/local/Cellar/go/1.4/gocode
-
+# Detect Git/Hg availability.
 if type -q git 
-    set -g -x __local_has_git
+    set -x __local_has_git
 end
 if type -q hg
-    set -g -x __local_has_hg
+    set -x __local_has_hg
 end
+
+# Detect my own stuff.
 if test -e $HOME/.local/bin/fast-hg-bookmark
-    set -g -x __local_has_fast_hg_bookmark
+    set -x __local_has_fast_hg_bookmark
 end
 
 # }}}
@@ -41,6 +37,19 @@
 # Run Tmux in UTF8 and 256 colours always.
 alias tm 'tmux -u2'
 
+# Switch directories.
+alias ..    'cd ..'
+alias ...   'cd ../..'
+alias ....  'cd ../../..'
+alias ..... 'cd ../../../..'
+
+alias md 'mkdir -p'
+
+# }}}
+
+# Key Bindings {{{
+
+
 # }}}
 
 # Prompt {{{
@@ -137,14 +146,44 @@
 
 # }}}
 
-# Directories {{{
+# FZF {{{
 
-alias ..    'cd ..'
-alias ...   'cd ../..'
-alias ....  'cd ../../..'
-alias ..... 'cd ../../../..'
+if type -q fzf 
+    function _gen_fzf_default_opts
+        set -l base03 "234"
+        set -l base02 "235"
+        set -l base01 "240"
+        set -l base00 "241"
+        set -l base0 "244"
+        set -l base1 "245"
+        set -l base2 "254"
+        set -l base3 "230"
+        set -l yellow "136"
+        set -l orange "166"
+        set -l red "160"
+        set -l magenta "125"
+        set -l violet "61"
+        set -l blue "33"
+        set -l cyan "37"
+        set -l green "64"
 
-alias md 'mkdir -p'
+        # Solarized Dark color scheme for fzf
+        set -x FZF_DEFAULT_OPTS "--color fg:-1,bg:-1,hl:$blue,fg+:$base2,bg+:$base02,hl+:$blue --color info:$yellow,prompt:$yellow,pointer:$base3,marker:$base3,spinner:$yellow"
+        # Solarized Light color scheme for fzf
+        #set -x FZF_DEFAULT_OPTS "--color fg:-1,bg:-1,hl:$blue,fg+:$base02,bg+:$base2,hl+:$blue --color info:$yellow,prompt:$yellow,pointer:$base03,marker:$base03,spinner:$yellow"
+    end
+
+    _gen_fzf_default_opts
+
+    if  type -q ag
+        # Use Ag for searching.
+        set -x FZF_DEFAULT_COMMAND 'ag --nocolor -g ""'
+    end
+
+    # Use the default command for searching in Fisherman's FZF plugin.
+    set -x FZF_FIND_FILE_COMMAND $FZF_DEFAULT_COMMAND
+    set -U FZF_LEGACY_KEYBINDINGS 0
+end
 
 # }}}
 
--- a/install.py	Tue Mar 27 21:34:25 2018 -0700
+++ b/install.py	Wed Mar 28 20:07:21 2018 -0700
@@ -103,8 +103,9 @@
 
 @only_on_nix
 def install_fish():
-    ensure_dir('~/.config')
-    mklink('fish', '~/.config/fish')
+    ensure_dir('~/.config/fish')
+    writelines('~/.config/fish/config.fish',
+               ['source %s' % _p('fish', 'config.fish')])
 
 
 def install_vim():