Browse Source

Added nerd font for icons in ranger

ansible
Micah Halter 2 years ago
parent
commit
2639068988
  1. 4
      .gitignore
  2. 4
      CHANGELOG.md
  3. 1
      Makefile
  4. 232
      ranger/.config/ranger/plugins/devicons.py
  5. 19
      ranger/.config/ranger/plugins/devicons_linemode.py
  6. 6
      ranger/.config/ranger/rc.conf
  7. 6
      urxvt/.Xresources

4
.gitignore

@ -27,3 +27,7 @@ zsh-work/.antigen/*
zsh/.zsh_shortcuts
ranger/.config/ranger/shortcuts.conf
qutebrowser/.config/qutebrowser/shortcuts.py
# python files
**/__pycache__
**/__init__.py

4
CHANGELOG.md

@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased]
### Added
- Added nerd icons to ranger
### Changed
- Default search engine is now DuckDuckGo

1
Makefile

@ -221,6 +221,7 @@ aur: yay
light \
magnet2torrent-git \
ncpamixer \
nerd-fonts-inconsolata \
networkmanager-dmenu-git \
numix-icon-theme-git \
otf-hasklig \

232
ranger/.config/ranger/plugins/devicons.py

@ -0,0 +1,232 @@
#!/usr/bin/python
# coding=UTF-8
# These glyphs, and the mapping of file extensions to glyphs
# has been copied from the vimscript code that is present in
# https://github.com/ryanoasis/vim-devicons
import re;
import os;
# all those glyphs will show as weird squares if you don't have the correct patched font
# My advice is to use NerdFonts which can be found here:
# https://github.com/ryanoasis/nerd-fonts
file_node_extensions = {
'7z' : '',
'ai' : '',
'apk' : '',
'avi' : '',
'bat' : '',
'bmp' : '',
'bz2' : '',
'c' : '',
'c++' : '',
'cab' : '',
'cbr' : '',
'cbz' : '',
'cc' : '',
'clj' : '',
'cljc' : '',
'cljs' : '',
'coffee' : '',
'conf' : '',
'cp' : '',
'cpio' : '',
'cpp' : '',
'css' : '',
'cxx' : '',
'd' : '',
'dart' : '',
'db' : '',
'deb' : '',
'diff' : '',
'dump' : '',
'edn' : '',
'ejs' : '',
'epub' : '',
'erl' : '',
'exe' : '',
'f#' : '',
'fish' : '',
'flac' : '',
'flv' : '',
'fs' : '',
'fsi' : '',
'fsscript' : '',
'fsx' : '',
'gem' : '',
'gif' : '',
'go' : '',
'gz' : '',
'gzip' : '',
'hbs' : '',
'hrl' : '',
'hs' : '',
'htm' : '',
'html' : '',
'ico' : '',
'ini' : '',
'java' : '',
'jl' : '',
'jpeg' : '',
'jpg' : '',
'js' : '',
'json' : '',
'jsx' : '',
'less' : '',
'lha' : '',
'lhs' : '',
'log' : '',
'lua' : '',
'lzh' : '',
'lzma' : '',
'markdown' : '',
'md' : '',
'mkv' : '',
'ml' : 'λ',
'mli' : 'λ',
'mov' : '',
'mp3' : '',
'mp4' : '',
'mpeg' : '',
'mpg' : '',
'mustache' : '',
'ogg' : '',
'pdf' : '',
'php' : '',
'pl' : '',
'pm' : '',
'png' : '',
'psb' : '',
'psd' : '',
'py' : '',
'pyc' : '',
'pyd' : '',
'pyo' : '',
'rar' : '',
'rb' : '',
'rc' : '',
'rlib' : '',
'rpm' : '',
'rs' : '',
'rss' : '',
'scala' : '',
'scss' : '',
'sh' : '',
'slim' : '',
'sln' : '',
'sql' : '',
'styl' : '',
'suo' : '',
't' : '',
'tar' : '',
'tgz' : '',
'ts' : '',
'twig' : '',
'vim' : '',
'vimrc' : '',
'wav' : '',
'webm' : '',
'xml' : '',
'xul' : '',
'xz' : '',
'yml' : '',
'zip' : '',
}
dir_node_exact_matches = {
# English
'.git' : '',
'Desktop' : '',
'Documents' : '',
'Downloads' : '',
'Dropbox' : '',
'Music' : '',
'Pictures' : '',
'Public' : '',
'Templates' : '',
'Videos' : '',
# Spanish
'Escritorio' : '',
'Documentos' : '',
'Descargas' : '',
'Música' : '',
'Imágenes' : '',
'Público' : '',
'Plantillas' : '',
'Vídeos' : '',
# French
'Bureau' : '',
'Documents' : '',
'Images' : '',
'Musique' : '',
'Publique' : '',
'Téléchargements' : '',
'Vidéos' : '',
# Portuguese
'Documentos' : '',
'Imagens' : '',
'Modelos' : '',
'Música' : '',
'Público' : '',
'Vídeos' : '',
'Área de trabalho' : '',
# Italian
'Documenti' : '',
'Immagini' : '',
'Modelli' : '',
'Musica' : '',
'Pubblici' : '',
'Scaricati' : '',
'Scrivania' : '',
'Video' : '',
# German
'Bilder' : '',
'Dokumente' : '',
'Musik' : '',
'Schreibtisch' : '',
'Vorlagen' : '',
'Öffentlich' : '',
}
file_node_exact_matches = {
'.Xdefaults' : '',
'.Xresources' : '',
'.bashprofile' : '',
'.bashrc' : '',
'.dmrc' : '',
'.ds_store' : '',
'.fasd' : '',
'.gitconfig' : '',
'.gitignore' : '',
'.jack-settings' : '',
'.mime.types' : '',
'.nvidia-settings-rc' : '',
'.pam_environment' : '',
'.profile' : '',
'.recently-used' : '',
'.selected_editor' : '',
'.vimrc' : '',
'.xinputrc' : '',
'config' : '',
'dropbox' : '',
'exact-match-case-sensitive-1.txt' : 'X1',
'exact-match-case-sensitive-2' : 'X2',
'favicon.ico' : '',
'gruntfile.coffee' : '',
'gruntfile.js' : '',
'gruntfile.ls' : '',
'gulpfile.coffee' : '',
'gulpfile.js' : '',
'gulpfile.ls' : '',
'ini' : '',
'ledger' : '',
'license' : '',
'mimeapps.list' : '',
'node_modules' : '',
'procfile' : '',
'react.jsx' : '',
'user-dirs.dirs' : '',
}
def devicon(file):
if file.is_directory: return dir_node_exact_matches.get(file.relative_path, '')
return file_node_exact_matches.get(file.relative_path, file_node_extensions.get(file.extension, ''))

