Skip to content

Commit

Permalink
general: Go full on Nerd Fonts
Browse files Browse the repository at this point in the history
https://nerdfonts.com/

For a long time I was skeptical but I decided to try it anyway & I like
it to be honest.

I have a switch in case I want to toggle this `$NERD_FONTS`

- I'm using Iosevka Term Nerd Font because Kitty doesn't render the
normal Iosevka ligatures properly kovidgoyal/kitty#297, but in iTerm & Alacrrity it should be fine I suppose.
  - But here is the catch, I can have both fonts installed 🤦 because ryanoasis/nerd-fonts#257 (comment) so for now using the Term one for now (no ligatures)
- Most of the changes are actually in vim mainly the statusline, I also tweaked the statusline too to make is a bit more minimal.
- In tmux, the main major chnages are:
  - in the github status script (won't show anything by default, only if Github is having issue)
  - Battery check this ahmedelgabri/Battery@a4145f5
- zsh prompt check ahmedelgabri/pure@de04c1d
  • Loading branch information
ahmedelgabri committed May 11, 2018
1 parent c9035f5 commit 199f060
Show file tree
Hide file tree
Showing 12 changed files with 95 additions and 43 deletions.
8 changes: 4 additions & 4 deletions alacritty/.config/alacritty/alacritty.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@ draw_bold_text_with_bright_colors: true
font:
# The normal (roman) font face to use.
normal:
family: Iosevka
family: Iosevka Nerd Font
# Style can be specified to pick a specific face.
style: Medium
style: Regular

# The bold font face
bold:
family: Iosevka
family: Iosevka Nerd Font
# Style can be specified to pick a specific face.
style: Bold

# The italic font face
italic:
family: Iosevka
family: Iosevka Nerd Font
# Style can be specified to pick a specific face.
style: Italic

Expand Down
Binary file modified iterm2/Library/Preferences/com.googlecode.iterm2.plist
Binary file not shown.
8 changes: 4 additions & 4 deletions kitty/.config/kitty/kitty.conf
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
# You can get a list of full family names available on your computer by running
# kitty list-fonts
# The default values shown below rely on your OS to choose an appropriate monospace font family.
font_family Iosevka Term Medium
italic_font Iosevka Term Medium Italic
bold_font Iosevka Term Bold
bold_italic_font Iosevka Term Bold Italic
font_family Iosevka Nerd Font Medium
italic_font Iosevka Nerd Font Medium Italic
bold_font Iosevka Nerd Font Bold
bold_italic_font Iosevka Nerd Font Bold Italic

# Font size (in pts)
font_size 12.0
Expand Down
10 changes: 6 additions & 4 deletions tmux/.tmux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -187,15 +187,17 @@ setw -g window-status-current-style bg=default,fg=colour004

# show session name, window & pane number, date and time on left side of
# status bar
set -g status-left-length 70
set -g status-left "#[fg=colour237]#{?client_prefix,#[fg=colour202],#[fg=colour245]}#S #[fg=colour237] "

# show default node version, battery status, wifi name & date time
status_prefix="#{?client_prefix,#[fg=colour202]#(echo $(tmux show-option -gqv prefix | tr \"[:lower:]\" \"[:upper:]\" | sed 's/C-/\^/')) #[fg=colour237]• ,}"
status_node_version='#[fg=colour237]#[fg=#649C62]#(node -v) #[fg=colour237]• '
status_battery='#(battery -t -p) #[fg=colour237]• '
status_wifi="#[fg=colour237]#[fg=colour243]#(~/.dotfiles/tmux/scripts/tmux-wifi) #[fg=colour237]• "
status_date_time="#[fg=colour237]#[fg=colour243]%A, %d %b %Y %H:%M#[fg=colour237]"
status_github="#[fg=colour243]#(~/.dotfiles/tmux/scripts/tmux-github-status) #[fg=colour237]• "
status_battery='#(battery -t -p -i -c " ") #[fg=colour237]• '
status_wifi="#[fg=colour237]#[fg=colour243]#(~/.dotfiles/tmux/scripts/tmux-wifi)"
# for some reason that extra space at the end prevents the date from overlaping & makes it play nice with Nerd Fonts
status_date_time="#[fg=colour237]#[fg=colour243]%A, %d %b %Y %H:%M#[fg=colour237] "
status_github="#(~/.dotfiles/tmux/scripts/tmux-github-status)"
status_prayer_times="#[fg=colour243]#(~/.dotfiles/tmux/scripts/tmux-next-prayer) #[fg=colour237]• "

set -g status-right-length 300
Expand Down
40 changes: 28 additions & 12 deletions tmux/scripts/tmux-github-status
Original file line number Diff line number Diff line change
@@ -1,17 +1,33 @@
#!/bin/bash
GITHUB_STATUS=$(curl -sS https://status.github.com/api/status.json | jq -r '.status')

case $GITHUB_STATUS in
ma*)
SIGNAL="#[fg=red]⨉"
;;
mi*)
SIGNAL="#[fg=yellow]~"
;;
*)
SIGNAL=""
;;
esac
if [ -n "$NERD_FONTS" ]; then
INDICATIOR=" #[fg=colour237]• "
case $GITHUB_STATUS in
ma*)
STATUS="#[fg=red]$INDICATIOR"
;;
mi*)
STATUS="#[fg=yellow]$INDICATIOR"
;;
*)
STATUS=""
;;
esac
else
INDICATIOR=" #[fg=colour237]• "
case $GITHUB_STATUS in
ma*)
STATUS="#[fg=red]⨉$INDICATOR"
;;
mi*)
STATUS="#[fg=yellow]~$INDICATIOR"
;;
*)
STATUS=""
;;
esac
fi

