Fish nvim setup with colors

This commit is contained in:
Noah Masur
2020-07-26 16:15:21 -04:00
parent a7437d61c7
commit 5d25fdb6fa
18 changed files with 2665 additions and 1430 deletions

View File

@ -1,2 +1,39 @@
starship init fish | source
#!/usr/local/bin/fish
if status --is-interactive
# Set $PATH for finding programs
set FISH_DIR (readlink ~/.config/fish)
set DOTS (dirname $FISH_DIR)
set PROJ (dirname $DOTS)
set PATH $PATH /usr/local/bin ~/.local/bin $DOTS/bin ~/.cargo/bin
set CDPATH . $HOME $PROJ $DOTS
# Use `vi` in the shell
fish_vi_key_bindings
set XTERM_VERSION hello
fish_vi_cursor
set fish_cursor_default block
set fish_cursor_insert line
set fish_cursor_replace_one underscore
set fish_cursor_visual block
# Turn off greeting
set fish_greeting ""
# Autojump
[ -f /usr/local/share/autojump/autojump.fish ]; and source /usr/local/share/autojump/autojump.fish
# Colors
theme_gruvbox
# Aliases
aliases
# Individual features
pyenv
# Use `starship` prompt
starship init fish | source
end

View File

@ -1,32 +1,61 @@
# This file contains fish universal variable definitions.
# VERSION: 3.0
SETUVAR __fish_initialized:3100
SETUVAR fish_color_autosuggestion:555\x1ebrblack
SETUVAR _fish_abbr__01_t:cat
SETUVAR _fish_abbr_boot:\x24DOTS/scripts/bootstrap
SETUVAR _fish_abbr_ca:cargo
SETUVAR _fish_abbr_cat:bat
SETUVAR _fish_abbr_d:deactivate
SETUVAR _fish_abbr_db:docker\x20build\x20\x2e\x20\x2dt
SETUVAR _fish_abbr_dc:\x24DOTS/bin/docker_cleanup
SETUVAR _fish_abbr_dr:docker\x20run
SETUVAR _fish_abbr_falias:vim\x20\x24HOME/\x2econfig/fish/functions/aliases\x2efish
SETUVAR _fish_abbr_fishal:vim\x20\x24HOME/\x2econfig/fish/functions/aliases\x2efish
SETUVAR _fish_abbr_fishrc:vim\x20\x24HOME/\x2econfig/fish/config\x2efish
SETUVAR _fish_abbr_frc:vim\x20\x24HOME/\x2econfig/fish/config\x2efish
SETUVAR _fish_abbr_ga:git\x20add\x20\x2dA
SETUVAR _fish_abbr_gc:git\x20commit\x20\x2dm
SETUVAR _fish_abbr_gd:git\x20diff
SETUVAR _fish_abbr_gs:git\x20status
SETUVAR _fish_abbr_h:http\x20\x2dFh\x20\x2d\x2dall
SETUVAR _fish_abbr_hosts:sudo\x20vim\x20/etc/hosts
SETUVAR _fish_abbr_l:ls
SETUVAR _fish_abbr_la:ls\x20\x2dalhF
SETUVAR _fish_abbr_lh:ls\x20\x2dlh
SETUVAR _fish_abbr_ll:ls\x20\x2dalhF
SETUVAR _fish_abbr_misty:cd\x20\x24PROJ/misty
SETUVAR _fish_abbr_oldcat:cat
SETUVAR _fish_abbr_p:python
SETUVAR _fish_abbr_py:python
SETUVAR _fish_abbr_runbootstrap:\x24DOTS/scripts/bootstrap
SETUVAR _fish_abbr_sshc:vim\x20\x7e/\x2essh/config
SETUVAR _fish_abbr_ssl:openssl\x20req\x20\x2dnew\x20\x2dnewkey\x20rsa\x3a2048\x20\x2dnodes\x20\x2dkeyout\x20server\x2ekey\x20\x2dout\x20server\x2ecsr
SETUVAR _fish_abbr_te:terraform
SETUVAR _fish_abbr_vimrc:vim\x20\x24HOME/\x2econfig/nvim/init\x2evim
SETUVAR fish_color_autosuggestion:686868
SETUVAR fish_color_cancel:\x2dr
SETUVAR fish_color_command:005fd7
SETUVAR fish_color_comment:990000
SETUVAR fish_color_command:a1b56c
SETUVAR fish_color_comment:f7ca88
SETUVAR fish_color_cwd:green
SETUVAR fish_color_cwd_root:red
SETUVAR fish_color_end:009900
SETUVAR fish_color_error:ff0000
SETUVAR fish_color_escape:00a6b2
SETUVAR fish_color_end:ba8baf
SETUVAR fish_color_error:ab4642
SETUVAR fish_color_escape:86c1b9
SETUVAR fish_color_history_current:\x2d\x2dbold
SETUVAR fish_color_host:normal
SETUVAR fish_color_host_remote:yellow
SETUVAR fish_color_match:\x2d\x2dbackground\x3dbrblue
SETUVAR fish_color_match:7cafc2
SETUVAR fish_color_normal:normal
SETUVAR fish_color_operator:00a6b2
SETUVAR fish_color_param:00afff
SETUVAR fish_color_quote:999900
SETUVAR fish_color_redirection:00afff
SETUVAR fish_color_operator:7cafc2
SETUVAR fish_color_param:normal
SETUVAR fish_color_quote:f7ca88
SETUVAR fish_color_redirection:yellow
SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack
SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
SETUVAR fish_color_status:red
SETUVAR fish_color_user:brgreen
SETUVAR fish_color_valid_path:\x2d\x2dunderline
SETUVAR fish_greeting:Welcome\x20to\x20fish\x2c\x20the\x20friendly\x20interactive\x20shell\x0aType\x20\x60help\x60\x20for\x20instructions\x20on\x20how\x20to\x20use\x20fish
SETUVAR fish_key_bindings:fish_default_key_bindings
SETUVAR fish_pager_color_completion:\x1d
SETUVAR fish_pager_color_completion:normal
SETUVAR fish_pager_color_description:B3A06D\x1eyellow
SETUVAR fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan

View File

@ -0,0 +1,72 @@
#!/usr/local/bin/fish
function aliases --description 'All aliases'
# Directory aliases
alias ls 'exa' # exa = improved ls
abbr -a l 'ls' # Quicker shortcut for ls
abbr -a lh 'ls -lh' # Pretty vertical list
abbr -a ll 'ls -alhF' # Include hidden files
# Git
abbr -a gs 'git status'
abbr -a gd 'git diff'
abbr -a ga 'git add -A'
abbr -a gc 'git commit -m'
# Vim
if command -v nvim > /dev/null
alias vim='nvim' # Use neovim if installed
abbr -a vimrc 'vim $HOME/.config/nvim/init.vim' # Edit ".vimrc" file
end
# Improved CLI Tools
alias ping='prettyping --nolegend'
abbr -a cat 'bat' # Swap cat with bat
abbr -a oldcat 'cat' # If we need to use cat
abbr -a h 'http -Fh --all' # Curl site for headers
# Fun CLI Tools
alias search='googler -j'
alias checkip='curl checkip.amazonaws.com'
alias weather='curl wttr.in'
alias moon='curl wttr.in/Moon'
alias ipinfo='curl ipinfo.io'
alias worldmap='telnet mapscii.me'
# Dotfile and config shortcuts
alias reload='source $DOTS/fish.configlink/config.fish' # Refresh fish shell
abbr -a boot '$DOTS/scripts/bootstrap'
abbr -a sshc 'vim ~/.ssh/config'
abbr -a hosts 'sudo vim /etc/hosts'
abbr -a frc 'vim $HOME/.config/fish/config.fish'
abbr -a falias 'vim $HOME/.config/fish/functions/aliases.fish'
# Cheat Sheets
alias proj='cd $PROJ'
abbr -a ssl 'openssl req -new -newkey rsa:2048 -nodes' \
'-keyout server.key -out server.csr'
# Docker
abbr -a dc '$DOTS/bin/docker_cleanup'
abbr -a dr 'docker run'
abbr -a db 'docker build . -t'
alias connect='docker run --rm -v ~/.aws:/root/.aws -v ~/.ssh:/root/.ssh -it connect-aws'
# Terraform
abbr -a te 'terraform'
# Python
abbr py 'python'
alias domisty='cd $PROJ/misty && ./buildrun.sh'
# Rust
abbr -a ca 'cargo'
# Non-MacOS
if [ (uname) = "Linux" ]
alias pbcopy='xclip -selection clipboard -in'
alias pbpaste='xclip -selection clipboard -out'
end
end

View File

@ -0,0 +1,25 @@
#!/usr/local/bin/fish
function 'pyenv' --description 'Features for Pyenv virtualenvs'
set -g PYENV_VERSIONS_DIR $HOME/.pyenv/versions
abbr -a d 'deactivate'
alias pv='cd $PYENV_VERSIONS_DIR'
alias ip='source $PYENV_VERSIONS_DIR/ipython/bin/activate.fish'
function 'venv' --description 'Enter a pyenv virtualenv'
source ~/.pyenv/versions/$argv[1]/bin/activate.fish
end
function 'ipy' --description 'Borrow iPython interpreter'
set STORED_VENV $VIRTUAL_ENV
source $PYENV_VERSIONS_DIR/ipython/bin/activate.fish; and \
ipython; and \
deactivate; and \
if [ $STORED_VENV ];
source $STORED_VENV/bin/activate.fish
end
end
end