19
ranger/.config/ranger/plugins/devicons_linemode.py

@ -0,0 +1,19 @@
import ranger.api
from ranger.core.linemode import LinemodeBase
from plugins.devicons import *
@ranger.api.register_linemode
class DevIconsLinemode(LinemodeBase):
name = "devicons"
uses_metadata = False
def filetitle(self, file, metadata):
return devicon(file) + ' ' + file.relative_path
@ranger.api.register_linemode
class DevIconsLinemodeFile(LinemodeBase):
name = "filename"
def filetitle(self, file, metadata):
return devicon(file) + ' ' + file.relative_path

6
ranger/.config/ranger/rc.conf

@ -23,7 +23,7 @@ set collapse_preview true
set save_console_history true
set status_bar_on_top false
set draw_progress_bar_in_status_bar true
set draw_borders true
set draw_borders false
set dirname_in_tabs false
set mouse_enabled true
set display_size_in_main_column true
@ -435,6 +435,9 @@ copytmap <ESC> q Q w <C-c>
# == Custom Keybindings
# ===================================================================
# Plugins
default_linemode devicons
# General
map V console shell vim%space
map cW bulkrename %s
@ -446,7 +449,6 @@ map <C-f> fzf_select
map <C-l> fzf_locate
map x shell chmod +x %s
# Pins
map pg pingo
map pa console shell $HOME/.config/ranger/pinrunner.sh pa%space

6
urxvt/.Xresources

@ -28,10 +28,12 @@ URxvt.lineSpace: 0
URxvt.allow_bold: true
URxvt*font: xft:xos4 Terminus:pixelsize=14,\
xft:Symbola:antialias=true,\
-wuncon-siji-medium-r-normal--10-100-75-75-c-80-iso10646-1
-wuncon-siji-medium-r-normal--10-100-75-75-c-80-iso10646-1,\
xft:Inconsolata Nerd Font Mono:antialias=true
URxvt*boldFont: xft:xos4 Terminus:pixelsize=14,\
xft:Symbola:antialias=true,\
-wuncon-siji-medium-r-normal--10-100-75-75-c-80-iso10646-1
-wuncon-siji-medium-r-normal--10-100-75-75-c-80-iso10646-1,\
xft:Inconsolata Nerd Font Mono:antialias=true
! Fix font space
URxvt*letterSpace: 0

Loading…
Cancel
Save