i3gaps, ranger and kitty

This commit is contained in:
David Chen 2019-06-07 15:25:19 +08:00
parent 69dd335f20
commit e4ca7e7fef
15 changed files with 1502 additions and 36 deletions

1
.gitignore vendored
View file

@ -7,6 +7,7 @@
!/polybar/
!/ranger/
!/compton/
!/kitty/
!/.Xmodmap
!/.zshrc
!/.gitignore

View file

@ -1 +1 @@
inactive-dim = 0.2;
inactive-dim = 0.05;

View file

@ -40,10 +40,11 @@ new_window 1pixel
floating_modifier $mod
# start a terminal
bindsym $mod+Return exec deepin-terminal -e ranger
bindsym $mod+Return exec kitty
bindsym $mod+Shift+Return exec kitty -e screenfetch
# open ranger
bindsym $mod+Shift+t exec deepin-terminal -e ranger
bindsym $mod+Shift+t exec kitty -e ranger
# kill focused window
bindsym $mod+Shift+q kill
@ -200,3 +201,4 @@ bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute 0 toggle # mute s
bindsym XF86MonBrightnessUp exec xbacklight -inc 10 # increase screen brightness
bindsym XF86MonBrightnessDown exec xbacklight -dec 10 # decrease screen brightness
gaps inner 15

20
kitty/dracula.conf Normal file
View file

@ -0,0 +1,20 @@
background #1e1f28
foreground #f8f8f2
cursor #bbbbbb
selection_background #44475a
color0 #000000
color8 #545454
color1 #ff5555
color9 #ff5454
color2 #50fa7b
color10 #50fa7b
color3 #f0fa8b
color11 #f0fa8b
color4 #bd92f8
color12 #bd92f8
color5 #ff78c5
color13 #ff78c5
color6 #8ae9fc
color14 #8ae9fc
color7 #bbbbbb
color15 #ffffff

View file

@ -0,0 +1,20 @@
background #f7f7f7
foreground #494542
cursor #494542
selection_background #a4a1a1
color0 #090200
color8 #5b5754
color1 #da2c20
color9 #e8bacf
color2 #00a152
color10 #3a3332
color3 #fcec02
color11 #494542
color4 #00a0e4
color12 #7f7c7b
color5 #a06994
color13 #d6d4d3
color6 #b5e4f4
color14 #ccab53
color7 #a4a1a1
color15 #f7f7f7

1006
kitty/kitty.conf Normal file

File diff suppressed because it is too large Load diff

40
kitty/snazzy.conf Normal file
View file

@ -0,0 +1,40 @@
# Snazzy Colorscheme for Kitty
# Based on https://github.com/sindresorhus/hyper-snazzy
foreground #eff0eb
background #282a36
selection_foreground #000000
selection_background #FFFACD
url_color #0087BD
# black
color0 #282a36
color8 #282a36
# red
color1 #FF5C57
color9 #FF5C57
# green
color2 #5AF78E
color10 #5AF78E
# yellow
color3 #F3F99D
color11 #F3F99D
# blue
color4 #57C7FF
color12 #57C7FF
# magenta
color5 #FF6AC1
color13 #FF6AC1
# cyan
color6 #9AEDFE
color14 #9AEDFE
# white
color7 #F1F1F0
color15 #F1F1F0

35
ranger/commands.py Normal file
View file

@ -0,0 +1,35 @@
from ranger.api.commands import Command
class fzf_select(Command):
"""
:fzf_select
Find a file using fzf.
With a prefix argument select only directories.
See: https://github.com/junegunn/fzf
"""
def execute(self):
import subprocess
import os.path
if self.quantifier:
# match only directories
command="find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune \
-o -type d -print 2> /dev/null | sed 1d | cut -b3- | fzf +m"
else:
# match files and directories
command="find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune \
-o -print 2> /dev/null | sed 1d | cut -b3- | fzf +m"
fzf = self.fm.execute_command(command, universal_newlines=True, stdout=subprocess.PIPE)
stdout, stderr = fzf.communicate()
if fzf.returncode == 0:
fzf_file = os.path.abspath(stdout.rstrip('\n'))
if os.path.isdir(fzf_file):
self.fm.cd(fzf_file)
else:
self.fm.select_file(fzf_file)

View file

315
ranger/plugins/devicons.py Executable file
View file