View File

@ -0,0 +1,141 @@
#!/usr/bin/fish
function theme_gruvbox --description 'Apply gruvbox theme'
set -l mode 'dark'
if test (count $argv) -gt 0
set mode $argv[1]
end
set -g contrast 'medium'
if test (count $argv) -gt 1
set contrast $argv[2]
end
switch $contrast
case 'soft'
case 'medium'
case 'hard'
case '*'
set_color $fish_color_error
echo 'Unknown contrast $contrast, choose soft, medium or hard'
set_color $fish_color_normal
return 1
end
switch $mode
case 'light'
__theme_gruvbox_base
__theme_gruvbox_light
case 'dark'
__theme_gruvbox_base
__theme_gruvbox_dark
case '*'
set_color $fish_color_error
echo 'Unknown mode $mode, choose light or dark'
set_color $fish_color_normal
return 1
end
__theme_gruvbox_palette
return 0
end
function __theme_gruvbox_base
__printf_color 1 'cc/24/1d'
__printf_color 2 '98/97/1a'
__printf_color 3 'd7/99/21'
__printf_color 4 '45/85/88'
__printf_color 5 'b1/62/86'
__printf_color 6 '68/9d/6a'
end
function __theme_gruvbox_light
set -l bg 'fb/f1/c7'
switch $contrast
case "soft"
set bg 'f2/e5/bc'
case "hard"
set bg 'f9/f5/d7'
end
command printf "\033]11;rgb:$bg\007"
set -l fg '3c/38/36'
command printf "\033]10;rgb:$fg\007"
__printf_color 0 $bg
__printf_color 7 '7c/6f/64'
__printf_color 8 '92/83/74'
__printf_color 9 '9d/00/06'
__printf_color 10 '79/74/0e'
__printf_color 11 'b5/76/14'
__printf_color 12 '07/66/78'
__printf_color 13 '8f/3f/71'
__printf_color 14 '42/7b/58'
__printf_color 15 $fg
end
function __theme_gruvbox_dark
set -l bg '28/28/28'
switch $contrast
case "soft"
set bg '32/30/2f'
case "hard"
set bg '1d/20/21'
end
command printf "\033]11;rgb:$bg\007"
set -l fg 'eb/db/b2'
command printf "\033]10;rgb:$fg\007"
__printf_color 0 $bg
__printf_color 7 'a8/99/84'
__printf_color 8 '92/83/74'
__printf_color 9 'fb/59/34'
__printf_color 10 'b8/bb/26'
__printf_color 11 'fa/bd/2f'
__printf_color 12 '83/a5/98'
__printf_color 13 'd3/86/9b'
__printf_color 14 '8e/c0/7c'
__printf_color 15 $fg
end
function __theme_gruvbox_palette
__printf_color 236 '32/30/2f'
__printf_color 234 '1d/20/21'
__printf_color 235 '28/28/28'
__printf_color 237 '3c/38/36'
__printf_color 239 '50/49/45'
__printf_color 241 '66/5c/54'
__printf_color 243 '7c/6f/64'
__printf_color 244 '92/83/74'
__printf_color 245 '92/83/74'
__printf_color 228 'f2/e5/bc'
__printf_color 230 'f9/f5/d7'
__printf_color 229 'fb/f1/c7'
__printf_color 223 'eb/db/b2'
__printf_color 250 'd5/c4/a1'
__printf_color 248 'bd/ae/93'
__printf_color 246 'a8/99/84'
__printf_color 167 'fb/49/34'
__printf_color 142 'b8/bb/26'
__printf_color 214 'fa/bd/2f'
__printf_color 109 '83/a5/98'
__printf_color 175 'd3/86/9b'
__printf_color 108 '8e/c0/7c'
__printf_color 208 'fe/80/19'
__printf_color 88 '9d/00/06'
__printf_color 100 '79/74/0e'
__printf_color 136 'b5/76/14'
__printf_color 24 '07/66/78'
__printf_color 96 '8f/3f/71'
__printf_color 66 '42/7b/58'
__printf_color 130 'af/3a/03'
end
function __printf_color
command printf "\033]4;$argv[1];rgb:$argv[2]\007"
end