echo "$SIGNAL"
echo "$STATUS"

10 changes: 9 additions & 1 deletion tmux/scripts/tmux-wifi
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,12 @@

TMUX_WIFI=$(/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | awk -F': ' '/ SSID/{print $2}')

[[ -n $TMUX_WIFI ]] && echo "$TMUX_WIFI" || echo '#[fg=red]⨉#[fg=colour237]'
ON_ICON=""
OFF_ICON''
TAIL="#[fg=colour237] • "

if [ -n "$NERD_FONTS" ]; then
[ -n "$TMUX_WIFI" ] && ON_ICON="" || echo ''
fi

[ -n "$TMUX_WIFI" ] && echo "$ON_ICON$TMUX_WIFI$TAIL" || echo "#[fg=red]$OFF_ICON$TAIL"
4 changes: 2 additions & 2 deletions vim/.vim/after/plugin/ale.vim
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ endif
let g:ale_fix_on_save = 1
let g:ale_set_loclist = 0
let g:ale_set_quickfix = 1
let g:ale_sign_error = ''
let g:ale_sign_error = functions#GetIcon('linter_error')
let g:ale_sign_warning = g:ale_sign_error
let g:ale_sign_style_error = ''
let g:ale_sign_style_error = functions#GetIcon('linter_style')
let g:ale_sign_style_warning = g:ale_sign_error
let g:ale_statusline_format = ['E•%d', 'W•%d', 'OK']
let g:ale_echo_msg_format = '[%linter%] %code% %s'
Expand Down
23 changes: 23 additions & 0 deletions vim/.vim/autoload/functions.vim
Original file line number Diff line number Diff line change
Expand Up @@ -220,3 +220,26 @@ function! functions#move_down() abort range
call s:Move("'>+1", l:at_bottom)
endfunction

function! functions#GetIcon(key) abort
let l:NERD_FONT_ICONS = {
\'vim': ['', '%y'],
\'javascript': ['', '%y'],
\'javascript.jsx': ['', '%y'],
\'clojure': ['', '%y'],
\'clojurescript': ['', '%y'],
\'rust': ['', '%y'],
\'ruby': ['', '%y'],
\'python': ['', '%y'],
\'markdown': ['', '%y'],
\'paste': ['', '⍴'],
\'spell': ['', '✎'],
\'branch': ['', ' '],
\'linter_error': ['', '⨉'],
\'linter_style': ['', '●'],
\'lock': ['', ' '],
\}