@ -0,0 +1,315 @@
#!/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' : '',
'a' : '',
'ai' : '',
'apk' : '',
'asm' : '',
'asp' : '',
'aup' : '',
'avi' : '',
'bat' : '',
'bmp' : '',
'bz2' : '',
'c' : '',
'c++' : '',
'cab' : '',
'cbr' : '',
'cbz' : '',
'cc' : '',
'class' : '',
'clj' : '',
'cljc' : '',
'cljs' : '',
'cmake' : '',
'coffee' : '',
'conf' : '',
'cp' : '',
'cpio' : '',
'cpp' : '',
'css' : '',
'cue' : '',
'cvs' : '',
'cxx' : '',
'd' : '',
'dart' : '',
'db' : '',
'deb' : '',
'diff' : '',
'dll' : '',
'doc' : '',
'docx' : '',
'dump' : '',
'edn' : '',
'efi' : '',
'ejs' : '',
'elf' : '',
'epub' : '',
'erl' : '',
'exe' : '',
'f#' : '',
'fifo' : '|',
'fish' : '',
'flac' : '',
'flv' : '',
'fs' : '',
'fsi' : '',
'fsscript' : '',
'fsx' : '',
'gem' : '',
'gif' : '',
'go' : '',
'gz' : '',
'gzip' : '',
'h' : '',
'hbs' : '',
'hrl' : '',
'hs' : '',
'htaccess' : '',
'htpasswd' : '',
'htm' : '',
'html' : '',
'ico' : '',
'img' : '',
'ini' : '',
'iso' : '',
'jar' : '',
'java' : '',
'jl' : '',
'jpeg' : '',
'jpg' : '',
'js' : '',
'json' : '',
'jsx' : '',
'key' : '',
'less' : '',
'lha' : '',
'lhs' : '',
'log' : '',
'lua' : '',
'lzh' : '',
'lzma' : '',
'm4a' : '',
'm4v' : '',
'markdown' : '',
'md' : '',
'mkv' : '',
'ml' : 'λ',
'mli' : 'λ',
'mov' : '',
'mp3' : '',
'mp4' : '',
'mpeg' : '',
'mpg' : '',
'msi' : '',
'mustache' : '',
'o' : '',
'ogg' : '',
'pdf' : '',
'php' : '',
'pl' : '',
'pm' : '',
'png' : '',
'pub' : '',
'ppt' : '',
'pptx' : '',
'psb' : '',
'psd' : '',
'py' : '',
'pyc' : '',
'pyd' : '',
'pyo' : '',
'rar' : '',
'rb' : '',
'rc' : '',
'rlib' : '',
'rom' : '',
'rpm' : '',
'rs' : '',
'rss' : '',
'rtf' : '',
's' : '',
'so' : '',
'scala' : '',
'scss' : '',
'sh' : '',
'slim' : '',
'sln' : '',
'sql' : '',
'styl' : '',
'suo' : '',
't' : '',
'tar' : '',
'tgz' : '',
'ts' : '',
'twig' : '',
'vim' : '',
'vimrc' : '',
'wav' : '',
'webm' : '',
'xbps' : '',
'xhtml' : '',
'xls' : '',
'xlsx' : '',
'xml' : '',
'xul' : '',
'xz' : '',
'yaml' : '',
'yml' : '',
'zip' : '',
}
dir_node_exact_matches = {
# English
'.git' : '',
'Desktop' : '',
'Documents' : '',
'Downloads' : '',
'Dotfiles' : '',
'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' : '',
# Hungarian
'Dokumentumok' : '',
'Képek' : '',
'Modelli' : '',
'Zene' : '',
'Letöltések' : '',
'Számítógép' : '',
'Videók' : '',
}
file_node_exact_matches = {
'.Xauthority' : '',
'.Xdefaults' : '',
'.Xresources' : '',
'.bash_aliases' : '',
'.bashprofile' : '',
'.bash_profile' : '',
'.bash_logout' : '',
'.bash_history' : '',
'.bashrc' : '',
'.dmrc' : '',
'.DS_Store' : '',
'.fasd' : '',
'.fehbg' : '',
'.gitconfig' : '',
'.gitattributes' : '',
'.gitignore' : '',
'.inputrc' : '',
'.jack-settings' : '',
'.mime.types' : '',
'.nvidia-settings-rc' : '',
'.pam_environment' : '',
'.profile' : '',
'.recently-used' : '',
'.selected_editor' : '',
'.vim' : '',
'.vimrc' : '',
'.viminfo' : '',
'.xinitrc' : '',
'.xinputrc' : '',
'config' : '',
'dropbox' : '',
'exact-match-case-sensitive-1.txt' : 'X1',
'exact-match-case-sensitive-2' : 'X2',
'favicon.ico' : '',
'a.out' : '',
'bspwmrc' : '',
'sxhkdrc' : '',
'Makefile' : '',
'Makefile.in' : '',
'Makefile.ac' : '',
'config.mk' : '',
'config.m4' : '',
'config.ac' : '',
'configure' : '',
'Rakefile' : '',
'gruntfile.coffee' : '',
'gruntfile.js' : '',
'gruntfile.ls' : '',
'gulpfile.coffee' : '',
'gulpfile.js' : '',
'gulpfile.ls' : '',
'ini' : '',
'ledger' : '',
'package.json' : '',
'package-lock.json' : '',
'.ncmpcpp' : '',
'playlists' : '',
'known_hosts' : '',
'authorized_keys' : '',
'license' : '',
'LICENSE.md' : '',
'LICENSE' : '',
'LICENSE.txt' : '',
'mimeapps.list' : '',
'node_modules' : '',
'procfile' : '',
'react.jsx' : '',
'README.rst' : '',
'README.md' : '',
'README.markdown' : '',
'README' : '',
'README.txt' : '',
'user-dirs.dirs' : '',
'webpack.config.js' : '',
}
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, ''))