let l:icons = get(l:NERD_FONT_ICONS, a:key, [])
return has_key(l:NERD_FONT_ICONS, a:key) ? !empty($NERD_FONTS) ? l:icons[0] : l:icons[1] : a:key
endfunction

12 changes: 6 additions & 6 deletions vim/.vim/autoload/statusline.vim
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ function! statusline#LinterStatus() abort
return ''
endif

let l:error_symbol = ''
let l:style_symbol = ''
let l:error_symbol = functions#GetIcon('linter_error')
let l:style_symbol = functions#GetIcon('linter_style')
let l:counts = ale#statusline#Count(bufnr(''))
let l:ale_linter_status = ''

Expand Down Expand Up @@ -68,18 +68,18 @@ function! statusline#gitInfo() abort

let l:out = fugitive#head(10)
if !empty(l:out) || !empty(expand('%'))
let l:out = ' ' . l:out
let l:out = functions#GetIcon('branch') . l:out
endif
return l:out
endfunction

function! statusline#readOnly() abort
if !&modifiable && &readonly
return ' RO'
return functions#GetIcon('lock') . ' RO'
elseif &modifiable && &readonly
return 'RO'
elseif !&modifiable && !&readonly
return ''
return functions#GetIcon('lock')
else
return ''
endif
Expand Down Expand Up @@ -114,7 +114,7 @@ endfunction

" DEFINE MODE DICTIONARY
let s:dictmode= {
\ 'n': ['N.', '4'],
\ 'n': ['', '4'],
\ 'no': ['N-Operator Pending', '4'],
\ 'v': ['V.', '6'],
\ 'V': ['V·Line', '6'],
Expand Down
21 changes: 11 additions & 10 deletions vim/.vim/plugin/statusline.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,17 @@ scriptencoding utf-8
"------------------------------------------------------------------------------
" STATUS LINE CUSTOMIZATION
"------------------------------------------------------------------------------

function! StatusLine(mode) abort
let l:line=''

if &filetype ==# 'help'
let l:line.=' %#StatusLineNC# [Help] %f '
if &filetype ==# 'help' || &filetype ==# 'man'
let l:line.=' %#StatusLineNC# ['. &filetype .'] %f '
let l:line.=statusline#showHighligh()
return l:line
endif

if a:mode ==# 'active'
let l:line.=' %{statusline#getMode()} %*'
if &paste
let l:line.='%#ErrorMsg#%{" ⍴ "}%*'
endif
if &spell
let l:line='%#WarningMsg#%{" ✎ "}%*'
endif
let l:line.='%6*%{statusline#gitInfo()}'
let l:line.=statusline#GetHunks()
let l:line.='%<'
Expand All @@ -33,8 +27,15 @@ function! StatusLine(mode) abort

let l:line.=statusline#showHighligh()

let l:line.='%{statusline#getMode()} %*'
if &paste
let l:line.='%#ErrorMsg#%{" '. functions#GetIcon('paste') .' "}%*'
endif
if &spell
let l:line.='%#WarningMsg#%{" '. functions#GetIcon('spell') .' "}%*'
endif
let l:line.=statusline#LinterStatus()
let l:line.='%4* %y'
let l:line.='%4* '. functions#GetIcon(&filetype)
if &fileformat !=# 'unix'
let l:line.='%4* %{&ff}%*'
endif
Expand Down
1 change: 1 addition & 0 deletions zsh/.zshenv
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export XDG_CONFIG_HOME="$HOME/.config"
export DOTFILES=$HOME/.dotfiles
export ZDOTDIR=${DOTFILES:-"$HOME/.dotfiles"}/zsh
export GOPATH="${HOME}/.go"
export NERD_FONTS=true

[[ -x /usr/local/bin/brew ]] && export HOMEBREW_ROOT=$(/usr/local/bin/brew --prefix)

Expand Down
1 change: 1 addition & 0 deletions zsh/.zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ SYMBOLS=(

# Arrays in zsh starts from 1
export PURE_PROMPT_SYMBOL="${SYMBOLS[$RANDOM % ${#SYMBOLS[@]} + 1]}"
export PURE_GIT_BRANCH=""

##############################################################
# Python
Expand Down

0 comments on commit 199f060

Please sign in to comment.