View file

@ -0,0 +1,19 @@
import ranger.api
from ranger.core.linemode import LinemodeBase
from .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

View file

@ -40,7 +40,7 @@ set vcs_backend_bzr disabled
set vcs_backend_svn disabled
# Use one of the supported image preview protocols
set preview_images false
set preview_images true
# Set the preview image method. Supported methods:
#
@ -125,7 +125,7 @@ set draw_progress_bar_in_status_bar true
set draw_borders none
# Display the directory name in tabs?
set dirname_in_tabs false
set dirname_in_tabs true
# Enable the mouse support?
set mouse_enabled true
@ -141,7 +141,7 @@ set display_free_space_in_status_bar true
set display_tags_in_all_columns true
# Set a title for the window?
set update_title false
set update_title true
# Set the title to "ranger" in the tmux program?
set update_tmux_title true
@ -154,7 +154,7 @@ set shorten_title 3
set hostname_in_titlebar true
# Abbreviate $HOME with ~ in the titlebar (first line) of ranger?
set tilde_in_titlebar false
set tilde_in_titlebar true
# How many directory-changes or console-commands should be kept in history?
set max_history_size 20
@ -248,7 +248,7 @@ set relative_current_zero false
set one_indexed false
# Save tabs on exit
set save_tabs_on_exit false
set save_tabs_on_exit true
# Enable scroll wrapping - moving down while on the last item will wrap around to
# the top and vice versa.
@ -297,12 +297,11 @@ alias travel scout -aefklst
# ===================================================================
# Basic
map Q quit
map q quit
map Q quitall
map : console
# map S shell $SHELL
map V console shell vim%space
map t tag_toggle
map T tag_remove
map <Space> mark_files toggle=True
# Jumping around
@ -327,6 +326,7 @@ map y. yank name_without_extension
map + chmod
map cw console rename%space
map cW console bulkrename
map a rename_append
map A eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%"))
map k eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%"), position=7)
@ -343,11 +343,13 @@ map pht paste_hardlinked_subtree
map dD console delete
map dd cut
map ld uncut
map da cut mode=add
map dr cut mode=remove
map dt cut mode=toggle
map yy copy
map ly uncut
map ya copy mode=add
map yr copy mode=remove
map yt copy mode=toggle
@ -357,33 +359,36 @@ map yt copy mode=toggle
map / console search%space
map = search_next
map - search_next forward=False
map <C-f> fzf_select
# Tabs
map <C-n> tab_new
map <C-w> tab_close
map <TAB> tab_move 1
map <S-TAB> tab_move -1
map tu tab_new
map I tab_move 1
map N tab_move -1
map lq tab_restore
map ti tab_shift 1
map tn tab_shift -1
# Sorting
map sr set sort_reverse!
map sz set sort=random
map ss chain set sort=size; set sort_reverse=False
map sb chain set sort=basename; set sort_reverse=False
map sn chain set sort=natural; set sort_reverse=False
map sm chain set sort=mtime; set sort_reverse=False
map sc chain set sort=ctime; set sort_reverse=False
map sa chain set sort=atime; set sort_reverse=False
map st chain set sort=type; set sort_reverse=False
map se chain set sort=extension; set sort_reverse=False
map or set sort_reverse!
map oz set sort=random
map os chain set sort=size; set sort_reverse=False
map ob chain set sort=basename; set sort_reverse=False
map on chain set sort=natural; set sort_reverse=False
map om chain set sort=mtime; set sort_reverse=False
map oc chain set sort=ctime; set sort_reverse=False
map oa chain set sort=atime; set sort_reverse=False
map ot chain set sort=type; set sort_reverse=False
map oe chain set sort=extension; set sort_reverse=False
map sS chain set sort=size; set sort_reverse=True
map sB chain set sort=basename; set sort_reverse=True
map sN chain set sort=natural; set sort_reverse=True
map sM chain set sort=mtime; set sort_reverse=True
map sC chain set sort=ctime; set sort_reverse=True
map sA chain set sort=atime; set sort_reverse=True
map sT chain set sort=type; set sort_reverse=True
map sE chain set sort=extension; set sort_reverse=True
map oS chain set sort=size; set sort_reverse=True
map oB chain set sort=basename; set sort_reverse=True
map oN chain set sort=natural; set sort_reverse=True
map oM chain set sort=mtime; set sort_reverse=True
map oC chain set sort=ctime; set sort_reverse=True
map oA chain set sort=atime; set sort_reverse=True
map oT chain set sort=type; set sort_reverse=True
map oE chain set sort=extension; set sort_reverse=True
map dc get_cumulative_size
@ -436,8 +441,8 @@ copymap <LEFT> n
copymap <RIGHT> i
copymap <HOME> gg
copymap <END> G
copymap <PAGEDOWN> E
copymap <PAGEUP> U
map E move down=5
map U move up=5
@ -498,3 +503,6 @@ copycmap <backspace> <backspace2>
cmap <allow_quantifiers> false
# a plugin that adds file glyphs / icon support to Ranger:
# https://github.com/alexanderjeurissen/ranger_devicons
default_linemode devicons