├── .Xdefaults ├── .bashrc ├── .config ├── awesome │ ├── autostart.lua │ ├── awful │ │ └── hotkeys_popup │ │ │ └── keys │ │ │ └── tmux.lua │ ├── errorHandling.lua │ ├── keys.lua │ ├── rc.lua │ ├── rules.lua │ ├── themes │ │ └── macos-dark │ │ │ ├── icons │ │ │ ├── ac.png │ │ │ ├── awesome.png │ │ │ ├── awesome2.png │ │ │ ├── bat.png │ │ │ ├── bat_low.png │ │ │ ├── bat_no.png │ │ │ ├── centerfair.png │ │ │ ├── centerwork.png │ │ │ ├── disk.png │ │ │ ├── dwindle.png │ │ │ ├── fairh.png │ │ │ ├── fairv.png │ │ │ ├── floating.png │ │ │ ├── fullscreen.png │ │ │ ├── magnifier.png │ │ │ ├── max.png │ │ │ ├── pause.png │ │ │ ├── play.png │ │ │ ├── spiral.png │ │ │ ├── square_sel.png │ │ │ ├── square_unsel.png │ │ │ ├── submenu.png │ │ │ ├── termfair.png │ │ │ ├── tile.png │ │ │ ├── tilebottom.png │ │ │ ├── tileleft.png │ │ │ ├── tiletop.png │ │ │ ├── titlebar │ │ │ │ ├── close_focus.png │ │ │ │ ├── close_normal.png │ │ │ │ ├── dots.rb │ │ │ │ ├── dots.svg │ │ │ │ ├── dots.yml │ │ │ │ ├── floating_focus_active.png │ │ │ │ ├── floating_focus_inactive.png │ │ │ │ ├── floating_normal_active.png │ │ │ │ ├── floating_normal_inactive.png │ │ │ │ ├── maximized_focus_active.png │ │ │ │ ├── maximized_focus_inactive.png │ │ │ │ ├── maximized_normal_active.png │ │ │ │ ├── maximized_normal_inactive.png │ │ │ │ ├── minimize_focus.png │ │ │ │ ├── minimize_normal.png │ │ │ │ ├── ontop_focus_active.png │ │ │ │ ├── ontop_focus_inactive.png │ │ │ │ ├── ontop_normal_active.png │ │ │ │ ├── ontop_normal_inactive.png │ │ │ │ ├── squares.rb │ │ │ │ ├── squares.yml │ │ │ │ ├── sticky_focus_active.png │ │ │ │ ├── sticky_focus_inactive.png │ │ │ │ ├── sticky_normal_active.png │ │ │ │ ├── sticky_normal_inactive.png │ │ │ │ └── trance.png │ │ │ ├── vol.png │ │ │ ├── vol_low.png │ │ │ ├── vol_mute.png │ │ │ ├── vol_no.png │ │ │ └── widget_bg.png │ │ │ └── theme.lua │ └── widgets │ │ ├── battery.lua │ │ ├── cpu.lua │ │ └── volume.lua ├── compton.conf ├── i3 │ ├── config │ ├── i3status.conf │ └── scripts │ │ └── gnome-keyring.sh ├── iTerm │ ├── com.googlecode.iterm2.plist │ └── profile.json ├── kitty │ └── kitty.conf ├── nnn │ └── plugins │ │ ├── .cbcp │ │ ├── .iconlookup │ │ ├── .nmv │ │ ├── .nnn-plugin-helper │ │ ├── .ntfy │ │ ├── README.md │ │ ├── autojump │ │ ├── bookmarks │ │ ├── boom │ │ ├── bulknew │ │ ├── cdpath │ │ ├── chksum │ │ ├── cmusq │ │ ├── diffs │ │ ├── dragdrop │ │ ├── dups │ │ ├── finder │ │ ├── fixname │ │ ├── fzcd │ │ ├── fzhist │ │ ├── fzopen │ │ ├── fzplug │ │ ├── fzz │ │ ├── getplugs │ │ ├── gpgd │ │ ├── gpge │ │ ├── gutenread │ │ ├── hexview │ │ ├── imgresize │ │ ├── imgthumb │ │ ├── imgur │ │ ├── imgview │ │ ├── ipinfo │ │ ├── kdeconnect │ │ ├── launch │ │ ├── mediainf │ │ ├── mimelist │ │ ├── moclyrics │ │ ├── mocplay │ │ ├── mocq │ │ ├── mp3conv │ │ ├── mtpmount │ │ ├── nbak │ │ ├── nmount │ │ ├── nuke │ │ ├── oldbigfile │ │ ├── organize │ │ ├── pdfread │ │ ├── pdfview │ │ ├── picker │ │ ├── preview-tabbed │ │ ├── preview-tui │ │ ├── pskill │ │ ├── renamer │ │ ├── ringtone │ │ ├── rsynccp │ │ ├── splitjoin │ │ ├── suedit │ │ ├── togglex │ │ ├── treeview │ │ ├── uidgid │ │ ├── umounttree │ │ ├── upgrade │ │ ├── upload │ │ ├── vidthumb │ │ ├── wall │ │ ├── wallpaper │ │ ├── x2sel │ │ └── xdgdefault ├── nvim │ ├── autoload │ │ └── plug.vim │ ├── colors │ │ ├── inkpot.vim │ │ ├── typofree.vim │ │ ├── wombat.vim │ │ └── zenburn.vim │ └── init.vim ├── picom.conf ├── pistol │ └── pistol.conf ├── ranger │ ├── colorschemes │ │ ├── __init__.py │ │ ├── __init__.pyo │ │ ├── rangy.py │ │ ├── rangy.pyo │ │ ├── zenburn.py │ │ └── zenburn.pyo │ ├── commands.py │ ├── commands_full.py │ ├── rc.conf │ ├── rifle.conf │ └── scope.sh └── zsh │ ├── 0_functions.zsh │ ├── alias.zsh │ ├── archive │ └── frameworks.zsh │ ├── cache │ └── .keep │ ├── completion.zsh │ ├── env.zsh │ ├── functions │ └── prompt_tuurlijk_setup │ ├── keybindings.zsh │ ├── style.zsh │ └── themes │ └── tuurlijk.zsh-theme ├── .dircolors ├── .ghc └── ghci.conf ├── .gitconfig ├── .github └── FUNDING.yml ├── .gitignore ├── .gitmodules ├── .gnuplot ├── .mc ├── Tree ├── ini └── panels.ini ├── .npmrc ├── .tmux.conf ├── .tmux └── airline ├── .vim ├── autoload │ └── plug.vim ├── colors │ ├── inkpot.vim │ ├── typofree.vim │ ├── wombat.vim │ └── zenburn.vim ├── doc │ └── tags ├── filetype.vim └── snippets │ └── extjs.snippets ├── .vimrc ├── .zimrc ├── .zlogin ├── .zlogout ├── .zprofile ├── .zshenv ├── .zshrc ├── Background ├── awesome-desktop-backgrounds-2.jpg ├── awesome-paint.jpg ├── bridge.jpg ├── dwm-mypattern.jpg ├── dwm-mypattern.light.jpg ├── dwm-mypattern.png ├── leaves.jpg ├── paardebloem.jpg ├── road.jpeg └── shroom.jpg ├── Icon └── terminal.svg ├── IntelliJ └── ColorScheme │ └── Tuurlijk.icls ├── README.md ├── Screenshots └── Dotfiles.png ├── bin ├── fzf-preview.sh ├── kittyMode.sh └── tmux-launch.sh └── setup.sh /.Xdefaults: -------------------------------------------------------------------------------- 1 | !! Reload with: xrdb ~/.Xdefaults 2 | 3 | *foreground: #c0c0c0 4 | *foreground_bold: #a8a19f 5 | *cursor: #a8a19f 6 | *background: #1b1918 7 | 8 | URxvt.depth: 32 9 | URxvt.fading: 0 10 | URxvt.loginShell: true 11 | URxvt.saveLines: 10000 12 | URxvt.internalBorder: 2 13 | URxvt.lineSpace: 0 14 | URxvt.letterSpace: -1 15 | 16 | !! Appearance 17 | ! fc-list 18 | ! URxvt.font: xft:Hack:size=10 19 | ! URxvt.boldFont: xft:Hack:weight=bold:size=10 20 | ! URxvt.italicFont: xft:Hack:slant=italic:size=10 21 | ! URxvt.boldItalicFont: xft:Hack:weight=bold:slant=italic:size=10 22 | 23 | URxvt.font: xft:Hack:size=10,xft:DejaVuSansMonoForPowerline Nerd Font:size=10,xft:Twitter Color Emoji:size=10 24 | URxvt.boldFont: xft:Hack:weight=bold:size=10,xft:DejaVuSansMonoForPowerline Nerd Font:weight=bold:size=10,xft:Twitter Color Emoji:size=10 25 | URxvt.italicFont: xft:Hack:slant=italic:size=10,xft:DejaVuSansMonoForPowerline Nerd Font:slant=italic:size=10,xft:Twitter Color Emoji:size=10 26 | URxvt.boldItalicFont: xft:Hack:weight=bold:slant=italic:size=10,xft:DejaVuSansMonoForPowerline Nerd Font:weight=bold:slant=italic:size=10,xft:Twitter Color Emoji:size=10 27 | 28 | ! URxvt.font: xft:Hack:size=10:antialias=true:hinting=true,xft:Symbola,xft:UbuntuMonoDerivativePowerline Nerd Font 29 | ! URxvt.boldFont: xft:Hack:style=Bold:size=10:antialias=true:hinting=true,xft:DejaVu Sans Mono:size=12,xft:FontAwesome:size=12 30 | ! URxvt.italicFont: xft:Hack:style=Italic:size=10:antialias=true:hinting=true,xft:DejaVu Sans Mono:size=12,xft:FontAwesome:size=12 31 | ! URxvt.boldItalicFont: xft:Hack:style=Bold Italic:size=10:antialias=true:hinting=true,xft:DejaVu Sans Mono:size=12,xft:FontAwesome:size=12 32 | 33 | URxvt.iconFile: /home/michiel/dotfiles/Icon/terminal.svg 34 | 35 | URxvt.background: [90]#000000 36 | URxvt.borderColor: [90]#000000 37 | URxvt.scrollBar: false 38 | URxvt.cursorBlink: false 39 | URxvt.cursorColor: #af5f00 40 | URxvt.cursorUnderline: false 41 | 42 | !URxvt.geometry: 166x56 43 | !URxvt*backgroundPixmap: /home/michiel/dotfiles/Background/dwm-mypattern.png;style=tiled 44 | URxvt*.transparent: true 45 | !URxvt*.shading: 25 46 | !URxvt*.blurRadius: 50 47 | 48 | !! Behavior 49 | URxvt*scrollTtyOutput: false 50 | URxvt*scrollTtyKeypress: true 51 | 52 | !! Keybinding 53 | URxvt.keysym.C-Up: perl:font-size:increase 54 | URxvt.keysym.C-Down: perl:font-size:decrease 55 | URxvt.keysym.C-S-Up: perl:font-size:incglobal 56 | URxvt.keysym.C-S-Down: perl:font-size:decglobal 57 | 58 | !Home and End keys to jump to the beginning and end of lines 59 | URxvt*keysym.Home: \033[1~ 60 | URxvt*keysym.End: \033[4~ 61 | 62 | !! Disable the stupid ctrl+shift 'feature' 63 | URxvt.iso14755: false 64 | URxvt.iso14755_52: false 65 | 66 | !! Common Keybinds for Navigations 67 | !! https://addy-dclxvi.github.io/post/configuring-urxvt/ 68 | URxvt.keysym.Shift-Up: command:\033]720;1\007 69 | URxvt.keysym.Shift-Down: command:\033]721;1\007 70 | 71 | !! Misc 72 | !! delimiters for double-click selection 73 | URxvt*cutchars: BACKSLASH '"'&()*,;<=>?@[]^{|} 74 | URxvt*urgentOnBell: true 75 | 76 | !! Xft settings 77 | Xft.autohint: 0 78 | Xft.dpi: 96 79 | Xft.antialias: true 80 | Xft.rgba: rgb 81 | Xft.hinting: true 82 | Xft.hintstyle: hintfull 83 | Xft.lcdfilter: lcddefault 84 | 85 | !! Extensions 86 | URxvt.perl-ext-common: default,clipboard,matcher,keyboard-select,font-size 87 | URxvt.colorUL: #4682B4 88 | !! Matcher 89 | URxvt.url-launcher: firefox 90 | URxvt.matcher.button: 1 91 | 92 | !! Clipboard 93 | URxvt.copyCommand: xclip -i -selection clipboard 94 | URxvt.pasteCommand: xclip -o -selection clipboard 95 | URxvt.keysym.M-c: perl:clipboard:copy 96 | URxvt.keysym.M-v: perl:clipboard:paste 97 | URxvt.keysym.M-Escape: perl:keyboard-select:activate 98 | URxvt.keysym.M-C-v: perl:clipboard:paste_escaped 99 | URxvt.keysym.M-s: perl:keyboard-select:search 100 | URxvt.keysym.M-u: perl:url-select:select_next 101 | 102 | rofi.color-enabled: true 103 | rofi.color-window: #000, #000, #000 104 | rofi.color-normal: #111, #819396, #222, #008ed4, #ffffff 105 | rofi.color-active: #002b37, #008ed4, #003643, #008ed4, #66c6ff 106 | rofi.color-urgent: #002b37, #da4281, #003643, #008ed4, #890661 107 | 108 | rofi.fake-transparency: true 109 | rofi.lines: 3 110 | rofi.bw: 0 111 | rofi.opacity: "20" 112 | rofi.hide-scrollbar: true 113 | rofi.width: 30 114 | 115 | !! black dark/light 116 | *color0: #2E3436 117 | *color8: #5c5c5c 118 | 119 | !! red dark/light 120 | *color1: #cc0000 121 | *color9: #cb4b16 122 | 123 | !! green dark/light 124 | *color2: #008700 125 | *color10: #3eb53e 126 | 127 | !! yellow dark/light 128 | *color3: #ffaf5f 129 | *color11: #fdd68a 130 | 131 | !! blue dark/light 132 | *color4: #3465A4 133 | *color12: #729FCF 134 | 135 | !! magenta dark/light 136 | *color5: #75507B 137 | *color13: #bd91b3 138 | 139 | !! cyan dark/light 140 | *color6: #009aa0 141 | *color14: #8bb7b3 142 | 143 | !! white dark/light 144 | *color7: #FDFFFB 145 | *color15: #fffffd 146 | -------------------------------------------------------------------------------- /.bashrc: -------------------------------------------------------------------------------- 1 | export EDITOR='vim' 2 | if [ `uname` = Darwin ] && [ `which brew` ]; then 3 | export BYOBU_PREFIX=`brew --prefix` 4 | fi 5 | 6 | #[[ -s $HOME/.tmuxinator/scripts/tmuxinator ]] && source $HOME/.tmuxinator/scripts/tmuxinator 7 | 8 | PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting 9 | 10 | #function _update_ps1() { 11 | # export PS1="$(~/powerline-shell.py $?)" 12 | #} 13 | 14 | #alias tmux="TERM=screen-256color-bce tmux" 15 | 16 | if [[ -r ~/.credentials ]]; then 17 | source ~/.credentials 18 | fi 19 | 20 | # export PROMPT_COMMAND="_update_ps1" 21 | -------------------------------------------------------------------------------- /.config/awesome/autostart.lua: -------------------------------------------------------------------------------- 1 | local ipairs, string = ipairs, string 2 | local awful = require("awful") 3 | 4 | -- Autostart windowless processes 5 | local function run_once(cmd_arr) 6 | for _, cmd in ipairs(cmd_arr) do 7 | findme = cmd 8 | firstspace = cmd:find(" ") 9 | if firstspace then 10 | findme = cmd:sub(0, firstspace - 1) 11 | end 12 | awful.spawn.with_shell(string.format("pgrep -u $USER -x %s > /dev/null || (%s)", findme, cmd)) 13 | end 14 | end 15 | 16 | -- entries must be comma-separated 17 | run_once({ 18 | "/usr/lib/gsd-xsettings", 19 | "dex -a -e awesome", 20 | 21 | "synapse -s", 22 | "udiskie", 23 | "picom -b", 24 | "autorandr -c", 25 | 26 | "setxkbmap -layout us", 27 | 28 | -- Switch Wacom pen buttons; click button is secondary 29 | --"xinput set-prop 'Wacom Intuos PT M Pen stylus' 293 1572865", 30 | --"xinput set-prop 'Wacom Intuos PT M Pen stylus' 294 1572867", 31 | 32 | "xinput set-prop 'Synaptics TM3418-002' 'libinput Tapping Enabled' 1", 33 | "xinput set-prop 'Synaptics TM3418-002' 'libinput Natural Scrolling Enabled' 1", 34 | "xinput set-prop 'Synaptics TM3418-002' 'libinput Disable While Typing Enabled' 1", 35 | }) 36 | run_once({ "nm-applet -sm-disable" }) -- Network manager tray icon 37 | -------------------------------------------------------------------------------- /.config/awesome/awful/hotkeys_popup/keys/tmux.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/awful/hotkeys_popup/keys/tmux.lua -------------------------------------------------------------------------------- /.config/awesome/errorHandling.lua: -------------------------------------------------------------------------------- 1 | local naughty = require("naughty") 2 | -- Check if awesome encountered an error during startup and fell back to 3 | -- another config (This code will only ever execute for the fallback config) 4 | naughty.connect_signal("request::display_error", function(message, startup) 5 | naughty.notification { 6 | urgency = "critical", 7 | title = "Oops, an error happened"..(startup and " during startup!" or "!"), 8 | message = message 9 | } 10 | end) -------------------------------------------------------------------------------- /.config/awesome/rules.lua: -------------------------------------------------------------------------------- 1 | local awful = require("awful") 2 | -- Theme handling library 3 | local beautiful = require("beautiful") 4 | 5 | local keys = require("keys") 6 | local ruled = require("ruled") 7 | 8 | 9 | -- Rules to apply to new clients. 10 | ruled.client.connect_signal("request::rules", function() 11 | -- All clients will match this rule. 12 | ruled.client.append_rule { 13 | id = "global", 14 | rule = { }, 15 | properties = { 16 | border_width = beautiful.border_width, 17 | border_color = beautiful.border_normal, 18 | focus = awful.client.focus.filter, 19 | raise = true, 20 | keys = keys.clientkeys, 21 | buttons = clientButtons, 22 | screen = awful.screen.preferred, 23 | placement = awful.placement.no_overlap + awful.placement.no_offscreen 24 | } 25 | } 26 | 27 | -- Floating clients. 28 | ruled.client.append_rule { 29 | id = "floating", 30 | rule_any = { 31 | instance = { "copyq", "pinentry" }, 32 | class = { 33 | "Arandr", "Blueman-manager", "Gpick", "Kruler", "Sxiv", 34 | "Tor Browser", "Wpa_gui", "veromix", "xtightvncviewer" 35 | }, 36 | -- Note that the name property shown in xprop might be set slightly after creation of the client 37 | -- and the name shown there might not match defined rules here. 38 | name = { 39 | "Event Tester", -- xev. 40 | }, 41 | role = { 42 | "AlarmWindow", -- Thunderbird's calendar. 43 | "ConfigManager", -- Thunderbird's about:config. 44 | "pop-up", -- e.g. Google Chrome's (detached) Developer Tools. 45 | } 46 | }, 47 | properties = { floating = true, no_borders } 48 | } 49 | 50 | -- PhpStrorm 51 | ruled.client.append_rule { 52 | id = "phpstorm", 53 | rule_any = { 54 | class = "jetbrains-phpstorm" 55 | }, 56 | properties = { 57 | floating = false, 58 | type = "normal" 59 | } 60 | } 61 | 62 | -- Add titlebars to normal clients and dialogs 63 | ruled.client.append_rule { 64 | id = "titlebars", 65 | rule_any = { type = { "normal", "dialog" } }, 66 | properties = { titlebars_enabled = true } 67 | } 68 | 69 | -- Remove borders from clients 70 | ruled.client.append_rule { 71 | id = "no_borders", 72 | rule_any = { class = { "Synapse" } }, 73 | properties = { no_borders } 74 | } 75 | 76 | -- Set Firefox to always map on the tag named "2" on screen 1. 77 | -- ruled.client.append_rule { 78 | -- rule = { class = "Firefox" }, 79 | -- properties = { screen = 1, tag = "2" } 80 | -- } 81 | 82 | end) 83 | -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/ac.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/ac.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/awesome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/awesome.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/awesome2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/awesome2.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/bat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/bat.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/bat_low.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/bat_low.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/bat_no.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/bat_no.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/centerfair.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/centerfair.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/centerwork.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/centerwork.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/disk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/disk.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/dwindle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/dwindle.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/fairh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/fairh.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/fairv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/fairv.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/floating.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/floating.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/fullscreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/fullscreen.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/magnifier.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/magnifier.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/max.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/max.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/pause.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/play.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/spiral.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/spiral.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/square_sel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/square_sel.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/square_unsel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/square_unsel.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/submenu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/submenu.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/termfair.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/termfair.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/tile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/tile.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/tilebottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/tilebottom.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/tileleft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/tileleft.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/tiletop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/tiletop.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/titlebar/close_focus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/titlebar/close_focus.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/titlebar/close_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/titlebar/close_normal.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/titlebar/dots.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ruby 2 | # -*- mode: ruby -*- 3 | # vi: set ft=ruby : 4 | 5 | require 'yaml' 6 | 7 | path = "#{File.dirname(__FILE__)}" 8 | 9 | configuration = {} 10 | if File.exist?(path + '/dots.yml') 11 | configuration = YAML::load(File.read(path + '/dots.yml')) || {} 12 | end 13 | 14 | def hasOptipng 15 | return system('optipng -v > /dev/null') 16 | end 17 | 18 | def drawCircle(dot, defaults) 19 | translate = (defaults['canvasSize'] / 2).to_s 20 | edge = defaults['canvasSize'].to_s 21 | strokeWidth = dot['strokeWidth'] || defaults['strokeWidth'] 22 | radius = dot['radius'] || defaults['radius'] 23 | 24 | # Generate base image 25 | system("convert -size " + edge + "x" + edge + " xc:none \ 26 | -stroke '#" + dot['stroke'] + "' \ 27 | -fill '#" + dot['fill'] + "' \ 28 | -strokewidth " + strokeWidth.to_s + " \ 29 | -draw 'translate " + translate + "," + translate + " circle 0,0 " + radius.to_s + ",0' \ 30 | " + dot['name'] + ".png") 31 | 32 | # Compress image 33 | if hasOptipng 34 | system('optipng -o7 ' + dot['name'] + '.png') 35 | end 36 | 37 | # Copy image to its filenames 38 | dot['filenames'].each do |name| 39 | system('cp ' + dot['name'] + '.png ' + name) 40 | end 41 | 42 | # Remove base image 43 | system('unlink ' + dot['name'] + '.png ') 44 | end 45 | 46 | configuration['dots'].each do |dot| 47 | drawCircle(dot, configuration['defaults']) 48 | end 49 | 50 | -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/titlebar/dots.yml: -------------------------------------------------------------------------------- 1 | --- 2 | defaults: 3 | strokeWidth: 4 4 | radius: 20 5 | canvasSize: 100 6 | dots: 7 | - name: float 8 | type: circle 9 | stroke: 1940ff 10 | fill: 4180ff 11 | filenames: 12 | - floating_focus_active.png 13 | - name: minimize 14 | type: circle 15 | stroke: ffa510 16 | fill: ffd42cff 17 | filenames: 18 | - minimize_focus.png 19 | - name: maximise 20 | type: circle 21 | stroke: 0dbc00ff 22 | fill: 05d60bff 23 | filenames: 24 | - maximized_focus_active.png 25 | - maximized_focus_inactive.png 26 | - name: close 27 | type: circle 28 | stroke: eb2005ff 29 | fill: cc0900ff 30 | filenames: 31 | - close_focus.png 32 | - name: ontop 33 | type: circle 34 | stroke: d8d8d8ff 35 | fill: eff5ffff 36 | filenames: 37 | - ontop_focus_active.png 38 | - name: sticky 39 | type: circle 40 | stroke: ff2cf3ff 41 | fill: bf11ffff 42 | filenames: 43 | - sticky_focus_active.png 44 | - name: inactive 45 | type: circle 46 | stroke: 767676ff 47 | fill: 575757ff 48 | filenames: 49 | - close_normal.png 50 | - floating_focus_inactive.png 51 | - floating_normal_active.png 52 | - floating_normal_inactive.png 53 | - maximized_normal_active.png 54 | - maximized_normal_inactive.png 55 | - minimize_normal.png 56 | - ontop_focus_inactive.png 57 | - ontop_normal_active.png 58 | - ontop_normal_inactive.png 59 | - sticky_focus_inactive.png 60 | - sticky_normal_active.png 61 | - sticky_normal_inactive.png 62 | 63 | -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/titlebar/floating_focus_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/titlebar/floating_focus_active.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/titlebar/floating_focus_inactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/titlebar/floating_focus_inactive.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/titlebar/floating_normal_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/titlebar/floating_normal_active.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/titlebar/floating_normal_inactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/titlebar/floating_normal_inactive.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/titlebar/maximized_focus_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/titlebar/maximized_focus_active.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/titlebar/maximized_focus_inactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/titlebar/maximized_focus_inactive.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/titlebar/maximized_normal_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/titlebar/maximized_normal_active.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/titlebar/maximized_normal_inactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/titlebar/maximized_normal_inactive.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/titlebar/minimize_focus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/titlebar/minimize_focus.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/titlebar/minimize_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/titlebar/minimize_normal.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/titlebar/ontop_focus_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/titlebar/ontop_focus_active.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/titlebar/ontop_focus_inactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/titlebar/ontop_focus_inactive.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/titlebar/ontop_normal_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/titlebar/ontop_normal_active.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/titlebar/ontop_normal_inactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/titlebar/ontop_normal_inactive.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/titlebar/squares.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ruby 2 | # -*- mode: ruby -*- 3 | # vi: set ft=ruby : 4 | 5 | require 'yaml' 6 | 7 | path = "#{File.dirname(__FILE__)}" 8 | 9 | configuration = {} 10 | if File.exist?(path + '/squares.yml') 11 | configuration = YAML::load(File.read(path + '/squares.yml')) || {} 12 | end 13 | 14 | def hasOptipng 15 | return system('optipng -v > /dev/null') 16 | end 17 | 18 | def drawCircle(dot, defaults) 19 | canvasEdge = defaults['canvasSize'].to_s 20 | strokeWidth = dot['strokeWidth'] || defaults['strokeWidth'] 21 | edge = dot['edge'] || defaults['edge'] 22 | translate = ((canvasEdge.to_i - edge.to_i) / 2).to_s 23 | 24 | # Generate base image 25 | puts("convert -size " + canvasEdge + "x" + canvasEdge + " xc:none \ 26 | -stroke '#" + dot['stroke'] + "' \ 27 | -fill '#" + dot['fill'] + "' \ 28 | -strokewidth " + strokeWidth.to_s + " \ 29 | -draw 'translate " + translate + "," + translate + " rectangle 0,0 " + edge.to_s + "," + edge.to_s + "' \ 30 | " + dot['name'] + ".png") 31 | system("convert -size " + canvasEdge + "x" + canvasEdge + " xc:none \ 32 | -stroke '#" + dot['stroke'] + "' \ 33 | -fill '#" + dot['fill'] + "' \ 34 | -strokewidth " + strokeWidth.to_s + " \ 35 | -draw 'translate " + translate + "," + translate + " rectangle 0,0 " + edge.to_s + "," + edge.to_s + "' \ 36 | " + dot['name'] + ".png") 37 | 38 | # Compress image 39 | if hasOptipng 40 | system('optipng -o7 ' + dot['name'] + '.png') 41 | end 42 | 43 | # Copy image to its filenames 44 | dot['filenames'].each do |name| 45 | system('cp ' + dot['name'] + '.png ' + name) 46 | end 47 | 48 | # Remove base image 49 | system('unlink ' + dot['name'] + '.png ') 50 | end 51 | 52 | configuration['squares'].each do |dot| 53 | drawCircle(dot, configuration['defaults']) 54 | end 55 | 56 | -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/titlebar/squares.yml: -------------------------------------------------------------------------------- 1 | --- 2 | defaults: 3 | strokeWidth: 4 4 | edge: 50 5 | canvasSize: 100 6 | squares: 7 | - name: float 8 | stroke: 1940ff 9 | fill: 4180ff 10 | filenames: 11 | - floating_focus_active.png 12 | - name: minimize 13 | stroke: ffa510 14 | fill: ffd42cff 15 | filenames: 16 | - minimize_focus.png 17 | - name: maximise 18 | stroke: 0dbc00ff 19 | fill: 05d60bff 20 | filenames: 21 | - maximized_focus_active.png 22 | - maximized_focus_inactive.png 23 | - name: close 24 | stroke: eb2005ff 25 | fill: cc0900ff 26 | filenames: 27 | - close_focus.png 28 | - name: ontop 29 | stroke: d8d8d8ff 30 | fill: eff5ffff 31 | filenames: 32 | - ontop_focus_active.png 33 | - name: sticky 34 | stroke: ff2cf3ff 35 | fill: bf11ffff 36 | filenames: 37 | - sticky_focus_active.png 38 | - name: inactive 39 | stroke: 767676ff 40 | fill: 575757ff 41 | filenames: 42 | - close_normal.png 43 | - floating_focus_inactive.png 44 | - floating_normal_active.png 45 | - floating_normal_inactive.png 46 | - maximized_normal_active.png 47 | - maximized_normal_inactive.png 48 | - minimize_normal.png 49 | - ontop_focus_inactive.png 50 | - ontop_normal_active.png 51 | - ontop_normal_inactive.png 52 | - sticky_focus_inactive.png 53 | - sticky_normal_active.png 54 | - sticky_normal_inactive.png 55 | 56 | -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/titlebar/sticky_focus_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/titlebar/sticky_focus_active.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/titlebar/sticky_focus_inactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/titlebar/sticky_focus_inactive.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/titlebar/sticky_normal_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/titlebar/sticky_normal_active.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/titlebar/sticky_normal_inactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/titlebar/sticky_normal_inactive.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/titlebar/trance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/titlebar/trance.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/vol.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/vol.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/vol_low.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/vol_low.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/vol_mute.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/vol_mute.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/vol_no.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/vol_no.png -------------------------------------------------------------------------------- /.config/awesome/themes/macos-dark/icons/widget_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/awesome/themes/macos-dark/icons/widget_bg.png -------------------------------------------------------------------------------- /.config/awesome/widgets/battery.lua: -------------------------------------------------------------------------------- 1 | local awful = require("awful") 2 | local gears = require("gears") 3 | local wibox = require("wibox") 4 | local naughty = require("naughty") 5 | 6 | -- acpi sample outputs 7 | -- Battery 0: Discharging, 75%, 01:51:38 remaining 8 | -- Battery 0: Charging, 53%, 00:57:43 until charged 9 | 10 | local updateInterval = 30 11 | 12 | -- Popup with battery info 13 | -- One way of creating a pop-up notification - naughty.notify 14 | local notification 15 | local function showBatteryStatus() 16 | awful.spawn.easy_async( 17 | [[bash -c 'acpi']], 18 | function(stdout, _, _, _) 19 | notification = naughty.notify { 20 | icon = os.getenv("HOME") .. "/.config/awesome/themes/macos-dark/icons/bat.png", 21 | text = stdout, 22 | title = "Battery status", 23 | timeout = 5, 24 | hover_timeout = 0.5, 25 | width = 200, 26 | position = 'bottom_right', 27 | } 28 | end 29 | ) 30 | end 31 | 32 | local function showBatteryWarning() 33 | naughty.notify { 34 | icon = os.getenv("HOME") .. "/.config/awesome/themes/macos-dark/icons/bat.png", 35 | text = "Houston, we have a problem", 36 | title = "Battery is dying . . . give it some juice!", 37 | timeout = 15, 38 | hover_timeout = 0.5, 39 | position = "bottom_right", 40 | bg = "#F06060", 41 | fg = "#EEE9EF", 42 | } 43 | end 44 | 45 | local colors = { 46 | "#8f0000", 47 | "#bd7500", 48 | "#d4c600", 49 | "#568e00", 50 | "#008f00", 51 | "#008f00" 52 | } 53 | 54 | local textWidget = wibox.widget { 55 | markup = "", 56 | align = 'center', 57 | valign = 'center', 58 | widget = wibox.widget.textbox 59 | } 60 | 61 | local batteryWidget = wibox.widget { 62 | max_value = 100, 63 | thickness = 2, 64 | start_angle = math.pi + math.pi / 2, 65 | bg = gears.color("#c0c0c020"), 66 | widget = wibox.container.arcchart 67 | } 68 | 69 | local function showIcon() 70 | textWidget.markup = "" 71 | batteryWidget.widget = wibox.container.mirror( 72 | textWidget, 73 | { horizontal = true } 74 | ) 75 | end 76 | 77 | local function hideIcon() 78 | batteryWidget.widget = nul 79 | end 80 | 81 | local function setWarning() 82 | textWidget.markup = "" 83 | batteryWidget.widget = wibox.container.mirror( 84 | textWidget, 85 | { horizontal = true } 86 | ) 87 | end 88 | 89 | awful.widget.watch( 90 | "acpi", 91 | updateInterval, 92 | function(widget, stdout, stderr, exitreason, exitcode) 93 | local _, status, charge_str, time = string.match(stdout, '(.+): (%a+), (%d?%d?%d)%%,? ?.*') 94 | local charge = tonumber(charge_str) 95 | local stepSize = 100 / #colors 96 | local rangeIndex = math.floor(charge / stepSize) + 1 97 | widget.value = charge 98 | widget.colors = { colors[rangeIndex] } 99 | if rangeIndex > #colors then 100 | widget.colors = { colors[rangeIndex - 1] } 101 | end 102 | if status == 'Charging' then 103 | showIcon() 104 | else 105 | hideIcon() 106 | if (charge >= 0 and charge < 15) then 107 | setWarning() 108 | showBatteryWarning() 109 | end 110 | end 111 | 112 | end, 113 | batteryWidget 114 | ) 115 | 116 | batteryWidget:connect_signal("mouse::enter", function() 117 | showIcon() 118 | showBatteryStatus() 119 | end) 120 | batteryWidget:connect_signal("mouse::leave", function() 121 | naughty.destroy(notification) 122 | hideIcon() 123 | end) 124 | 125 | return wibox.container.margin( 126 | wibox.container.mirror( 127 | batteryWidget, 128 | { horizontal = true } 129 | ), 130 | 2, 131 | 2, 132 | 2, 133 | 2 134 | ) 135 | -------------------------------------------------------------------------------- /.config/awesome/widgets/cpu.lua: -------------------------------------------------------------------------------- 1 | ------------------------------------------------- 2 | -- CPU Widget for Awesome Window Manager 3 | -- Shows the current CPU utilization 4 | -- Based on: 5 | -- https://github.com/streetturtle/awesome-wm-widgets/tree/master/cpu-widget 6 | -- @author Pavel Makhov 7 | -- @copyright 2017 Pavel Makhov 8 | ------------------------------------------------- 9 | 10 | local awful = require("awful") 11 | local gears = require("gears") 12 | local wibox = require("wibox") 13 | 14 | local updateInterval = 2 15 | 16 | local colors = { 17 | "#008f00", 18 | "#008f00", 19 | "#568e00", 20 | "#d4c600", 21 | "#bd7500", 22 | "#8f0000", 23 | } 24 | 25 | -- mirror and push up a bit 26 | local cpuWidget = wibox.widget { 27 | max_value = 100, 28 | thickness = 2, 29 | start_angle = math.pi + math.pi / 2, 30 | bg = gears.color("#c0c0c020"), 31 | widget = wibox.container.arcchart 32 | } 33 | 34 | local function hideIcon() 35 | cpuWidget.widget = nul 36 | end 37 | 38 | local function showIcon() 39 | cpuWidget.widget = wibox.widget { 40 | markup = "", 41 | align = 'center', 42 | valign = 'center', 43 | widget = wibox.widget.textbox 44 | } 45 | end 46 | 47 | local total_prev = 0 48 | local idle_prev = 0 49 | 50 | awful.widget.watch( 51 | "cat /proc/stat | grep '^cpu '", 52 | updateInterval, 53 | function(widget, stdout, stderr, exitreason, exitcode) 54 | local user, nice, system, idle, iowait, irq, softirq, steal, guest, guest_nice = stdout:match('cpu%s+(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s') 55 | local total = user + nice + system + idle + iowait + irq + softirq + steal 56 | local diff_idle = idle - idle_prev 57 | local diff_total = total - total_prev 58 | local diff_usage = (1000 * (diff_total - diff_idle) / diff_total + 5) / 10 59 | local stepSize = 100 / #colors 60 | local rangeIndex = math.floor(diff_usage / stepSize) + 1 61 | widget.value = diff_usage 62 | widget.colors = { colors[rangeIndex] } 63 | if rangeIndex > #colors then 64 | widget.colors = { colors[rangeIndex - 1] } 65 | end 66 | 67 | total_prev = total 68 | idle_prev = idle 69 | end, 70 | cpuWidget 71 | ) 72 | 73 | local cpuWidgetTooltip = awful.tooltip({ 74 | objects = { cpuWidget }, 75 | 76 | timer_function = function() 77 | return "cpu" 78 | end, 79 | }) 80 | 81 | cpuWidget:connect_signal("mouse::enter", function() 82 | showIcon() 83 | end) 84 | cpuWidget:connect_signal("mouse::leave", function() 85 | hideIcon() 86 | end) 87 | 88 | return wibox.container.margin( 89 | wibox.container.mirror( 90 | cpuWidget, 91 | { horizontal = true } 92 | ), 93 | 2, 94 | 2, 95 | 2, 96 | 2 97 | ) 98 | -------------------------------------------------------------------------------- /.config/awesome/widgets/volume.lua: -------------------------------------------------------------------------------- 1 | ------------------------------------------------- 2 | -- Volume Widget for Awesome Window Manager 3 | -- Shows the current volume 4 | ------------------------------------------------- 5 | 6 | local awful = require("awful") 7 | local gears = require("gears") 8 | local wibox = require("wibox") 9 | 10 | local updateInterval = 2 11 | 12 | local colors = { 13 | "#008f00", 14 | } 15 | local colors_mute = { 16 | "#8f0000", 17 | } 18 | 19 | local volumeWidget = wibox.widget { 20 | max_value = 100, 21 | thickness = 2, 22 | start_angle = math.pi + math.pi / 2, 23 | bg = gears.color("#c0c0c020"), 24 | widget = wibox.container.arcchart 25 | } 26 | 27 | local function hideIcon() 28 | volumeWidget.widget = nul 29 | end 30 | 31 | local function showIcon() 32 | volumeWidget.widget = wibox.widget { 33 | markup = "", 34 | align = 'center', 35 | valign = 'center', 36 | widget = wibox.widget.textbox, 37 | buttons = awful.util.table.join( 38 | awful.button({}, 1, function() 39 | awful.spawn('pavucontrol') 40 | end), 41 | awful.button({ }, 5, function() 42 | awful.spawn("amixer -D pipewire sset Master 3%+") 43 | end), 44 | awful.button({ }, 4, function() 45 | awful.spawn("amixer -D pipewire sset Master 3%-") 46 | end) 47 | ) 48 | } 49 | end 50 | 51 | local lastVolume = 0 52 | local muted 53 | 54 | awful.widget.watch( 55 | "wpctl get-volume @DEFAULT_AUDIO_SINK@", 56 | updateInterval, 57 | function(widget, stdout, stderr, exitreason, exitcode) 58 | local volume = stdout:match('%d.(%d%d)') 59 | muted = stdout:match('(%[MUTED%])') 60 | local stepSize = 100 / #colors 61 | local rangeIndex = math.floor(volume / stepSize) + 1 62 | lastVolume = volume 63 | widget.value = volume 64 | 65 | if (muted ~= nil) then 66 | widget.colors = { colors_mute[1] } 67 | else 68 | widget.colors = { colors[rangeIndex] } 69 | end 70 | end, 71 | volumeWidget 72 | ) 73 | 74 | local volumeWidgetTooltip = awful.tooltip( 75 | { 76 | objects = { volumeWidget }, 77 | timer_function = function() 78 | if (muted ~= nil) then 79 | return "Volume: " .. lastVolume .. " - MUTED" 80 | else 81 | return "Volume: " .. lastVolume 82 | end 83 | end, 84 | }) 85 | 86 | volumeWidget:connect_signal("mouse::enter", function() 87 | showIcon() 88 | end) 89 | volumeWidget:connect_signal("mouse::leave", function() 90 | hideIcon() 91 | end) 92 | 93 | return wibox.container.margin( 94 | wibox.container.mirror( 95 | volumeWidget, 96 | { horizontal = true } 97 | ), 98 | 2, 99 | 2, 100 | 2, 101 | 2 102 | ) 103 | -------------------------------------------------------------------------------- /.config/compton.conf: -------------------------------------------------------------------------------- 1 | shadow = true; 2 | no-dnd-shadow = true; 3 | no-dock-shadow = true; 4 | clear-shadow = true; 5 | shadow-radius = 5; 6 | shadow-offset-x = -4; 7 | shadow-offset-y = -4; 8 | shadow-opacity = 0.7; 9 | shadow-exclude = [ 10 | "! name~=''", 11 | "name = 'Notification'", 12 | "name = 'Plank'", 13 | "name = 'Docky'", 14 | "name = 'Kupfer'", 15 | "name = 'xfce4-notifyd'", 16 | "name *= 'VLC'", 17 | "name *= 'compton'", 18 | "class_g = 'Conky'", 19 | "class_g = 'Kupfer'", 20 | "class_g = 'Synapse'", 21 | "class_g ?= 'Notify-osd'", 22 | "class_g ?= 'Cairo-dock'", 23 | "class_g ?= 'Xfce4-notifyd'", 24 | "class_g ?= 'Xfce4-power-manager'", 25 | "class_g = 'Subl3'", 26 | "_GTK_FRAME_EXTENTS@:c" 27 | ]; 28 | shadow-ignore-shaped = false; 29 | menu-opacity = 0.97; 30 | inactive-opacity = 1; 31 | active-opacity = 1; 32 | frame-opacity = 1; 33 | alpha-step = 0.06; 34 | opacity-rule = [ 35 | ]; 36 | blur-background = true 37 | blur-background-frame = false; 38 | fading = true; 39 | fade-delta = 2; 40 | fade-in-step = 0.03; 41 | fade-out-step = 0.03; 42 | backend = "glx"; 43 | mark-wmwin-focused = true; 44 | mark-ovredir-focused = true; 45 | detect-rounded-corners = true; 46 | detect-client-opacity = true; 47 | vsync = "opengl-swc"; 48 | dbe = false; 49 | paint-on-overlay = true; 50 | sw-opti = false; 51 | unredir-if-possible = true; 52 | detect-transient = true; 53 | detect-client-leader = true; 54 | invert-color-include = []; 55 | glx-no-stencil = true; 56 | glx-copy-from-front = false; 57 | glx-no-rebind-pixmap = true; 58 | wintypes: 59 | { 60 | menu: 61 | { 62 | fade = true; 63 | shadow = false; 64 | opacity = 0.9; 65 | focus = true; 66 | }; 67 | tooltip: 68 | { 69 | fade = true; 70 | shadow = false; 71 | opacity = 0.75; 72 | focus = true; 73 | }; 74 | popup_menu: 75 | { 76 | shadow = false; 77 | }; 78 | dropdown_menu: 79 | { 80 | shadow = false; 81 | }; 82 | }; 83 | focus-exclude = ["x = 400 && y = 350 && override_redirect = true", "x = 0 && y = 0 && override_redirect = true", "_NET_WM_NAME@:s = 'rofi'", "_NET_WM_NAME@:s = 'dmenu'"]; 84 | inactive-dim-fixed = true; 85 | no-fading-openclose = true; 86 | -------------------------------------------------------------------------------- /.config/i3/i3status.conf: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # ceerious i3 status config 3 | # see "man i3status" for documentation. 4 | # 5 | # It is important that this file is edited as UTF-8. 6 | # The following line should contain a sharp s: 7 | # ß 8 | # If the above line is not correctly displayed, fix your editor first! 9 | ############################################################################### 10 | 11 | general { 12 | interval = 5 13 | colors = true 14 | color_good = '#88b090' 15 | color_degraded = '#ccdc90' 16 | color_bad = '#e89393' 17 | } 18 | 19 | order += "volume master" 20 | order += "disk /" 21 | #order += "disk /home" 22 | #order += "run_watch DHCP" 23 | #order += "ipv6" 24 | #order += "run_watch VPN" 25 | order += "wireless wlp2s0" 26 | order += "ethernet enp0s31f6" 27 | order += "battery 0" 28 | order += "cpu_temperature 0" 29 | order += "cpu_usage 0" 30 | order += "load" 31 | order += "tztime local" 32 | 33 | wireless wlp2s0 { 34 | format_up = "%quality  %essid %ip" 35 | format_down = "" 36 | } 37 | 38 | ethernet enp0s31f6 { 39 | #if you use %speed, i3status requires root privileges 40 | format_up = "%ip (%speed)" 41 | format_down = "" 42 | } 43 | 44 | battery 0 { 45 | format = "%status %percentage %remaining" 46 | format_down = "" 47 | last_full_capacity = true 48 | integer_battery_capacity = true 49 | low_threshold = 11 50 | threshold_type = percentage 51 | hide_seconds = true 52 | status_chr = " " 53 | status_bat = " " 54 | status_full = " " 55 | } 56 | 57 | run_watch DHCP { 58 | pidfile = "/var/run/dhclient*.pid" 59 | } 60 | 61 | run_watch VPN { 62 | pidfile = "/var/run/vpnc/pid" 63 | } 64 | 65 | tztime local { 66 | format = "%V  %a %e %b '%y  %H:%M" 67 | } 68 | 69 | load { 70 | format = " %1min %5min" 71 | } 72 | 73 | cpu_usage { 74 | format = " %usage" 75 | } 76 | 77 | cpu_temperature 0 { 78 | format = " %degrees°C" 79 | } 80 | 81 | disk "/" { 82 | format = " %avail" 83 | prefix_type = custom 84 | low_threshold = 20 85 | threshold_type = percentage_avail 86 | } 87 | 88 | volume master { 89 | format = "%volume  " 90 | format_muted = " " 91 | device = "default" 92 | mixer = "Master" 93 | mixer_idx = 0 94 | } 95 | -------------------------------------------------------------------------------- /.config/i3/scripts/gnome-keyring.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/sh 2 | export $(gnome-keyring-daemon -s --components=gpg,pkcs11,secrets,ssh) 3 | -------------------------------------------------------------------------------- /.config/nnn/plugins/.cbcp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Copy selection to system clipboard as newline-separated entries 4 | # Dependencies: 5 | # - tr 6 | # - xclip/xsel (Linux) 7 | # - pbcopy (macOS) 8 | # - termux-clipboard-set (Termux) 9 | # - clip.exe (WSL) 10 | # - clip (Cygwin) 11 | # - wl-copy (Wayland) 12 | # - clipboard (Haiku) 13 | # 14 | # Limitation: breaks if a filename has newline in it 15 | # 16 | # Note: For a space-separated list: 17 | # xargs -0 < "$SELECTION" 18 | # 19 | # Shell: POSIX compliant 20 | # Author: Arun Prakash Jana 21 | 22 | IFS="$(printf '%b_' '\n')"; IFS="${IFS%_}" # protect trailing \n 23 | 24 | selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection} 25 | 26 | if type xsel >/dev/null 2>&1; then 27 | # Linux 28 | tr '\0' '\n' < "$selection" | xsel -bi 29 | elif type xclip >/dev/null 2>&1; then 30 | # Linux 31 | tr '\0' '\n' < "$selection" | xclip -sel clip 32 | elif type pbcopy >/dev/null 2>&1; then 33 | # macOS 34 | tr '\0' '\n' < "$selection" | pbcopy 35 | elif type termux-clipboard-set >/dev/null 2>&1; then 36 | # Termux 37 | tr '\0' '\n' < "$selection" | termux-clipboard-set 38 | elif type clip.exe >/dev/null 2>&1; then 39 | # WSL 40 | tr '\0' '\n' < "$selection" | clip.exe 41 | elif type clip >/dev/null 2>&1; then 42 | # Cygwin 43 | tr '\0' '\n' < "$selection" | clip 44 | elif type wl-copy >/dev/null 2>&1; then 45 | # Wayland 46 | tr '\0' '\n' < "$selection" | wl-copy 47 | elif type clipboard >/dev/null 2>&1; then 48 | # Haiku 49 | tr '\0' '\n' < "$selection" | clipboard --stdin 50 | fi 51 | -------------------------------------------------------------------------------- /.config/nnn/plugins/.nmv: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Description: An almost fully POSIX compliant batch file renamer 4 | # 5 | # Note: nnn auto-detects and invokes this plugin if available 6 | # Whitespace is used as delimiter for read. 7 | # The plugin doesn't support filenames with leading or trailing whitespace 8 | # To use NNN_LIST your shell must support readlink(1) 9 | # 10 | # Capabilities: 11 | # 1. Basic file rename 12 | # 2. Detects order change 13 | # 3. Can move files 14 | # 4. Can remove files 15 | # 5. Switch number pairs to swap filenames 16 | # 17 | # Shell: bash 18 | # Author: KlzXS 19 | 20 | EDITOR="${EDITOR:-vi}" 21 | TMPDIR="${TMPDIR:-/tmp}" 22 | INCLUDE_HIDDEN="${INCLUDE_HIDDEN:-0}" 23 | VERBOSE="${VERBOSE:-0}" 24 | RECURSIVE="${RECURSIVE:-0}" 25 | 26 | selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection} 27 | exit_status=0 28 | 29 | dst_file=$(mktemp "$TMPDIR/.nnnXXXXXX") 30 | 31 | if [ -s "$selection" ]; then 32 | printf "Rename 'c'urrent / 's'election? " 33 | read -r resp 34 | 35 | if ! [ "$resp" = "c" ] && ! [ "$resp" = "s" ]; then 36 | exit 1 37 | fi 38 | fi 39 | 40 | if [ "$resp" = "s" ]; then 41 | arr=$(tr '\0' '\n' < "$selection") 42 | else 43 | findcmd="find . ! -name ." 44 | 45 | if [ "$RECURSIVE" -eq 0 ]; then 46 | findcmd="$findcmd -prune" 47 | fi 48 | 49 | if [ "$INCLUDE_HIDDEN" -eq 0 ]; then 50 | findcmd="$findcmd ! -name \".*\"" 51 | fi 52 | 53 | if [ -z "$NNN_LIST" ]; then 54 | findcmd="$findcmd -print" 55 | else 56 | findcmd="$findcmd -printf "'"'"$NNN_LIST/%P\n"'"' 57 | fi 58 | 59 | arr=$(eval "$findcmd" | sort) 60 | fi 61 | 62 | lines=$(printf "%s\n" "$arr" | wc -l) 63 | width=${#lines} 64 | 65 | printf "%s" "$arr" | awk '{printf("%'"${width}"'d %s\n", NR, $0)}' > "$dst_file" 66 | 67 | items=("~") 68 | while IFS='' read -r line; do 69 | if [ -n "$NNN_LIST" ]; then 70 | line=$(readlink "$line" || printf "%s" "$line") 71 | fi 72 | 73 | items+=("$line"); 74 | done < <(printf "%s\n" "$arr") 75 | 76 | $EDITOR "$dst_file" 77 | 78 | while read -r num name; do 79 | if [ -z "$name" ]; then 80 | if [ -z "$num" ]; then 81 | continue 82 | fi 83 | 84 | printf "%s: unable to parse line, aborting\n" "$0" 85 | exit 1 86 | fi 87 | 88 | # check if $num is an integer 89 | if [ ! "$num" -eq "$num" ] 2> /dev/null; then 90 | printf "%s: unable to parse line, aborting\n" "$0" 91 | exit 1 92 | fi 93 | 94 | src=${items[$num]} 95 | 96 | if [ -z "$src" ]; then 97 | printf "%s: unknown item number %s\n" "$0" "$num" > /dev/stderr 98 | continue 99 | elif [ "$name" != "$src" ]; then 100 | if [ -z "$name" ]; then 101 | continue 102 | fi 103 | 104 | if [ ! -e "$src" ] && [ ! -L "$src" ]; then 105 | printf "%s: %s does not exit\n" "$0" "$src" > /dev/stderr 106 | 107 | unset "items[$num]" 108 | continue 109 | fi 110 | 111 | # handle swaps 112 | if [ -e "$name" ] || [ -L "$name" ]; then 113 | tmp="$name~" 114 | c=0 115 | 116 | while [ -e "$tmp" ] || [ -L "$tmp" ]; do 117 | c=$((c+1)) 118 | tmp="$tmp~$c" 119 | done 120 | 121 | if mv "$name" "$tmp"; then 122 | if [ "$VERBOSE" -ne 0 ]; then 123 | printf "'%s' -> '%s'\n" "$name" "$tmp" 124 | fi 125 | else 126 | printf "%s: failed to rename %s to %s: %s\n" "$0" "$name" "$tmp" "$!" > /dev/stderr 127 | exit_status=1 128 | fi 129 | 130 | for key in "${!items[@]}"; do 131 | if [ "${items[$key]}" = "$name" ]; then 132 | items[$key]="$tmp" 133 | fi 134 | done 135 | fi 136 | 137 | dir=$(dirname "$name") 138 | if [ ! -d "$dir" ] && ! mkdir -p "$dir"; then 139 | printf "%s: failed to create directory tree %s\n" "$0" "$dir" > /dev/stderr 140 | exit_status=1 141 | elif ! mv -i "$src" "$name"; then 142 | printf "%s: failed to rename %s to %s: %s\n" "$0" "$name" "$tmp" "$!" > /dev/stderr 143 | exit_status=1 144 | else 145 | if [ -d "$name" ]; then 146 | for key in "${!items[@]}"; do 147 | items[$key]=$(printf "%s" "${items[$key]}" | sed "s|^$src\(\$\|\/\)|$name\1|") 148 | done 149 | 150 | if [ "$VERBOSE" -ne 0 ]; then 151 | printf "'%s' => '%s'\n" "$src" "$name" 152 | fi 153 | else 154 | true 155 | if [ "$VERBOSE" -ne 0 ]; then 156 | printf "'%s' -> '%s'\n" "$src" "$name" 157 | fi 158 | fi 159 | fi 160 | fi 161 | 162 | unset "items[$num]" 163 | done <"$dst_file" 164 | 165 | unset "items[0]" 166 | for item in "${items[@]}"; do 167 | rm -ri "$item" 168 | done 169 | 170 | rm "$dst_file" 171 | exit $exit_status 172 | -------------------------------------------------------------------------------- /.config/nnn/plugins/.nnn-plugin-helper: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Helper script for plugins 4 | # 5 | # Shell: POSIX compliant 6 | # Author: Anna Arad 7 | 8 | selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection} 9 | export selection 10 | 11 | ## Set CUR_CTX to 1 to open directory in current context 12 | CUR_CTX=0 13 | export CUR_CTX 14 | 15 | ## Ask nnn to switch to directory $1 in context $2. 16 | ## If $2 is not provided, the function asks explicitly. 17 | nnn_cd () { 18 | dir="$1" 19 | 20 | if [ -z "$NNN_PIPE" ]; then 21 | echo "No pipe file found" 1>&2 22 | return 23 | fi 24 | 25 | if [ -n "$2" ]; then 26 | context=$2 27 | elif [ $CUR_CTX -ne 1 ]; then 28 | printf "Choose context 1-4 (blank for current): " 29 | read -r context 30 | fi 31 | 32 | printf "%s" "${context:-0}c$dir" > "$NNN_PIPE" 33 | } 34 | 35 | cmd_exists () { 36 | type "$1" > /dev/null 2>&1 37 | echo $? 38 | } 39 | -------------------------------------------------------------------------------- /.config/nnn/plugins/.ntfy: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Show a notification 4 | # 5 | # Details: nnn invokes this plugin to show notification when a cp/mv/rm operation is complete. 6 | # 7 | # Dependencies: notify-send (Ubuntu)/ntfy (https://github.com/dschep/ntfy)/osascript (macOS)/notify (Haiku) 8 | # 9 | # Shell: POSIX compliant 10 | # Author: Anna Arad 11 | 12 | OS="$(uname)" 13 | 14 | if type notify-send >/dev/null 2>&1; then 15 | notify-send nnn "Done!" 16 | elif [ "$OS" = "Darwin" ]; then 17 | osascript -e 'display notification "Done!" with title "nnn"' 18 | elif type ntfy >/dev/null 2>&1; then 19 | ntfy -t nnn send "Done!" 20 | elif [ "$OS" = "Haiku" ]; then 21 | notify --title "nnn" "Done!" 22 | fi 23 | -------------------------------------------------------------------------------- /.config/nnn/plugins/autojump: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Navigate to directory using jump/autojump/zoxide/z 4 | # 5 | # Dependencies: 6 | # - jump - https://github.com/gsamokovarov/jump 7 | # - OR autojump - https://github.com/wting/autojump 8 | # - OR zoxide - https://github.com/ajeetdsouza/zoxide 9 | # - OR z - https://github.com/rupa/z (z requires fzf) 10 | # - OR z (fish) - https://github.com/jethrokuan/z (z requires fzf) 11 | # 12 | # Note: The dependencies STORE NAVIGATION PATTERNS 13 | # 14 | # Shell: POSIX compliant 15 | # Authors: Marty Buchaus, Dave Snider, Tim Adler, Nick Waywood 16 | 17 | if [ ! -p "$NNN_PIPE" ]; then 18 | printf 'ERROR: NNN_PIPE is not set!' 19 | read -r _ 20 | exit 2 21 | fi 22 | 23 | if type jump >/dev/null 2>&1; then 24 | printf "jump to : " 25 | IFS= read -r line 26 | # shellcheck disable=SC2086 27 | odir="$(jump cd ${line})" 28 | printf "%s" "0c$odir" > "$NNN_PIPE" 29 | elif type autojump >/dev/null 2>&1; then 30 | printf "jump to : " 31 | read -r dir 32 | odir="$(autojump "$dir")" 33 | printf "%s" "0c$odir" > "$NNN_PIPE" 34 | elif type zoxide >/dev/null 2>&1; then 35 | if type fzf >/dev/null 2>&1; then 36 | odir="$(zoxide query -i --)" 37 | printf "%s" "0c$odir" > "$NNN_PIPE" 38 | else 39 | printf "jump to : " 40 | read -r dir 41 | odir="$(zoxide query -- "$dir")" 42 | printf "%s" "0c$odir" > "$NNN_PIPE" 43 | fi 44 | else 45 | # rupa/z uses $_Z_DATA, jethrokuan/z (=port of z for fish) uses $Z_DATA 46 | datafile="${_Z_DATA:-${Z_DATA:-$HOME/.z}}" 47 | if type fzf >/dev/null 2>&1 && [ -f "$datafile" ]; then 48 | # Read the data from z's file instead of calling 49 | # z so the data doesn't need to be processed twice 50 | sel=$(awk -F "|" '{print $1}' "$datafile" | fzf | awk '{$1=$1};1') 51 | 52 | # NOTE: Uncomment this line and comment out the line above if 53 | # you want to see the weightings of the dir's in the fzf pane 54 | # sel=$(awk -F "|" '{printf "%s %s\n", $2, $1}' "$datafile" | fzf | sed 's/^[0-9,.]* *//' | awk '{$1=$1};1') 55 | 56 | printf "%s" "0c$sel" > "$NNN_PIPE" 57 | else 58 | printf "No supported autojump script [jump/autojump/zoxide/z (needs fzf)] found" 59 | read -r _ 60 | fi 61 | fi 62 | -------------------------------------------------------------------------------- /.config/nnn/plugins/bookmarks: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Use named bookmarks using symlinks 4 | # 5 | # Dependencies: fzf 6 | # 7 | # Usage: 8 | # 1. Create a $BOOKMARKS_DIR directory 9 | # By default, $BOOKMARKS_DIR is set to: ${XDG_CACHE_HOME:-$HOME/.cache}/nnn/bookmarks 10 | # 11 | # 2. Create symlinks to directories 12 | # `cd $BOOKMARKS_DIR` 13 | # `ln -s /path/to/useful/directory bookmark_name` 14 | # `ln -s $XDG_CONFIG_HOME/nnn/plugins nnn_plugins" 15 | # `ln -s /path/to/documents docs` 16 | # `ln -s /path/to/media media` 17 | # `ln -s /path/to/movies movies` 18 | # 19 | # Bonus tip: Add `$BOOKMARKS_DIR` to your `$CDPATH` 20 | # https://linux.101hacks.com/cd-command/cdpath/ 21 | # 22 | # TODO: 23 | # 1. Remove `fzf` dependency 24 | # 25 | # Shell: POSIX compliant 26 | # Author: Todd Yamakawa 27 | 28 | if [ -z "$BOOKMARKS_DIR" ]; then 29 | BOOKMARKS_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/nnn/bookmarks" 30 | fi 31 | 32 | # Check if NNN_PIPE is set 33 | if [ -z "$NNN_PIPE" ]; then 34 | echo 'ERROR: NNN_PIPE is not set' | ${PAGER:-less} 35 | exit 2 36 | fi 37 | 38 | # Get all directory symlinks 39 | get_links() { 40 | for entry in "$1"/*; do 41 | 42 | # Skip unless directory symlink 43 | [ -h "$entry" ] || continue 44 | [ -d "$entry" ] || continue 45 | 46 | printf "%20s -> %s\n" "$(basename "$entry")" "$(readlink -f "$entry")" 47 | done | fzf | 48 | awk 'END { 49 | if (length($1) == 0) { print "'"$PWD"'" } 50 | else { print "'"$BOOKMARKS_DIR"'/"$1 } 51 | }' 52 | } 53 | 54 | # Choose symlink with fzf 55 | cddir="$(get_links "$BOOKMARKS_DIR")" 56 | 57 | # Writing result to NNN_PIPE will change nnn's active directory 58 | # https://github.com/jarun/nnn/tree/master/plugins#send-data-to-nnn 59 | context=0 60 | printf "%s" "${context}c$(readlink -f "$cddir")" > "$NNN_PIPE" 61 | 62 | -------------------------------------------------------------------------------- /.config/nnn/plugins/boom: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Play random music (MP3, FLAC, M4A, WEBM, WMA) from current dir. 4 | # 5 | # Dependencies: mocp (or custom) 6 | # 7 | # Note: You may want to set GUIPLAYER. 8 | # 9 | # Shell: POSIX compliant 10 | # Author: Arun Prakash Jana 11 | 12 | GUIPLAYER="${GUIPLAYER}" 13 | NUMTRACKS="${NUMTRACKS:-100}" 14 | 15 | if [ -n "$GUIPLAYER" ]; then 16 | find . -type f \( -iname "*.mp3" -o -iname "*.flac" -o -iname "*.m4a" -o -iname "*.webm" -o -iname "*.wma" \) | shuf -n "$NUMTRACKS" | xargs -d "\n" "$GUIPLAYER" > /dev/null 2>&1 & 17 | 18 | # detach the player 19 | sleep 1 20 | elif type mocp >/dev/null 2>&1; then 21 | cmd=$(pgrep -x mocp 2>/dev/null) 22 | ret=$cmd 23 | 24 | if [ -z "$ret" ]; then 25 | # start MOC server 26 | mocp -S 27 | mocp -o shuffle 28 | else 29 | # mocp running, check if it's playing 30 | state=$(mocp -i | grep "State:" | cut -d' ' -f2) 31 | if [ "$state" = 'PLAY' ]; then 32 | # add up to 100 random audio files 33 | find . -type f \( -iname "*.mp3" -o -iname "*.flac" -o -iname "*.m4a" -o -iname "*.webm" -o -iname "*.wma" \) | head -n "$NUMTRACKS" | xargs -d "\n" mocp -a 34 | exit 35 | fi 36 | fi 37 | 38 | # clear MOC playlist 39 | mocp -c 40 | mocp -o shuffle 41 | 42 | # add up to 100 random audio files 43 | find . -type f \( -iname "*.mp3" -o -iname "*.flac" -o -iname "*.m4a" -o -iname "*.webm" -o -iname "*.wma" \) | head -n "$NUMTRACKS" | xargs -d "\n" mocp -a 44 | 45 | # start playing 46 | mocp -p 47 | else 48 | printf "moc missing" 49 | read -r _ 50 | fi 51 | -------------------------------------------------------------------------------- /.config/nnn/plugins/bulknew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Allows for creation of multiple files/dirs simultaneously 4 | # Creates a tmp file to write each entry in a separate line 5 | # 6 | # Note: Only relative paths are supported. Absolute paths are ignored 7 | # Leading and trailing whitespace in path names is also ignored 8 | # 9 | # Shell: POSIX compliant 10 | # Author: KlzXS 11 | 12 | EDITOR="${EDITOR:-vi}" 13 | TMPDIR="${TMPDIR:-/tmp}" 14 | 15 | printf "'f'ile / 'd'ir? " 16 | read -r resp 17 | 18 | if [ "$resp" = "f" ]; then 19 | #shellcheck disable=SC2016 20 | cmd='mkdir -p "$(dirname "{}")" && touch "{}"' 21 | elif [ "$resp" = "d" ]; then 22 | cmd='mkdir -p {}' 23 | else 24 | exit 1 25 | fi 26 | 27 | tmpfile=$(mktemp "$TMPDIR/.nnnXXXXXX") 28 | $EDITOR "$tmpfile" 29 | 30 | sed "/^\//d" "$tmpfile" | xargs -n1 -I{} sh -c "$cmd" 31 | 32 | rm "$tmpfile" 33 | -------------------------------------------------------------------------------- /.config/nnn/plugins/cdpath: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: 'cd' to the directory from CDPATH 4 | # 5 | # Details: If the CDPATH environmet variable is not set, the default value of 6 | # ${XDG_CONFIG_HOME:-$HOME/.config}/nnn/bookmarks will be used. 7 | # You can create this directory and fill it with symbolic links to your 8 | # favorite directories. It's a good idea to add it to CDPATH so that it 9 | # could also be used from the command line outside of nnn. 10 | # The fzf search is done on the directory basename (the first column). 11 | # 12 | # This plugin is an extended version of the bookmarks plugin. 13 | # If you set your CDPATH to ${XDG_CACHE_HOME:-$HOME/.cache}/nnn/bookmarks 14 | # or to the value of BOOKMARKS_DIR, you can use it as a bookmarks replacement. 15 | # 16 | # Shell: POSIX compliant 17 | # Author: Yuri Kloubakov 18 | 19 | . "$(dirname "$0")"/.nnn-plugin-helper 20 | 21 | # Get a list of (symbolic links to) directories for every element of CDPATH 22 | get_dirs() { 23 | IFS=':' 24 | for path in $CDPATH; do 25 | for entry in "$path"/*; do 26 | if [ -d "$entry" ]; then 27 | name=$(basename "$entry" | grep -o '^.\{1,24\}') 28 | if [ -h "$entry" ]; then 29 | slink=$(ls -dl -- "$entry") 30 | entry=${slink#*" $entry -> "} 31 | fi 32 | printf "%-24s :%s\n" "${name}" "$entry" 33 | fi 34 | done 35 | done 36 | } 37 | 38 | abort() { 39 | echo "$1" 40 | read -r _ 41 | exit 1 42 | } 43 | 44 | if [ -z "$CDPATH" ]; then 45 | CDPATH="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/bookmarks" 46 | [ -d "$CDPATH" ] || abort "CDPATH is not set and there is no \"$CDPATH\" directory" 47 | fi 48 | 49 | dir_list=$(get_dirs) 50 | [ -n "$dir_list" ] || abort "There are no directories to choose from. Check your \"$CDPATH\"." 51 | 52 | dir=$(echo "$dir_list" | fzf --nth=1 --delimiter=':' | awk -F: 'END { print $2 }') 53 | if [ -n "$dir" ]; then 54 | nnn_cd "$dir" 0 55 | fi 56 | -------------------------------------------------------------------------------- /.config/nnn/plugins/chksum: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Create and verify checksums 4 | # 5 | # Details: 6 | # - selection: it will generate one file with the checksums and filenames 7 | # (and with paths if they are in another directory) 8 | # output checksum filename format: checksum_timestamp.checksum_type 9 | # - file: if the file is a checksum, the plugin does the verification 10 | # if the file is not a checksum, checksum will be generated for it 11 | # the output checksum filename will be filename.checksum_type 12 | # - directory: recursively calculates checksum for all the files in the dir 13 | # the output checksum filename will be directory.checksum_type 14 | # 15 | # Shell: POSIX compliant 16 | # Authors: ath3, Arun Prakash Jana 17 | 18 | selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection} 19 | resp=f 20 | chsum=md5 21 | 22 | checksum_type() 23 | { 24 | echo "possible checksums: md5, sha1, sha224, sha256, sha384, sha512" 25 | printf "create md5 (m), sha256 (s), sha512 (S) (or type one of the above checksums) [default=m]: " 26 | read -r chsum_resp 27 | for chks in md5 sha1 sha224 sha256 sha384 sha512 28 | do 29 | if [ "$chsum_resp" = "$chks" ]; then 30 | chsum=$chsum_resp 31 | return 32 | fi 33 | done 34 | if [ "$chsum_resp" = "s" ]; then 35 | chsum=sha256 36 | elif [ "$chsum_resp" = "S" ]; then 37 | chsum=sha512 38 | fi 39 | } 40 | 41 | if [ -s "$selection" ]; then 42 | printf "work with selection (s) or current file (f) [default=f]: " 43 | read -r resp 44 | fi 45 | 46 | if [ "$resp" = "s" ]; then 47 | checksum_type 48 | sed 's|'"$PWD/"'||g' < "$selection" | xargs -0 -I{} ${chsum}sum {} > "checksum_$(date '+%Y%m%d%H%M').$chsum" 49 | 50 | # Clear selection 51 | if [ -p "$NNN_PIPE" ]; then 52 | printf "-" > "$NNN_PIPE" 53 | fi 54 | elif [ -n "$1" ]; then 55 | if [ -f "$1" ]; then 56 | for chks in md5 sha1 sha224 sha256 sha384 sha512 57 | do 58 | if echo "$1" | grep -q \.${chks}$; then 59 | ${chks}sum -c < "$1" 60 | read -r _ 61 | return 62 | fi 63 | done 64 | checksum_type 65 | file=$(basename "$1").$chsum 66 | ${chsum}sum "$1" > "$file" 67 | elif [ -d "$1" ]; then 68 | checksum_type 69 | file=$(basename "$1").$chsum 70 | find "$1" -type f -exec ${chsum}sum "{}" + > "$file" 71 | fi 72 | fi 73 | -------------------------------------------------------------------------------- /.config/nnn/plugins/cmusq: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Add selection or hovered file/directory to cmus queue 4 | # 5 | # Dependencies: cmus, pgrep, xdotool (optional) 6 | # 7 | # Notes: 8 | # 1. If adding selection, files/dirs are added in the same order they were selected in nnn 9 | # 2. A new window will be opened if cmus is not running already, playback will start immediately 10 | # 3. If cmus is already running, files will be appended to the queue with no forced playback 11 | # 12 | # TODO: 13 | # 1. Add cava and cmus-lyrics as optional dependencies 14 | # 2. Start cava and/or cmus-lyrics in tmux or kitty panes next to cmus 15 | # 16 | # Shell: POSIX compliant 17 | # Author: Kabouik 18 | 19 | # (Optional) Set preferred terminal emulator for cmus if not set in your env, 20 | # or leave commented out to use OS default 21 | #TERMINAL="kitty" 22 | 23 | if ! type cmus >/dev/null; then 24 | printf "cmus missing" 25 | read -r _ 26 | exit 1 27 | fi 28 | 29 | selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection} 30 | 31 | start_cmus() { 32 | type xdotool >/dev/null && nnnwindow="$(xdotool getactivewindow)" 33 | case "$TERMINAL" in 34 | kitty | gnome-terminal | st) 35 | nohup "$TERMINAL" -- cmus & ;; 36 | havoc) 37 | nohup "$TERMINAL" cmus & ;; 38 | "") 39 | nohup x-terminal-emulator -e cmus & ;; 40 | *) 41 | nohup "$TERMINAL" -e cmus & ;; 42 | esac 43 | # Give the new terminal some time to open 44 | until cmus-remote -C; do sleep 0.1; done 45 | [ -n "$nnnwindow" ] && xdotool windowactivate "$nnnwindow" 46 | } >/dev/null 2>&1 47 | 48 | fill_queue() { 49 | if [ "$REPLY" = "s" ]; then 50 | xargs < "$selection" -0 cmus-remote -q 51 | elif [ -n "$1" ]; then 52 | cmus-remote -q "$1" 53 | fi 54 | } 55 | 56 | # If active selection,then ask what to do 57 | if [ -s "$selection" ]; then 58 | printf "Queue [s]election or [c]urrently hovered? [default=c]: " 59 | read -r REPLY 60 | fi 61 | 62 | # If cmus is not running, start and play queue 63 | if ! pgrep cmus >/dev/null; then 64 | printf "cmus is not running, starting it in a new %s window.\n" "$TERMINAL" 65 | start_cmus 66 | fill_queue "$1" 67 | cmus-remote -p 68 | printf "Files added to cmus queue.\n" 69 | else # Append to existing queue if cmus is already running 70 | fill_queue "$1" 71 | printf "Files appended to current cmus queue.\n" 72 | fi 73 | 74 | # Change view 75 | cmus-remote -C "view 4" 76 | 77 | # Clear selection 78 | if [ -p "$NNN_PIPE" ]; then 79 | printf "-" > "$NNN_PIPE" 80 | fi 81 | -------------------------------------------------------------------------------- /.config/nnn/plugins/diffs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Show diff of 2 directories or multiple files in vimdiff 4 | # 5 | # Notes: 6 | # 1. vim may show the warning: 'Vim: Warning: Input is not from a terminal' 7 | # press 'Enter' to ignore and proceed. 8 | # 2. if only one file is in selection, the hovered file is considered as the 9 | # second file to diff with 10 | # 11 | # Shell: POSIX compliant 12 | # Authors: Arun Prakash Jana, ath3 13 | 14 | selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection} 15 | 16 | if type nvim >/dev/null 2>&1; then 17 | diffcmd="nvim -d" 18 | else 19 | diffcmd="vimdiff +0" 20 | fi 21 | 22 | dirdiff() { 23 | dir1=$(mktemp "${TMPDIR:-/tmp}"/nnn-"$(basename "$1")".XXXXXXXX) 24 | dir2=$(mktemp "${TMPDIR:-/tmp}"/nnn-"$(basename "$2")".XXXXXXXX) 25 | ls -A1 "$1" > "$dir1" 26 | ls -A1 "$2" > "$dir2" 27 | $diffcmd "$dir1" "$dir2" 28 | rm "$dir1" "$dir2" 29 | } 30 | 31 | if [ -s "$selection" ]; then 32 | arr=$(tr '\0' '\n' < "$selection") 33 | if [ "$(echo "$arr" | wc -l)" -gt 1 ]; then 34 | f1="$(echo "$arr" | sed -n '1p')" 35 | f2="$(echo "$arr" | sed -n '2p')" 36 | if [ -d "$f1" ] && [ -d "$f2" ]; then 37 | dirdiff "$f1" "$f2" 38 | else 39 | # If xargs supports the -o option, use it to get rid of: 40 | # Vim: Warning: Input is not from a terminal 41 | # xargs -0 -o vimdiff < $selection 42 | 43 | eval xargs -0 "$diffcmd" < "$selection" 44 | fi 45 | elif [ -n "$1" ]; then 46 | f1="$(echo "$arr" | sed -n '1p')" 47 | if [ -d "$f1" ] && [ -d "$1" ]; then 48 | dirdiff "$f1" "$1" 49 | elif [ -f "$f1" ] && [ -f "$1" ]; then 50 | $diffcmd "$f1" "$1" 51 | else 52 | echo "cannot compare file with directory" 53 | fi 54 | else 55 | echo "needs at least 2 files or directories selected for comparison" 56 | fi 57 | fi 58 | 59 | # Clear selection 60 | if [ -p "$NNN_PIPE" ]; then 61 | printf "-" > "$NNN_PIPE" 62 | fi 63 | -------------------------------------------------------------------------------- /.config/nnn/plugins/dragdrop: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Open a Drag and drop window, to drop files onto other programs. 4 | # Also provides drag and drop window for files. 5 | # 6 | # Dependencies: dragon - https://github.com/mwh/dragon 7 | # 8 | # Notes: 9 | # 1. Files that are dropped will be added to nnn's selection 10 | # Some web-based files will be downloaded to current dir 11 | # with curl and it may overwrite some existing files 12 | # 2. The user has to mm to clear nnn's selection first 13 | # 14 | # Shell: POSIX compliant 15 | # Author: 0xACE 16 | 17 | selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection} 18 | resp=f 19 | all= 20 | if type dragon-drag-and-drop >/dev/null 2>&1; then 21 | dnd="dragon-drag-and-drop" 22 | else 23 | dnd="dragon" 24 | fi 25 | 26 | add_file () 27 | { 28 | printf '%s\0' "$@" >> "$selection" 29 | } 30 | 31 | use_all () 32 | { 33 | printf "mark --all (a) [default=none]: " 34 | read -r resp 35 | if [ "$resp" = "a" ]; then 36 | all="--all" 37 | else 38 | all="" 39 | fi 40 | } 41 | 42 | if [ -s "$selection" ]; then 43 | printf "Drop file (r). Drag selection (s), Drag current directory (d) or drag current file (f) [default=f]: " 44 | read -r resp 45 | else 46 | printf "Drop file (r). Drag current directory (d) or drag current file (f) [default=f]: " 47 | read -r resp 48 | if [ "$resp" = "s" ]; then 49 | resp=f 50 | fi 51 | fi 52 | 53 | if [ "$resp" = "s" ]; then 54 | use_all 55 | sed -z 's|'"$PWD/"'||g' < "$selection" | xargs -0 "$dnd" "$all" & 56 | elif [ "$resp" = "d" ]; then 57 | use_all 58 | "$dnd" "$all" "$PWD/"* & 59 | elif [ "$resp" = "r" ]; then 60 | true > "$selection" 61 | "$dnd" --print-path --target | while read -r f 62 | do 63 | if printf "%s" "$f" | grep '^\(https\?\|ftps\?\|s\?ftp\):\/\/' ; then 64 | curl -LJO "$f" 65 | add_file "$PWD/$(basename "$f")" 66 | elif [ -e "$f" ]; then 67 | add_file "$f" 68 | fi 69 | done & 70 | else 71 | if [ -n "$1" ] && [ -e "$1" ]; then 72 | "$dnd" "$1" & 73 | fi 74 | fi 75 | 76 | -------------------------------------------------------------------------------- /.config/nnn/plugins/dups: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: List non-empty duplicates in the current dir (based on size followed by MD5) 4 | # 5 | # Source: https://www.commandlinefu.com/commands/view/3555/find-duplicate-files-based-on-size-first-then-md5-hash 6 | # 7 | # Dependencies: find md5sum sort uniq xargs gsed 8 | # 9 | # Notes: 10 | # 1. If the file size exceeds $size_digits digits the file will be misplaced 11 | # 12 digits fit files up to 931GiB 12 | # 2. Bash compatible required for mktemp 13 | # 14 | # Shell: Bash 15 | # Authors: syssyphus, KlzXS 16 | 17 | EDITOR="${EDITOR:-vi}" 18 | TMPDIR="${TMPDIR:-/tmp}" 19 | 20 | size_digits=12 21 | tmpfile=$(mktemp "$TMPDIR/.nnnXXXXXX") 22 | 23 | printf "\ 24 | ## This is an overview of all duplicate files found. 25 | ## Comment out the files you wish to remove. You will be given an option to cancel. 26 | ## Lines with double comments (##) are ignored. 27 | ## You will have the option to remove the files with force or interactively.\n 28 | " > "$tmpfile" 29 | 30 | # shellcheck disable=SC2016 31 | find . -size +0 -type f -printf "%${size_digits}s %p\n" | sort -rn | uniq -w"${size_digits}" -D | sed -E ' 32 | s/^ {,12}([0-9]{,12}) (.*)$/printf "%s %s\\n" "$(md5sum "\2")" "d\1"/ 33 | ' | tr '\n' '\0' | xargs -0 -n1 sh -c | sort | { uniq -w32 --all-repeated=separate; echo; } | sed -nE ' 34 | h 35 | s/^(.{32}).* d([0-9]*)$/## md5sum: \1 size: \2 bytes/p 36 | g 37 | 38 | :loop 39 | N 40 | /.*\n$/!b loop 41 | p' | sed -E 's/^.{32} (.*) d[0-9]*$/\1/' >> "$tmpfile" 42 | 43 | "$EDITOR" "$tmpfile" 44 | 45 | printf "Remove commented files? (yes/no) [default=n]: " 46 | read -r commented 47 | 48 | if [ "$commented" = "y" ]; then 49 | sedcmd="/^(##|[^#]).*/d; /^$/d; s/^# *(.*)$/\1/" 50 | else 51 | printf "Press any key to exit" 52 | read -r _ 53 | exit 54 | fi 55 | 56 | printf "Remove with force or interactive? (f/i) [default=i]: " 57 | read -r force 58 | 59 | if [ "$force" = "f" ]; then 60 | #shellcheck disable=SC2016 61 | sed -E "$sedcmd" "$tmpfile" | tr '\n' '\0' | xargs -0 -r sh -c 'rm -f "$0" "$@" /dev/null; then 40 | fexpr=${fexprs[$((fexpr - 1))]} 41 | read -r -e -p "Search expression: " -i "$fexpr" fexpr 42 | else 43 | return 1 44 | fi 45 | } 46 | 47 | readexpr() { 48 | case "$fexpr" in 49 | h) clear 50 | printf "Examples:\n" 51 | mapfile -t fexprs < <(printexamples) 52 | printexprs 0 53 | read -r -p "Search expression or index: " fexpr 54 | mapexpr 55 | [ -n "$fexpr" ] && readexpr ;; 56 | \$*) cmd="${fexpr:1}" ;; 57 | *) mapexpr && readexpr 58 | cmd="find $fexpr -print0" ;; 59 | esac 60 | } 61 | 62 | clear 63 | [ -f "$NNN_FINDHIST" ] || printexamples > "$NNN_FINDHIST" 64 | 65 | mapfile -t fexprs < <(sort "$NNN_FINDHIST" | uniq -c | sort -nr | head -n5 |\ 66 | awk '{for (i=2; i "$NNN_PIPE" 79 | while :; do 80 | readexpr 81 | eval "$cmd" > "$NNN_PIPE" && break 82 | read -r -e -p "Search expression: " -i "$fexpr" fexpr 83 | done 84 | if [ -n "$fexpr" ]; then 85 | tail -n"$NNN_FINDHISTLEN" "$NNN_FINDHIST" > "$TMPDIR/finderbms" 86 | printf "%s\n" "$fexpr" >> "$TMPDIR/finderbms" 87 | mv "$TMPDIR/finderbms" "$NNN_FINDHIST" 88 | fi 89 | fi 90 | -------------------------------------------------------------------------------- /.config/nnn/plugins/fixname: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Description: Clean filename or dirname (either hovered or selections) 4 | # to be more shell-friendly. This script cleans 5 | # non A-Za-z0-9._- characters. 6 | # and replaces it with underscore (_). 7 | # 8 | # It supports cleaning single/double quote, newline, 9 | # leading, trailing spaces. 10 | # 11 | # eg. 12 | # to be continued (つづく).mp4 -> to_be_continued______.mp4 13 | # [work] stuff.txt -> _work__stuff.txt 14 | # home's server -> home_s_server 15 | # qwe\trty -> __qwe_rty 16 | # 17 | # And if there are two almost similar filenames 18 | # like: 'asd]f' and 'asd f' both will be renamed to 'asd_f', 19 | # to avoid overwriting, the last file will be prepended by _. 20 | # So they will be: 'asd_f' and '_asd_f' 21 | # 22 | # Dependencies: sed 23 | # 24 | # Shell: Bash 25 | # Author: Benawi Adha 26 | 27 | prompt=true 28 | sel=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection} 29 | 30 | cleanup() { 31 | # printf "%s" "$1" | sed -e 's/[^A-Za-z0-9._-]/_/g' 32 | printf "%s" "$1" | sed 's/[^A-Za-z0-9._-]/_/g' | sed ':a;N;$!ba;s/\n/_/g' 33 | } 34 | 35 | if [ -s "$sel" ]; then 36 | targets=() 37 | while IFS= read -r -d '' i || [ -n "$i" ]; do 38 | targets+=( "$(basename "$i")" ) 39 | done < "$sel" 40 | else 41 | targets=("$1") 42 | fi 43 | 44 | for i in "${targets[@]}"; do 45 | printf "%s -> %s\n" "$i" "$(cleanup "$i")"; 46 | done 47 | 48 | if $prompt; then 49 | echo 50 | printf "Proceed [Yn]? " 51 | read -r input 52 | case "$input" in 53 | y|Y|'') 54 | ;; 55 | *) 56 | echo "Canceled" 57 | exit 58 | ;; 59 | esac 60 | fi 61 | 62 | for i in "${targets[@]}"; do 63 | if [ "$i" != "$(cleanup "$i")" ]; then 64 | tmp='' 65 | if [ -e "$(cleanup "$i")" ]; then 66 | tmp='_' 67 | fi 68 | mv "$i" "$tmp$(cleanup "$i")"; 69 | fi 70 | done 71 | 72 | # Clear selection 73 | if [ -s "$sel" ] && [ -p "$NNN_PIPE" ]; then 74 | printf "-" > "$NNN_PIPE" 75 | fi 76 | -------------------------------------------------------------------------------- /.config/nnn/plugins/fzcd: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Fuzzy search multiple locations read-in from a path-list file 4 | # (or $PWD) and open the selected file's dir in a smart context. 5 | # Dependencies: fzf, find (only for multi-location search) 6 | # 7 | # Details: Paths in list file should be newline-separated absolute paths. 8 | # Paths can be file paths; the script will scan the parent dirs. 9 | # 10 | # The path-list file precedence is: 11 | # - "$1" (the hovered file) if it exists, is plain-text and the 12 | # first line points to an existing file 13 | # - "$LIST" if set below 14 | # - "$2" (the current directory) [mimics plugin fzcd behaviour] 15 | # 16 | # The path-list file can be generated easily: 17 | # - pick the (file)paths in picker mode to path-list file 18 | # - OR, edit selection in nnn and save as path-list file 19 | # 20 | # Shell: POSIX compliant 21 | # Author: Anna Arad, Arun Prakash Jana, KlzXS 22 | 23 | IFS="$(printf '\n\r')" 24 | 25 | . "$(dirname "$0")"/.nnn-plugin-helper 26 | 27 | CTX=+ 28 | LIST="$LIST" 29 | 30 | if ! type fzf >/dev/null 2>&1; then 31 | printf "fzf missing" 32 | read -r _ 33 | exit 1 34 | fi 35 | 36 | if [ -n "$1" ] && [ "$(file -b --mime-type "$1")" = 'text/plain' ] && [ -e "$(head -1 "$1")" ]; then 37 | LIST="$1" 38 | elif ! [ -s "$LIST" ]; then 39 | sel=$(fzf) 40 | # Show only the file and parent dir 41 | # sel=$(fzf --delimiter / --with-nth=-2,-1 --tiebreak=begin --info=hidden) 42 | 43 | LIST='' 44 | fi 45 | 46 | if [ -n "$LIST" ]; then 47 | if type find >/dev/null 2>&1; then 48 | tmpfile=$(mktemp /tmp/abc-script.XXXXXX) 49 | 50 | while IFS= read -r path; do 51 | if [ -d "$path" ]; then 52 | printf "%s\n" "$path" >> "$tmpfile" 53 | elif [ -f "$path" ]; then 54 | printf "%s\n" "$(dirname "$path")" >> "$tmpfile" 55 | fi 56 | done < "$LIST" 57 | 58 | sel=$(xargs -d '\n' -a "$tmpfile" -I{} find {} -type f -printf "%H//%P\n" | sed '/.*\/\/\(\..*\|.*\/\..*\)/d; s:/\+:/:g' | fzf --delimiter / --tiebreak=begin --info=hidden) 59 | # Alternative for 'fd' 60 | # sel=$(xargs -d '\n' -a "$tmpfile" fd . | fzf --delimiter / --tiebreak=begin --info=hidden) 61 | 62 | rm "$tmpfile" 63 | else 64 | printf "find missing" 65 | read -r _ 66 | exit 1 67 | fi 68 | fi 69 | 70 | if [ -n "$sel" ]; then 71 | if [ "$sel" = "." ] || { ! [ -d "$sel" ] && ! [ -f "$sel" ]; }; then 72 | exit 0 73 | fi 74 | 75 | # Check if the selected path returned by fzf command is absolute 76 | case $sel in 77 | /*) nnn_cd "$sel" "$CTX" ;; 78 | *) 79 | # Remove "./" prefix if it exists 80 | sel="${sel#./}" 81 | 82 | if [ "$PWD" = "/" ]; then 83 | nnn_cd "/$sel" "$CTX" 84 | else 85 | nnn_cd "$PWD/$sel" "$CTX" 86 | fi;; 87 | esac 88 | fi 89 | -------------------------------------------------------------------------------- /.config/nnn/plugins/fzhist: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Fuzzy find a command from history, 4 | # edit in $EDITOR and run as a command 5 | # 6 | # Note: Supports only bash and fish history 7 | # 8 | # Shell: POSIX compliant 9 | # Author: Arun Prakash Jana 10 | 11 | if type fzf >/dev/null 2>&1; then 12 | fuzzy=fzf 13 | else 14 | exit 1 15 | fi 16 | 17 | shellname="$(basename "$SHELL")" 18 | 19 | if [ "$shellname" = "bash" ]; then 20 | hist_file="$HOME/.bash_history" 21 | entry="$("$fuzzy" < "$hist_file")" 22 | elif [ "$shellname" = "fish" ]; then 23 | hist_file="$HOME/.local/share/fish/fish_history" 24 | entry="$(grep "\- cmd: " "$hist_file" | cut -c 8- | "$fuzzy")" 25 | fi 26 | 27 | if [ -n "$entry" ]; then 28 | tmpfile=$(mktemp) 29 | echo "$entry" >> "$tmpfile" 30 | $EDITOR "$tmpfile" 31 | 32 | if [ -s "$tmpfile" ]; then 33 | $SHELL -c "$(cat "$tmpfile")" 34 | fi 35 | 36 | rm "$tmpfile" 37 | 38 | printf "Press any key to exit" 39 | read -r _ 40 | fi 41 | -------------------------------------------------------------------------------- /.config/nnn/plugins/fzopen: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Regular mode: 4 | # Fuzzy find a file in directory subtree. 5 | # Opens in $VISUAL or $EDITOR if text. 6 | # Opens other type of files with xdg-open. 7 | # Work only with a single file selected. 8 | # 9 | # Picker mode: 10 | # If picker mode output file is passed, it 11 | # will be overwritten with any picked files. 12 | # Leaves untouched if no file is picked. 13 | # Works with single/multiple files selected. 14 | # 15 | # Dependencies: fd/find, fzf/skim, xdg-open/open (on macOS) 16 | # 17 | # Shell: POSIX compliant 18 | # Author: Arun Prakash Jana 19 | 20 | NUKE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins/nuke" 21 | USE_NUKE=0 22 | 23 | . "$(dirname "$0")"/.nnn-plugin-helper 24 | 25 | if type fzf >/dev/null 2>&1; then 26 | cmd="$FZF_DEFAULT_COMMAND" 27 | if type fd >/dev/null 2>&1; then 28 | [ -z "$cmd" ] && cmd="fd -t f 2>/dev/null" 29 | else 30 | [ -z "$cmd" ] && cmd="find . -type f 2>/dev/null" 31 | fi 32 | entry="$(eval "$cmd" | fzf -m)" 33 | # To show only the file name 34 | # entry=$(find . -type f 2>/dev/null | fzf --delimiter / --with-nth=-1 --tiebreak=begin --info=hidden) 35 | elif type sk >/dev/null 2>&1; then 36 | entry=$(find . -type f 2>/dev/null | sk) 37 | else 38 | exit 1 39 | fi 40 | 41 | # Check for picker mode 42 | if [ "$3" ]; then 43 | if [ "$entry" ]; then 44 | case "$entry" in 45 | /*) fullpath="$entry" ;; 46 | *) fullpath="$PWD/$entry" ;; 47 | esac 48 | if [ "-" = "$3" ]; then 49 | printf "%s\n" "$fullpath" 50 | else 51 | printf "%s\n" "$fullpath" > "$3" 52 | fi 53 | 54 | # Tell `nnn` to clear its internal selection 55 | printf "%s" "0p" > "$NNN_PIPE" 56 | fi 57 | 58 | exit 0 59 | fi 60 | 61 | if [ "$USE_NUKE" -ne 0 ]; then 62 | "$NUKE" "$entry" 63 | exit 0 64 | fi 65 | 66 | # Open the file (works for a single file only) 67 | cmd_file="" 68 | cmd_open="" 69 | if uname | grep -q "Darwin"; then 70 | cmd_file="file -bIL" 71 | cmd_open="open" 72 | else 73 | cmd_file="file -biL" 74 | cmd_open="xdg-open" 75 | fi 76 | 77 | case "$($cmd_file "$entry")" in 78 | *text*) 79 | "${VISUAL:-$EDITOR}" "$entry" ;; 80 | *) 81 | $cmd_open "$entry" >/dev/null 2>&1 ;; 82 | esac 83 | -------------------------------------------------------------------------------- /.config/nnn/plugins/fzplug: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Fuzzy find and execute nnn plugins (and optionally, 4 | # custom scripts located elsewhere). 5 | # Description and details of plugins can be previewed 6 | # from the fzf interface. Use `?` to toggle preview 7 | # pane on and off, ^Up/^Dn to scroll. 8 | # 9 | # Dependencies: find, fzf, cat (or bat, if installed) 10 | # 11 | # Note: For better compatibility with as many nnn plugins as possible, 12 | # fzplug will first execute the chosen script on the file hovered 13 | # in nnn, and upon failure, try to run it with no target (i.e on 14 | # an active selection, if present). 15 | # 16 | # Shell: POSIX compliant 17 | # Author: Kabouik 18 | 19 | # Optional scripts sources 20 | 21 | # Leave blank or fill with the absolute path of a folder containing executable 22 | # scripts other than nnn plugins (e.g., "$HOME/.local/share/nautilus/scripts", 23 | # since there are numerous Nautilus script git repositories). 24 | # Add extra variables if needed, make sure you call them in the find command. 25 | 26 | #CUSTOMDIR1="$HOME/.local/share/nautilus/scripts" 27 | CUSTOMDIR1="" 28 | CUSTOMDIR2="" 29 | 30 | nnnpluginsdir="$HOME/.config/nnn/plugins" 31 | 32 | # Preview with bat if installed 33 | if type bat >/dev/null; then 34 | BAT="bat --terminal-width='$(tput cols)' --decorations=always --color=always --style='${BAT_STYLE:-header,numbers}'" 35 | fi 36 | 37 | plugin=$(find "$nnnpluginsdir" "$CUSTOMDIR1" "$CUSTOMDIR2" \ 38 | -maxdepth 3 -perm -111 -type f 2>/dev/null | fzf --ansi --preview \ 39 | "${BAT:-cat} {}" --preview-window="right:66%:wrap" --delimiter / \ 40 | --with-nth -1 --bind="?:toggle-preview") 41 | 42 | # Try running the script on the hovered file, and abort 43 | # abort if no plugin was selected (ESC or ^C pressed). 44 | err=0 45 | if ! [ "$plugin" = "" ]; then 46 | "$plugin" "$1" || err=1 47 | fi 48 | 49 | # If attempt with hovered file fails, try without any target 50 | # (nnn selections should still be passed to the script in that case) 51 | if [ "$err" -eq "1" ]; then 52 | clear && "$plugin" || err=2 53 | fi 54 | 55 | # Abort and show error if both fail 56 | if [ "$err" -eq "2" ]; then 57 | sep="\n---\n" 58 | printf "$sep""Failed to execute '%s'. See error above or try without fzfplug. Press return to continue. " "$plugin" && read -r _ && clear 59 | fi 60 | -------------------------------------------------------------------------------- /.config/nnn/plugins/fzz: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: cd to any dir in the z database using an fzf pane 4 | # 5 | # Shell: POSIX compliant 6 | # Author: Nick Waywood 7 | 8 | . "$(dirname "$0")"/.nnn-plugin-helper 9 | 10 | if which fzf >/dev/null 2>&1; then 11 | fuzzy=fzf 12 | else 13 | exit 1 14 | fi 15 | 16 | datafile="${_Z_DATA:-$HOME/.z}" 17 | if [ -f "$datafile" ]; then 18 | # I read the data from z's file instead of calling the z command so that the data doesn't need to be processed twice 19 | sel=$(awk -F "|" '{print $1}' "$datafile" | "$fuzzy" | awk '{$1=$1};1') 20 | # NOTE: Uncomment this line and comment out the line above if you want to see the weightings of the dir's in the fzf pane 21 | # sel=$(awk -F "|" '{printf "%s %s\n", $2, $1}' "$datafile" | "$fuzzy" | sed 's/^[0-9,.]* *//' | awk '{$1=$1};1') 22 | else 23 | exit 1 24 | fi 25 | 26 | printf "%s" "0c$sel" > "$NNN_PIPE" 27 | -------------------------------------------------------------------------------- /.config/nnn/plugins/getplugs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Update nnn plugins to installed nnn version 4 | # 5 | # Shell: POSIX compliant 6 | # Authors: Arun Prakash Jana, KlzXS 7 | 8 | CONFIG_DIR=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/ 9 | PLUGIN_DIR=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins 10 | 11 | merge () { 12 | if type nvim >/dev/null 2>&1; then 13 | nvim -d "$1" "$2" 14 | else 15 | vimdiff +0 "$1" "$2" 16 | fi 17 | } 18 | 19 | prompt () { 20 | printf "%s\n" "Plugin $1 already exists and is different." 21 | printf "Keep (k), merge (m), overwrite (o) [default: k]? " 22 | read -r operation 23 | 24 | if [ "$operation" = "m" ]; then 25 | op="merge" 26 | elif [ "$operation" = "o" ]; then 27 | op="cp -vRf" 28 | else 29 | op="true" 30 | fi 31 | } 32 | 33 | if [ "$1" = "master" ] ; then 34 | VER="master" 35 | ARCHIVE_URL=https://github.com/jarun/nnn/archive/master.tar.gz 36 | elif type nnn >/dev/null 2>&1; then 37 | VER=$(nnn -V) 38 | ARCHIVE_URL=https://github.com/jarun/nnn/releases/download/v"$VER"/nnn-v"$VER".tar.gz 39 | else 40 | echo "nnn is not installed" 41 | exit 1 42 | fi 43 | 44 | # backup any earlier plugins 45 | if [ -d "$PLUGIN_DIR" ]; then 46 | tar -C "$CONFIG_DIR" -czf "$CONFIG_DIR""plugins-$(date '+%Y%m%d%H%M').tar.gz" plugins/ 47 | fi 48 | 49 | mkdir -p "$PLUGIN_DIR" 50 | cd "$CONFIG_DIR" || exit 1 51 | curl -Ls "$ARCHIVE_URL" -o nnn-"$VER".tar.gz 52 | tar -zxf nnn-"$VER".tar.gz 53 | 54 | cd nnn-"$VER"/plugins || exit 1 55 | 56 | # shellcheck disable=SC2044 57 | # We do not use obnoxious names for plugins 58 | for f in $(find . -maxdepth 1 \( ! -iname "." ! -iname "*.md" \)); do 59 | if [ -f ../../plugins/"$f" ]; then 60 | if [ "$(diff --brief "$f" ../../plugins/"$f")" ]; then 61 | prompt "$f" 62 | $op "$f" ../../plugins/ 63 | fi 64 | else 65 | cp -vRf "$f" ../../plugins/ 66 | fi 67 | done 68 | cd ../.. || exit 1 69 | 70 | rm -rf nnn-"$VER"/ nnn-"$VER".tar.gz 71 | -------------------------------------------------------------------------------- /.config/nnn/plugins/gpgd: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Decrypts selected files using gpg. The contents of the 4 | # decrypted file are stored in a file with extension .dec 5 | # 6 | # Note: If an appropriate private key cannot be found gpg silently 7 | # prints a message in the background and no files are written. 8 | # 9 | # Shell: POSIX compliant 10 | # Author: KlzXS 11 | 12 | selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection} 13 | 14 | printf "(s)election/(c)urrent? [default=c] " 15 | read -r resp 16 | 17 | if [ "$resp" = "s" ]; then 18 | files=$(tr '\0' '\n' < "$selection") 19 | else 20 | files=$1 21 | fi 22 | 23 | printf "%s" "$files" | xargs -n1 -I{} gpg --decrypt --output "{}.dec" {} 24 | 25 | # Clear selection 26 | if [ "$resp" = "s" ] && [ -p "$NNN_PIPE" ]; then 27 | printf "-" > "$NNN_PIPE" 28 | fi 29 | -------------------------------------------------------------------------------- /.config/nnn/plugins/gpge: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Encrypts selected files using gpg. Can encrypt 4 | # asymmetrically (key) or symmetrically (passphrase). 5 | # If asymmetric encryption is chosen a key can be 6 | # chosen from the list of capable public keys using fzf. 7 | # 8 | # Note: Symmetric encryption only works for a single (current) file as per gpg limitations 9 | # 10 | # Shell: POSIX compliant 11 | # Author: KlzXS 12 | 13 | selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection} 14 | 15 | printf "(s)ymmetric, (a)symmetric? [default=a] " 16 | read -r symmetry 17 | 18 | if [ "$symmetry" = "s" ]; then 19 | gpg --symmetric "$1" 20 | else 21 | printf "(s)election/(c)urrent? [default=c] " 22 | read -r resp 23 | 24 | if [ "$resp" = "s" ]; then 25 | files=$(tr '\0' '\n' < "$selection") 26 | else 27 | files=$1 28 | fi 29 | 30 | keyids=$(gpg --list-public-keys --with-colons | grep -E "pub:(.*:){10}.*[eE].*:" | awk -F ":" '{print $5}') 31 | 32 | #awk needs literal $10 33 | #shellcheck disable=SC2016 34 | keyuids=$(printf "%s" "$keyids" | xargs -n1 -I{} sh -c 'gpg --list-key --with-colons "{}" | grep "uid" | awk -F ":" '\''{printf "%s %s\n", "{}", $10}'\''') 35 | 36 | recipient=$(printf "%s" "$keyuids" | fzf | awk '{print $1}') 37 | 38 | printf "%s" "$files" | xargs -n1 gpg --encrypt --recipient "$recipient" 39 | 40 | # Clear selection 41 | if [ "$resp" = "s" ] && [ -p "$NNN_PIPE" ]; then 42 | printf "-" > "$NNN_PIPE" 43 | fi 44 | fi 45 | -------------------------------------------------------------------------------- /.config/nnn/plugins/gutenread: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Browse Project Gutenberg catalogue by popularity, then download 4 | # and read a book of your choice. 5 | # 6 | # Details: Set the variable EBOOK_ID to download in html format and read in w3m. 7 | # Clear EBOOK_ID to browse available ebooks by popularity and set it to 8 | # the ID once you find an interesting one. 9 | # To download and read in epub format set READER to an epub reader like 10 | # epr: https://github.com/wustho/epr 11 | # 12 | # More on EBOOK_ID: 13 | # Wuthering Heights by Emily Brontë is at https://www.gutenberg.org/ebooks/768 14 | # So EBOOK_ID would be 768 15 | # 16 | # Downloaded ebooks are at ${XDG_CACHE_HOME:-$HOME/.cache}/nnn/gutenbooks/ 17 | # 18 | # Shell: POSIX compliant 19 | # Author: Arun Prakash Jana 20 | 21 | EBOOK_ID="${EBOOK_ID}" 22 | DIR="${XDG_CACHE_HOME:-$HOME/.cache}/nnn/gutenbooks/$EBOOK_ID" 23 | BROWSE_LINK="https://www.gutenberg.org/ebooks/search/?sort_order=downloads" 24 | BROWSER="${BROWSER:-w3m}" 25 | READER="${READER}" 26 | 27 | if [ -n "$EBOOK_ID" ]; then 28 | if [ ! -e "$DIR" ]; then 29 | mkdir -p "$DIR" 30 | cd "$DIR" || exit 1 31 | 32 | if [ -z "$READER" ]; then 33 | curl -L -O "https://www.gutenberg.org/files/$EBOOK_ID/$EBOOK_ID-h.zip" 34 | unzip "$EBOOK_ID"-h.zip 35 | else 36 | curl -L -o "$EBOOK_ID".epub "https://www.gutenberg.org/ebooks/$EBOOK_ID.epub.noimages" 37 | fi 38 | fi 39 | 40 | if [ -d "$DIR" ]; then 41 | if [ -z "$READER" ]; then 42 | "$BROWSER" "$DIR/$EBOOK_ID-h/$EBOOK_ID-h.htm" 43 | else 44 | "$READER" "$DIR/$EBOOK_ID.epub" 45 | fi 46 | fi 47 | else 48 | "$BROWSER" "$BROWSE_LINK" 49 | fi 50 | -------------------------------------------------------------------------------- /.config/nnn/plugins/hexview: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: View a file in hex 4 | # Dependencies: hx (https://github.com/krpors/hx)/xxd and $PAGER 5 | # 6 | # Shell: POSIX compliant 7 | # Author: Arun Prakash Jana 8 | 9 | if ! [ -z "$1" ]; then 10 | if which hx >/dev/null 2>&1; then 11 | hx "$1" 12 | else 13 | xxd "$1" | $PAGER 14 | fi 15 | fi 16 | -------------------------------------------------------------------------------- /.config/nnn/plugins/imgresize: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Resize images in a directory to screen resolution with imgp 4 | # 5 | # Dependencipes: imgp - https://github.com/jarun/imgp 6 | # 7 | # Notes: 8 | # 1. Set res to avoid the desktop resolution prompt each time 9 | # 2. MINSIZE is set to 1MB by default, adjust it if you want 10 | # 3. imgp options used: 11 | # a - adaptive mode 12 | # c - convert PNG to JPG 13 | # k - skip images matching specified hres/vres 14 | # 15 | # Shell: POSIX compliant 16 | # Author: Arun Prakash Jana 17 | 18 | # set resolution (e.g. 1920x1080) 19 | res="${RESOLUTION}" 20 | 21 | # set minimum image size (in bytes) to resize (default: 1MB) 22 | MINSIZE="${MINSIZE:-1048576}" 23 | 24 | if [ -z "$res" ]; then 25 | printf "desktop resolution (hxv): " 26 | read -r res 27 | fi 28 | 29 | if [ -n "$res" ] && [ -n "$MINSIZE" ]; then 30 | imgp -ackx "$res" -s "$MINSIZE" 31 | fi 32 | -------------------------------------------------------------------------------- /.config/nnn/plugins/imgthumb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: View thumbnail of an image or a directory of images with lsix 4 | # 5 | # Shell: POSIX compliant 6 | # Author: Arun Prakash Jana 7 | 8 | if ! [ -z "$1" ]; then 9 | if [ -d "$1" ]; then 10 | lsix "$1"/* 11 | else 12 | lsix "$1" 13 | fi 14 | 15 | printf "Press any key to exit..." 16 | read -r _ 17 | fi 18 | -------------------------------------------------------------------------------- /.config/nnn/plugins/imgview: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Open hovered or current directory in image viewer. 4 | # Generates media thumbnails with optional dependencies. 5 | # 6 | # Dependencies: 7 | # - imv (https://github.com/eXeC64/imv) or, 8 | # - sxiv (https://github.com/muennich/sxiv) or, 9 | # - nsxiv (https://github.com/nsxiv/nsxiv) or, 10 | # - ucollage (https://github.com/ckardaris/ucollage) or, 11 | # - lsix (https://github.com/hackerb9/lsix), or 12 | # - viu (https://github.com/atanunq/viu), or 13 | # - catimg (https://github.com/posva/catimg), or 14 | # - optional: ffmpeg for audio thumbnails (album art) 15 | # - optional: ffmpegthumbnailer for video thumbnails 16 | # 17 | # Shell: POSIX compliant 18 | # Author: Arun Prakash Jana, Luuk van Baal 19 | # 20 | # Consider setting NNN_PREVIEWDIR to $XDG_CACHE_HOME/nnn/previews 21 | # if you want to keep media thumbnails on disk between reboots. 22 | NNN_PREVIEWDIR="${NNN_PREVIEWDIR:-${TMPDIR:-/tmp}/nnn/previews}" 23 | 24 | exit_prompt() { 25 | [ -n "$1" ] && printf "%s\n" "$1" 26 | printf "%s" "Press any key to exit..." 27 | cfg=$(stty -g); stty raw -echo; head -c 1; stty "$cfg" 28 | clear 29 | exit 30 | } 31 | 32 | make_thumbs() { 33 | mkdir -p "$NNN_PREVIEWDIR$dir" || return 34 | if [ "$1" -eq 3 ]; then 35 | [ -d "$target" ] && exit_prompt "$2 can only display a single image" 36 | mime="$(file -bL --mime-type -- "$target")" 37 | case "$mime" in 38 | audio/*) ffmpeg -i "$target" "$NNN_PREVIEWDIR$target.jpg" -y >/dev/null 2>&1 39 | ret="$NNN_PREVIEWDIR/$target.jpg" ;; 40 | video/*) ffmpegthumbnailer -i "$target" -o "$NNN_PREVIEWDIR$target.jpg" 2> /dev/null 41 | ret="$NNN_PREVIEWDIR/$target.jpg" ;; 42 | *) ret="$target" ;; 43 | esac 44 | fi 45 | for file in "$dir"/*; do 46 | if [ ! -f "$NNN_PREVIEWDIR$file.jpg" ]; then 47 | case "$(file -bL --mime-type -- "$file")" in 48 | audio/*) [ "$1" -ne 0 ] && ffmpeg -i "$file" "$NNN_PREVIEWDIR$file.jpg" -y >/dev/null 2>&1 ;; 49 | video/*) [ "$1" -ne 1 ] && ffmpegthumbnailer -i "$file" -o "$NNN_PREVIEWDIR$file.jpg" 2> /dev/null ;; 50 | esac 51 | fi 52 | done 53 | for file in "$NNN_PREVIEWDIR$dir"/*; do 54 | filename="$(basename "$file" .jpg)" 55 | [ ! -e "$dir/$filename" ] && rm "$file" 2>/dev/null 56 | done 57 | } 58 | 59 | listimages() { 60 | find -L "$dir" "$NNN_PREVIEWDIR$dir" -maxdepth 1 -type f -print0 2>/dev/null | sort -z 61 | } 62 | 63 | view_files() { 64 | [ -f "$target" ] && count="-n $(listimages | grep -a -m 1 -ZznF "$target" | cut -d: -f1)" 65 | case "$1" in 66 | nsxiv) listimages | xargs -0 nsxiv -a "${count:--t}" -- ;; 67 | sxiv) listimages | xargs -0 sxiv -a "${count:--t}" -- ;; 68 | imv*) listimages | xargs -0 "$1" "${count:-}" -- ;; 69 | esac 70 | } 71 | 72 | target="$(readlink -f "$1")" 73 | [ -d "$target" ] && dir="$target" || dir="${target%/*}" 74 | if uname | grep -q "Darwin"; then 75 | [ -f "$1" ] && open "$1" >/dev/null 2>&1 & 76 | elif type lsix >/dev/null 2>&1; then 77 | if [ -d "$target" ]; then 78 | cd "$target" || exit_prompt 79 | fi 80 | make_thumbs "" 81 | clear 82 | lsix 83 | cd "$NNN_PREVIEWDIR$dir" && lsix 84 | exit_prompt 85 | elif type ucollage >/dev/null 2>&1; then 86 | type ffmpeg >/dev/null 2>&1 && make_thumbs 1 87 | UCOLLAGE_EXPAND_DIRS=1 ucollage "$dir" "$NNN_PREVIEWDIR$dir" || exit_prompt 88 | elif type sxiv >/dev/null 2>&1; then 89 | type ffmpegthumbnailer >/dev/null 2>&1 && make_thumbs 0 90 | view_files sxiv >/dev/null 2>&1 & 91 | elif type nsxiv >/dev/null 2>&1; then 92 | type ffmpegthumbnailer >/dev/null 2>&1 && make_thumbs 0 93 | view_files nsxiv >/dev/null 2>&1 & 94 | elif type imv >/dev/null 2>&1; then 95 | make_thumbs "" 96 | view_files imv >/dev/null 2>&1 & 97 | elif type imvr >/dev/null 2>&1; then 98 | make_thumbs "" 99 | view_files imvr >/dev/null 2>&1 & 100 | elif type viu >/dev/null 2>&1; then 101 | clear 102 | make_thumbs 3 viu 103 | viu -n "$ret" 104 | exit_prompt 105 | elif type catimg >/dev/null 2>&1; then 106 | make_thumbs 3 catimg 107 | catimg "$ret" 108 | exit_prompt 109 | else 110 | exit_prompt "Please install sxiv/nsxiv/imv/viu/catimg/lsix." 111 | fi 112 | -------------------------------------------------------------------------------- /.config/nnn/plugins/ipinfo: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Shows the external IP address and whois information. Useful over VPNs. 4 | # 5 | # Shell: POSIX compliant 6 | # Author: Arun Prakash Jana 7 | 8 | IP=$(curl -s ifconfig.me) 9 | 10 | whois "$IP" 11 | echo your external IP address is "$IP" 12 | 13 | read -r _ 14 | -------------------------------------------------------------------------------- /.config/nnn/plugins/kdeconnect: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Send the selected files to your Android device using kdeconnect-cli. 4 | # kdeconnect must be configured on the Android device and the PC. 5 | # 6 | # Shell: POSIX compliant 7 | # Author: juacq97 8 | 9 | selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection} 10 | 11 | id=$(kdeconnect-cli -a --id-only | awk '{print $1}') 12 | if [ -s "$selection" ]; then 13 | kdeconnect-cli -d "$id" --share "$(cat "$selection")" 14 | 15 | # If you want a system notification, uncomment the next 3 lines. 16 | #notify-send -a "Kdeconnect" "Sending $(cat "$selection")" 17 | #else 18 | #notify-send -a "Kdeconnect" "No file selected" 19 | 20 | # Clear selection 21 | if [ -p "$NNN_PIPE" ]; then 22 | printf "-" > "$NNN_PIPE" 23 | fi 24 | fi 25 | -------------------------------------------------------------------------------- /.config/nnn/plugins/launch: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Independent POSIX-compliant GUI application launcher. 4 | # Fuzzy find executables in $PATH and launch an application. 5 | # stdin, stdout, stderr are suppressed so CLI tools exit silently. 6 | # 7 | # To configure launch as an independent app launcher add a keybind 8 | # to open launch in a terminal e.g., 9 | # 10 | # xfce4-terminal -e "${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins/launch 11 | # 12 | # Dependencies: fzf 13 | # 14 | # Usage: launch [delay] 15 | # delay is in seconds, if omitted launch waits for 1 sec 16 | # 17 | # Integration with nnn: launch is installed with other plugins, nnn picks it up. 18 | # 19 | # Shell: POSIX compliant 20 | # Author: Arun Prakash Jana 21 | 22 | # shellcheck disable=SC2086 23 | 24 | IFS=':' 25 | 26 | get_selection() { 27 | if type fzf >/dev/null 2>&1; then 28 | { IFS=':'; ls -H $PATH; } | sort | fzf 29 | else 30 | exit 1 31 | fi 32 | } 33 | 34 | if selection=$( get_selection ); then 35 | setsid "$selection" 2>/dev/null 1>/dev/null & 36 | 37 | if [ -n "$1" ]; then 38 | sleep "$1" 39 | else 40 | sleep 1 41 | fi 42 | fi 43 | -------------------------------------------------------------------------------- /.config/nnn/plugins/mediainf: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Show media information of a file in pager 4 | # 5 | # Dependencies: mediainfo 6 | # 7 | # Shell: POSIX compliant 8 | # Author: Arun Prakash Jana 9 | 10 | if ! [ -z "$1" ] && [ -f "$1" ]; then 11 | mediainfo "$1" | $PAGER 12 | # exiftool "$1" | $PAGER 13 | fi 14 | -------------------------------------------------------------------------------- /.config/nnn/plugins/mimelist: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Find and list files by mime type in smart context 4 | # 5 | # Shell: POSIX compliant 6 | # Author: Arun Prakash Jana 7 | 8 | . "$(dirname "$0")"/.nnn-plugin-helper 9 | 10 | printf "mime (e.g., video/audio/image): " 11 | read -r mime 12 | 13 | printf "%s" "+l" > "$NNN_PIPE" 14 | find . | file -if- | grep "$mime" | awk -F: '{printf "%s\0", $1}' > "$NNN_PIPE" 15 | -------------------------------------------------------------------------------- /.config/nnn/plugins/moclyrics: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Fetches the lyrics of the track currently playing in MOC 4 | # 5 | # Dependencies: ddgr (https://github.com/jarun/ddgr) 6 | # 7 | # Shell: POSIX compliant 8 | # Author: Arun Prakash Jana 9 | 10 | # Check if MOC server is running 11 | cmd=$(pgrep -x mocp 2>/dev/null) 12 | ret=$cmd 13 | if [ -z "$ret" ]; then 14 | exit 15 | fi 16 | 17 | # Grab the output 18 | out="$(mocp -i)" 19 | 20 | # Check if anything is playing 21 | state=$(echo "$out" | grep "State:" | cut -d' ' -f2) 22 | if ! [ "$state" = 'PLAY' ]; then 23 | exit 24 | fi 25 | 26 | # Try by Artist and Song Title first 27 | ARTIST="$(echo "$out" | grep 'Artist:' | cut -d':' -f2 | sed 's/^[[:blank:]]*//;s/[[:blank:]]*$//')" 28 | TITLE="$(echo "$out" | grep 'SongTitle:' | cut -d':' -f2 | sed 's/^[[:blank:]]*//;s/[[:blank:]]*$//')" 29 | 30 | if [ -n "$ARTIST" ] && [ -n "$TITLE" ]; then 31 | ddgr -w azlyrics.com --ducky "$ARTIST" "$TITLE" 32 | else 33 | # Try by file name 34 | FILENAME="$(basename "$(echo "$out" | grep 'File:' | cut -d':' -f2)")" 35 | FILENAME="$(echo "${FILENAME%%.*}" | tr -d -)" 36 | 37 | if [ -n "$FILENAME" ]; then 38 | ddgr -w azlyrics.com --ducky "$FILENAME" 39 | fi 40 | fi 41 | -------------------------------------------------------------------------------- /.config/nnn/plugins/mocplay: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Appends and optionally plays music in MOC 4 | # 5 | # Notes: 6 | # - if selection is available, plays it, else plays the current file or directory 7 | # - appends tracks and exits is MOC is running, else clears playlist and adds tracks 8 | # - to let mocp shuffle tracks, set SHUFFLE=1 9 | # 10 | # Shell: POSIX compliant 11 | # Authors: Arun Prakash Jana, ath3 12 | 13 | IFS="$(printf '\n\r')" 14 | selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection} 15 | cmd=$(pgrep -x mocp 2>/dev/null) 16 | ret=$cmd 17 | 18 | SHUFFLE="${SHUFFLE:-0}" 19 | 20 | mocp_add () 21 | { 22 | if [ "$SHUFFLE" = 1 ]; then 23 | if [ "$resp" = "y" ]; then 24 | arr=$(tr '\0' '\n' < "$selection") 25 | elif [ -n "$1" ]; then 26 | arr="$1" 27 | fi 28 | 29 | for entry in $arr 30 | do 31 | if [ -d "$entry" ]; then 32 | arr2=$arr2$(find "$entry" -type f \( ! -iname "*.m3u" ! -iname "*.pls" \)) 33 | elif echo "$entry" | grep -qv '\.m3u$\|\.pls$' ; then 34 | arr2=$(printf "%s\n%s" "$entry" "$arr2") 35 | fi 36 | done 37 | 38 | mocp -o shuffle 39 | echo "$arr2" | xargs -d "\n" mocp -a 40 | else 41 | if [ "$resp" = "y" ]; then 42 | xargs < "$selection" -0 mocp -a 43 | else 44 | mocp -a "$1" 45 | fi 46 | fi 47 | } 48 | 49 | if [ ! -s "$selection" ] && [ -z "$1" ]; then 50 | exit 51 | fi 52 | 53 | if [ "$2" = "opener" ]; then 54 | : 55 | elif [ -s "$selection" ]; then 56 | printf "Work with selection? Enter 'y' to confirm: " 57 | read -r resp 58 | fi 59 | 60 | if [ -z "$ret" ]; then 61 | # mocp not running 62 | mocp -S 63 | else 64 | # mocp running, check if it's playing 65 | state=$(mocp -i | grep "State:" | cut -d' ' -f2) 66 | 67 | if [ "$state" = 'PLAY' ]; then 68 | # add to playlist and exit 69 | mocp_add "$1" 70 | 71 | # uncomment the line below to show mocp interface after appending 72 | # mocp 73 | 74 | exit 75 | fi 76 | fi 77 | 78 | # clear selection and play 79 | mocp -c 80 | mocp_add "$1" "$resp" 81 | mocp -p 82 | 83 | # uncomment the line below to show mocp interface after appending 84 | # mocp 85 | -------------------------------------------------------------------------------- /.config/nnn/plugins/mocq: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Appends and optionally plays music in MOC 4 | # 5 | # Notes: 6 | # - if selection is available, plays it, else plays the current file or directory 7 | # - appends tracks and exits is MOC is running, else clears playlist and adds tracks 8 | # - to let mocp shuffle tracks, set SHUFFLE=1 9 | # 10 | # Shell: POSIX compliant 11 | # Authors: Arun Prakash Jana, ath3 12 | 13 | IFS="$(printf '\n\r')" 14 | selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection} 15 | cmd=$(pgrep -x mocp 2>/dev/null) 16 | ret=$cmd 17 | 18 | SHUFFLE="${SHUFFLE:-0}" 19 | 20 | mocp_add () 21 | { 22 | if [ "$SHUFFLE" = 1 ]; then 23 | if [ "$resp" = "y" ]; then 24 | arr=$(tr '\0' '\n' < "$selection") 25 | elif [ -n "$1" ]; then 26 | arr="$1" 27 | fi 28 | 29 | for entry in $arr 30 | do 31 | if [ -d "$entry" ]; then 32 | arr2=$arr2$(find "$entry" -type f \( ! -iname "*.m3u" ! -iname "*.pls" \)) 33 | elif echo "$entry" | grep -qv '\.m3u$\|\.pls$' ; then 34 | arr2=$(printf "%s\n%s" "$entry" "$arr2") 35 | fi 36 | done 37 | 38 | mocp -o shuffle 39 | echo "$arr2" | xargs -d "\n" mocp -a 40 | else 41 | if [ "$resp" = "y" ]; then 42 | xargs < "$selection" -0 mocp -a 43 | else 44 | mocp -a "$1" 45 | fi 46 | fi 47 | } 48 | 49 | if [ ! -s "$selection" ] && [ -z "$1" ]; then 50 | exit 51 | fi 52 | 53 | if [ "$2" = "opener" ]; then 54 | : 55 | elif [ -s "$selection" ]; then 56 | printf "Work with selection? Enter 'y' to confirm: " 57 | read -r resp 58 | fi 59 | 60 | if [ -z "$ret" ]; then 61 | # mocp not running 62 | mocp -S 63 | else 64 | # mocp running, check if it's playing 65 | state=$(mocp -i | grep "State:" | cut -d' ' -f2) 66 | 67 | if [ "$state" = 'PLAY' ]; then 68 | # add to playlist and exit 69 | mocp_add "$1" 70 | 71 | # uncomment the line below to show mocp interface after appending 72 | # mocp 73 | 74 | exit 75 | fi 76 | fi 77 | 78 | # clear selection and play 79 | mocp -c 80 | mocp_add "$1" "$resp" 81 | mocp -p 82 | 83 | # uncomment the line below to show mocp interface after appending 84 | # mocp 85 | 86 | # Clear selection 87 | if [ "$resp" = "y" ] && [ -p "$NNN_PIPE" ]; then 88 | printf "-" > "$NNN_PIPE" 89 | fi 90 | -------------------------------------------------------------------------------- /.config/nnn/plugins/mp3conv: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Extract audio from multimedia files and convert to mp3 4 | # 5 | # Dependencies: ffmpeg compiled with libmp3lame audio codec support 6 | # 7 | # Shell: POSIX compliant 8 | # Author: Arun Prakash Jana 9 | 10 | outdir=_mp3files 11 | 12 | handle_multimedia() { 13 | mime="${1}" 14 | file="${2}" 15 | 16 | case "${mime}" in 17 | audio/* | video/*) 18 | ffmpeg -i "${file}" -vn -codec:a libmp3lame -q:a 2 "${outdir}/${file%.*}.mp3" 19 | ;; 20 | *) 21 | ;; 22 | esac 23 | } 24 | 25 | printf "Process 'a'll in directory or 'c'urrent? " 26 | read -r resp 27 | 28 | if [ "$resp" = "a" ]; then 29 | if ! [ -e "${outdir}" ]; then 30 | mkdir "${outdir}" 31 | fi 32 | 33 | for f in *; do 34 | if [ -f "${f}" ]; then 35 | mimestr="$( file --dereference --brief --mime-type -- "${f}" )" 36 | handle_multimedia "${mimestr}" "${f}" 37 | fi 38 | done 39 | elif [ "$resp" = "c" ] && [ -f "$1" ]; then 40 | ffmpeg -i "${1}" -vn -codec:a libmp3lame -q:a 2 "${1%.*}.mp3" 41 | fi 42 | -------------------------------------------------------------------------------- /.config/nnn/plugins/mtpmount: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Toggle mount of MTP device (eg. Android device) 4 | # 'l' to list mountable devices 5 | # 'n' integer associated to device to mount 6 | # 'q'/'Return' exit 7 | # 8 | # Dependencies: gvfs-mtp 9 | # 10 | # Notes: The MTP device should be mounted at /run/user/$UID/gvfs. 11 | # Put /run/user/$UID/gvfs to bookmark entries (NNN_BMS) for faster access. 12 | # Make sure the device is unlocked when mounting. 13 | # 14 | # When doing copy-paste into MTP device, you will get an error like this: 15 | # cp: preserving times for './gambar1.png': Operation not supported 16 | # That just means the file is copied but timestamp won't be preserved. 17 | # It's like doing `cp -p localfile.txt file-to-SMB.txt`. 18 | # 19 | # Shell: POSIX compliant 20 | # Author: Benawi Adha 21 | 22 | prompt="Device number ('l' to list): " 23 | 24 | IFS=' 25 | ' 26 | 27 | lsmtp () { 28 | devs=$(gio mount -li | grep -e 'activation_root' | sed 's/\s*activation_root=//g') 29 | c=1 30 | printf "Devices list:\n" 31 | for i in $devs; do 32 | printf "%s %s\\n" "$c" "$i" 33 | c=$(( c + 1 )) 34 | done 35 | echo 36 | } 37 | 38 | lsmtp 39 | printf "%s" "$prompt" 40 | read -r input 41 | 42 | while [ -n "$input" ] 43 | do 44 | if [ "$input" = "l" ]; then 45 | lsmtp 46 | elif [ "$input" = "q" ] || [ "$input" -eq 0 ]; then 47 | exit 48 | elif [ "$input" -le "$(printf '%s\n' "${devs}" | grep -c '^')" ]; then 49 | # dev=$(printf "%s\n" "$devs" | cut -d$'\n' -f${input}) 50 | c=1 51 | for i in $devs; do 52 | dev=$i 53 | if [ "$input" -eq $c ]; then 54 | break 55 | fi 56 | c=$(( c + 1 )) 57 | done 58 | 59 | if (gio mount -l | grep '^Mount([1-9]).*'"$dev" ) 1>/dev/null; then 60 | if gio mount -u "${dev}"; then 61 | printf "%s unmounted\n" "$dev" 62 | fi 63 | else 64 | if gio mount "${dev}"; then 65 | printf "%s mounted to /run/user/\$UID/gvfs\n" "$dev" 66 | fi 67 | fi 68 | echo 69 | else 70 | printf "Invalid input\n" 71 | fi 72 | 73 | printf "%s" "$prompt" 74 | read -r input 75 | done 76 | 77 | -------------------------------------------------------------------------------- /.config/nnn/plugins/nbak: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Backup nnn configuration 4 | # - config dir content 5 | # - environment config 6 | # - shell functions and aliases 7 | # 8 | # Shell: POSIX compliant 9 | # Author: Léo Villeveygoux 10 | 11 | nnn_aliases="n nnn" 12 | 13 | outdir="nnn-$(whoami)@$(hostname)" 14 | 15 | outfile="${outdir}.tar.bz2" 16 | 17 | shellname="$(basename "$SHELL")" 18 | 19 | conffile="config.txt" 20 | 21 | configdir="${XDG_CONFIG_HOME:-$HOME/.config}/nnn" 22 | 23 | workdir="$PWD" 24 | 25 | tempdir="$(mktemp -d)" 26 | 27 | mkdir "$tempdir/$outdir" 28 | 29 | if [ ! -d "$tempdir" ]; then 30 | echo "Can't create work directory." >&2 31 | exit 1 32 | fi 33 | 34 | cd "$tempdir/$outdir" || exit 1 35 | 36 | # Backing up config dir content 37 | cp -r "$configdir" . || exit 1 38 | 39 | # Environment config 40 | env | sed "s/'/'\\\\''/" |\ 41 | awk '/^NNN_/{print "export '\''"$0"'\''"}' > "$conffile" 42 | 43 | # Shell functions/aliases 44 | case "$shellname" in 45 | bash) 46 | for name in $nnn_aliases ; do 47 | if [ "$(bash -ic "type -t $name")" = "function" ] ; then 48 | bash -ic "type $name" | tail -n+2 >> "$conffile" 49 | elif bash -ic "alias $name" >/dev/null 2>&1 ; then 50 | bash -ic "alias $name" >> "$conffile" 51 | fi 52 | done 53 | ;; 54 | zsh) 55 | for name in $nnn_aliases ; do 56 | if zsh -ic "functions $name" ; then 57 | zsh -ic "functions $name" >> "$conffile" 58 | elif zsh -ic "alias $name" ; then 59 | echo alias "$(zsh -ic "alias $name")" >> "$conffile" 60 | fi 61 | done 62 | ;; 63 | 64 | *) 65 | echo "Unknown shell, skipping alias/function checking." >&2 66 | ;; 67 | esac 68 | 69 | cd .. || exit 1 70 | 71 | printf "Saving as '%s' ... " "$workdir/$outfile" 72 | 73 | tar caf "$workdir/$outfile" "$outdir" && echo "Done" || echo "Failed" 74 | 75 | cd "$workdir" && rm -rf "$tempdir" 76 | -------------------------------------------------------------------------------- /.config/nnn/plugins/nmount: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Toggle mount status of a device using pmount 4 | # If the device is not mounted, it will be mounted. 5 | # If the device is mounted, it will be unmounted and powered down. 6 | # 7 | # Dependencies: lsblk, pmount 8 | # 9 | # Usage: Runs `lsblk` on 'l', exits on 'Return`. 10 | # 11 | # Notes: 12 | # - The script uses Linux-specific lsblk to list block devices. Alternatives: 13 | # macOS: "diskutil list" 14 | # BSD: "geom disk list" 15 | # - The script uses udisksctl (from udisks2) to power down devices. This is also Linux-specific. 16 | # Users on non-Linux platforms can comment it and use an alterntive to power-down disks. 17 | # 18 | # Shell: POSIX compliant 19 | # Author: Arun Prakash Jana 20 | 21 | prompt="device name [e.g. sdXn] ('l'ist, 'q'uit): " 22 | 23 | lsblk 24 | 25 | printf "\nEnsure you aren't still in the mounted device.\n" 26 | printf "%s" "$prompt" 27 | read -r dev 28 | 29 | while [ -n "$dev" ] 30 | do 31 | if [ "$dev" = "l" ]; then 32 | lsblk 33 | elif [ "$dev" = "q" ]; then 34 | exit 35 | else 36 | if grep -qs "$dev " /proc/mounts; then 37 | sync 38 | if pumount "$dev" 39 | then 40 | echo "$dev" unmounted. 41 | if udisksctl power-off -b /dev/"$dev" 42 | then 43 | echo "$dev" ejected. 44 | fi 45 | fi 46 | else 47 | pmount "$dev" 48 | echo "$dev" mounted to "$(lsblk -n /dev/"$dev" | rev | cut -d' ' -f1 | rev)". 49 | fi 50 | fi 51 | 52 | echo 53 | printf "%s" "$prompt" 54 | read -r dev 55 | done 56 | -------------------------------------------------------------------------------- /.config/nnn/plugins/oldbigfile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: List files bigger than input size by ascending access date. 4 | # 5 | # Dependencies: find sort 6 | # 7 | # Shell: POSIX compliant 8 | # Author: Arun Prakash Jana 9 | 10 | printf "Min file size (MB): " 11 | read -r size 12 | 13 | find . -size +"$size"M -type f -printf '%A+ %s %p\n' | sort 14 | 15 | echo "Press any key to exit" 16 | read -r _ 17 | -------------------------------------------------------------------------------- /.config/nnn/plugins/organize: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Organize files in directories by category 4 | # 5 | # Note: This plugin clears the selection as it changes the contents of the current dir 6 | # 7 | # Shell: POSIX compliant 8 | # Author: th3lusive 9 | 10 | sel=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection} 11 | 12 | organize() { 13 | case "$(file -biL "$1")" in 14 | *video*) 15 | [ ! -d "Videos" ] && mkdir "Videos" 16 | mv "$1" "Videos/$1" 17 | printf "Moved %s to Videos\n" "$1" ;; 18 | 19 | *audio*) [ ! -d "Audio" ] && mkdir "Audio" 20 | mv "$1" "Audio/$1" 21 | printf "Moved %s to Audio\n" "$1" ;; 22 | 23 | *image*) 24 | [ ! -d "Images" ] && mkdir "Images" 25 | mv "$1" "Images/$1" 26 | printf "Moved %s to Images\n" "$1" ;; 27 | 28 | *pdf*|*document*|*epub*|*djvu*|*cb*) 29 | [ ! -d "Documents" ] && mkdir "Documents" 30 | mv "$1" "Documents/$1" 31 | printf "Moved %s to Documents\n" "$1" ;; 32 | 33 | *text*) 34 | [ ! -d "Plaintext" ] && mkdir "Plaintext" 35 | mv "$1" "Plaintext/$1" 36 | printf "Moved %s to Plaintext\n" "$1" ;; 37 | 38 | *tar*|*xz*|*compress*|*7z*|*rar*|*zip*) 39 | [ ! -d "Archives" ] && mkdir "Archives" 40 | mv "$1" "Archives/$1" 41 | printf "Moved %s to Archives\n" "$1" ;; 42 | 43 | *binary*) 44 | [ ! -d "Binaries" ] && mkdir "Binaries" 45 | mv "$1" "Binaries/$1" 46 | printf "Moved %s to Binaries\n" "$1" ;; 47 | esac 48 | } 49 | 50 | main() { 51 | for file in * 52 | do 53 | [ -f "$file" ] && organize "$file" 54 | done 55 | 56 | # Clear selection 57 | if [ -s "$sel" ] && [ -p "$NNN_PIPE" ]; then 58 | printf "-" > "$NNN_PIPE" 59 | fi 60 | } 61 | 62 | main "$@" 63 | -------------------------------------------------------------------------------- /.config/nnn/plugins/pdfread: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Read a text or PDF file in British English 4 | # 5 | # Shell: POSIX compliant 6 | # Author: Arun Prakash Jana 7 | 8 | if [ -n "$1" ]; then 9 | tmpf="$(basename "$1")" 10 | tmpf="${TMPDIR:-/tmp}"/"${tmpf%.*}" 11 | 12 | if [ "$(head -c 4 "$1")" = "%PDF" ]; then 13 | # Convert using pdftotext 14 | pdftotext -nopgbrk -layout "$1" - | sed 's/\xe2\x80\x8b//g' > "$tmpf".txt 15 | 16 | pico2wave -w "$tmpf".wav -l en-GB "$(tr '\n' ' ' < "$tmpf".txt)" 17 | 18 | rm "$tmpf".txt 19 | else 20 | pico2wave -w "$tmpf".wav -l en-GB "$(tr '\n' ' ' < "$1")" 21 | fi 22 | 23 | # to jump around and note the time 24 | mpv "$tmpf".wav 25 | 26 | # flat read but better quality 27 | # play -qV0 "$tmpf".wav treble 2 gain -l 2 28 | 29 | rm "$tmpf".wav 30 | fi 31 | -------------------------------------------------------------------------------- /.config/nnn/plugins/pdfview: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: View a PDF file in pager 4 | # 5 | # Notes: 6 | # - $PAGER must be 'less -R' or 'most' 7 | # - To use mutool, uncomment the relevant lines and comment the pdftotext line 8 | # 9 | # Shell: POSIX compliant 10 | # Author: Arun Prakash Jana 11 | 12 | if ! [ -z "$1" ]; then 13 | if [ "$(head -c 4 "$1")" = "%PDF" ]; then 14 | # Convert using pdftotext 15 | pdftotext -nopgbrk -layout "$1" - | sed 's/\xe2\x80\x8b//g' | $PAGER 16 | 17 | # Convert using mutool 18 | # file=`basename "$1"` 19 | # txt=/tmp/"$file".txt 20 | # mutool convert -o "$txt" "$1" 21 | # eval $PAGER $txt 22 | # rm "$txt" 23 | fi 24 | fi 25 | -------------------------------------------------------------------------------- /.config/nnn/plugins/picker: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Pick files and pipe the newline-separated list to another utility 4 | # 5 | # Usage: 6 | # Copy this file in your $PATH, make it executable and preferably name it to picker. 7 | # Run commands like: 8 | # ls -l `picker` 9 | # cd `picker` 10 | # vimdiff `picker` 11 | # or, in fish shell: 12 | # ls -l (picker) 13 | # cd (picker) 14 | # vimdiff (picker) 15 | # 16 | # Note: This use case is limited to picking files, other functionality may not work as expected. 17 | # 18 | # Shell: POSIX compliant 19 | # Author: Arun Prakash Jana 20 | 21 | nnn -p /tmp/picked 22 | 23 | if [ -f /tmp/picked ]; then 24 | tr '\0' '\n' < /tmp/picked 25 | rm /tmp/picked 26 | fi 27 | -------------------------------------------------------------------------------- /.config/nnn/plugins/pskill: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Fuzzy list and kill a (zombie) process by name 4 | # 5 | # Dependencies: fzf, ps 6 | # 7 | # Note: To kill a zombie process enter "zombie" 8 | # 9 | # Shell: POSIX compliant 10 | # Author: Arun Prakash Jana 11 | 12 | printf "Enter process name ['defunct' for zombies]: " 13 | read -r psname 14 | 15 | # shellcheck disable=SC2009 16 | if [ -n "$psname" ]; then 17 | if type sudo >/dev/null 2>&1; then 18 | sucmd=sudo 19 | elif type doas >/dev/null 2>&1; then 20 | sucmd=doas 21 | else 22 | sucmd=: # noop 23 | fi 24 | 25 | if type fzf >/dev/null 2>&1; then 26 | fuzzy=fzf 27 | else 28 | exit 1 29 | fi 30 | 31 | cmd="$(ps -ax | grep -iw "$psname" | "$fuzzy" | sed -e 's/^[ \t]*//' | cut -d' ' -f1)" 32 | if [ -n "$cmd" ]; then 33 | $sucmd kill -9 "$cmd" 34 | fi 35 | fi 36 | -------------------------------------------------------------------------------- /.config/nnn/plugins/renamer: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Batch rename selection or current directory with qmv or vidir 4 | # 5 | # Notes: 6 | # - Try to mimic current batch rename functionality but with correct 7 | # handling of edge cases by qmv or vidir. 8 | # - Qmv opens with hidden files if no selection is used. Selected 9 | # directories are shown. 10 | # - Vidir don't show directories nor hidden files. 11 | # 12 | # Shell: POSIX compliant 13 | # Author: José Neder 14 | 15 | selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection} 16 | 17 | if type qmv >/dev/null 2>&1; then 18 | batchrenamesel="qmv -fdo -da" 19 | batchrename="qmv -fdo -a" 20 | elif type vidir >/dev/null 2>&1; then 21 | batchrenamesel="vidir" 22 | batchrename="vidir" 23 | else 24 | printf "there is not batchrename program installed." 25 | exit 26 | fi 27 | 28 | if [ -s "$selection" ]; then 29 | printf "rename selection? " 30 | read -r resp 31 | fi 32 | 33 | if [ "$resp" = "y" ]; then 34 | # -o flag is necessary for interactive editors 35 | xargs -o -0 $batchrenamesel < "$selection" 36 | 37 | # Clear selection 38 | if [ -p "$NNN_PIPE" ]; then 39 | printf "-" > "$NNN_PIPE" 40 | fi 41 | elif [ ! "$(LC_ALL=C ls -a)" = ". 42 | .." ]; then 43 | # On older systems that don't have ls -A 44 | $batchrename 45 | fi 46 | -------------------------------------------------------------------------------- /.config/nnn/plugins/ringtone: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Create an mp3 ringtone out of an audio file in any format 4 | # Needs user to provide start and end where to cut the file 5 | # Input file audio.ext results in audio_ringtone.mp3 6 | # 7 | # Tip: To convert a complete media file, set start as 0 and 8 | # the runtime of the file as end. 9 | # 10 | # Dependencies: date, ffmpeg 11 | # 12 | # Shell: POSIX compliant 13 | # Author: Arun Prakash Jana 14 | 15 | if [ -n "$1" ]; then 16 | printf "start (hh:mm:ss): " 17 | read -r start 18 | st=$(date -d "$start" +%s) || exit 1 19 | 20 | printf "end (hh:mm:ss): " 21 | read -r end 22 | et=$(date -d "$end" +%s) || exit 1 23 | 24 | if [ "$st" -ge "$et" ]; then 25 | printf "error: start >= end " 26 | read -r _ 27 | exit 1 28 | fi 29 | 30 | interval=$(( et - st )) 31 | 32 | outfile=$(basename "$1") 33 | outfile="${outfile%.*}"_ringtone.mp3 34 | 35 | ffmpeg -i "$1" -ss "$start" -t "$interval" -vn -sn -acodec libmp3lame -q:a 2 "$outfile" 36 | fi 37 | -------------------------------------------------------------------------------- /.config/nnn/plugins/rsynccp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Simple script to give copy-paste a progress percentage 4 | # by utilizing rsync. 5 | # 6 | # LIMITATION: this won't work when pasting to MTP device. 7 | # 8 | # Dependencies: rsync 9 | # 10 | # Shell: POSIX compliant 11 | # Author: Benawi Adha 12 | 13 | sel=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection} 14 | 15 | # Choose one of these two schemes by commenting 16 | 17 | # more verbose 18 | xargs -0 -a "$sel" -I % rsync -ah --progress % "$PWD" 19 | 20 | # less verbose 21 | # xargs -0 -a "$sel" -I % rsync -ah --info=progress2 % "$PWD" 22 | 23 | # Clear selection 24 | if [ -p "$NNN_PIPE" ]; then 25 | printf "-" > "$NNN_PIPE" 26 | fi 27 | -------------------------------------------------------------------------------- /.config/nnn/plugins/splitjoin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Splits the file passed as argument or joins selection 4 | # 5 | # Note: Adds numeric suffix to split files 6 | # Adds '.out suffix to the first file to be joined and saves as output file for join 7 | # 8 | # Shell: POSIX compliant 9 | # Authors: Arun Prakash Jana, ath3 10 | 11 | selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection} 12 | resp=s 13 | 14 | if [ -s "$selection" ]; then 15 | printf "press 's' (split current file) or 'j' (join selection): " 16 | read -r resp 17 | fi 18 | 19 | if [ "$resp" = "j" ]; then 20 | if [ -s "$selection" ]; then 21 | arr=$(tr '\0' '\n' < "$selection") 22 | if [ "$(echo "$arr" | wc -l)" -lt 2 ]; then 23 | echo "joining needs at least 2 files" 24 | exit 25 | fi 26 | for entry in $arr 27 | do 28 | if [ -d "$entry" ]; then 29 | echo "cant join directories" 30 | exit 31 | fi 32 | done 33 | 34 | file="$(basename "$(echo "$arr" | sed -n '1p' | sed -e 's/[0-9][0-9]$//')")" 35 | sort -z < "$selection" | xargs -0 -I{} cat {} > "${file}.out" 36 | 37 | # Clear selection 38 | if [ -p "$NNN_PIPE" ]; then 39 | printf "-" > "$NNN_PIPE" 40 | fi 41 | fi 42 | elif [ "$resp" = "s" ]; then 43 | if [ -n "$1" ] && [ -f "$1" ]; then 44 | # a single file is passed 45 | printf "split size in MB: " 46 | read -r size 47 | 48 | if [ -n "$size" ]; then 49 | split -d -b "$size"M "$1" "$1" 50 | fi 51 | fi 52 | fi 53 | -------------------------------------------------------------------------------- /.config/nnn/plugins/suedit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Edit file as superuser 4 | # 5 | # Shell: POSIX compliant 6 | # Author: Anna Arad 7 | 8 | EDITOR="${EDITOR:-vim}" 9 | 10 | if type sudo >/dev/null 2>&1; then 11 | sudo -E "$EDITOR" "$1" 12 | elif type sudoedit >/dev/null 2>&1; then 13 | sudoedit -E "$1" 14 | elif type doas >/dev/null 2>&1; then 15 | doas "$EDITOR" "$1" 16 | fi 17 | -------------------------------------------------------------------------------- /.config/nnn/plugins/togglex: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Toggles executable mode for selection 4 | # 5 | # Dependencies: chmod 6 | # 7 | # Note: Works _only_ with selection (nnn can toggle the mode for the hovered file) 8 | # 9 | # Shell: POSIX compliant 10 | # Author: Arun Prakash Jana 11 | 12 | selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection} 13 | 14 | if [ -s "$selection" ]; then 15 | xargs -0 -I {} sh -c 'if [ -x "{}" ] ; then chmod -x "{}" ; else chmod +x "{}" ; fi' < "$selection" 16 | 17 | # Clear selection 18 | if [ -p "$NNN_PIPE" ]; then 19 | printf "-" > "$NNN_PIPE" 20 | fi 21 | fi 22 | -------------------------------------------------------------------------------- /.config/nnn/plugins/treeview: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Show tree output in $EDITOR 4 | # 5 | # Shell: POSIX compliant 6 | # Author: Arun Prakash Jana 7 | 8 | tree -ps | $EDITOR - 9 | -------------------------------------------------------------------------------- /.config/nnn/plugins/uidgid: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: list uid and gid of files 4 | # 5 | # Note: To list UID and GID of all users in a pretty format, run: 6 | # 7 | # cut -d':' -f1,3,4,5 < /etc/passwd | column -ts ":" 8 | # 9 | # Shell: POSIX compliant 10 | # Authors: Arun Prakash Jana, superDuperCyberTechno 11 | 12 | # shellcheck disable=SC2012 13 | ls -lah --group-directories-first | less 14 | -------------------------------------------------------------------------------- /.config/nnn/plugins/umounttree: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Autodetects a nnn remote mountpoint (mounted with `c`) 4 | # from any of its subfolders and allows unmounting it 5 | # from the subdir without navigating to the mountppoint 6 | # or entering the remote name. Also works when hovering 7 | # the mountpoint directly like vanilla `u`. 8 | # 9 | # Dependencies: fusermount 10 | # 11 | # Shell: POSIX compliant 12 | # Authors: Kabouik & 0xACE 13 | # 14 | # TODO: 15 | # - Avoid lazy unmount by forcing nnn context to leave the subfolder before fusermount. 16 | # Tried `printf "%s" "0c$m" > "$NNN_PIPE"` but it breaks the nnn interface, see #854. 17 | 18 | err=0 19 | m=$HOME/.config/nnn/mounts 20 | if [ "$PWD" = "$m" ]; then 21 | # Allow running the script on hovered directory if user is in ~/.config/nnn/mounts 22 | d="$1" 23 | else 24 | d=$(dirname "$(readlink -f "$1")" | grep -oP "^$m\K.*" | cut -d"/" -f2) 25 | fi 26 | 27 | # Test if user is within $m or a subdir, abort if not 28 | if [ "$d" = "" ]; then 29 | clear && printf "You are not in a remote folder mounted with nnn. Press return to continue. " && read -r _ 30 | else 31 | # Test if $m/$d is a mountpoint and try unmounting if it is 32 | mountpoint -q -- "$m/$d" 33 | if [ "$?" -eq "1" ]; then 34 | clear && printf "Parent '%s' is not a mountpoint. Press return to continue. " "$d" && read -r _ 35 | else 36 | cd "$m" && fusermount -uq "$m/$d" || err=1 37 | if [ "$err" -eq "0" ]; then 38 | rmdir "$m/$d" && clear && printf "Parent '%s' unmounted." "$d" 39 | else 40 | clear && printf "Failed to unmount. Try lazy unmount? [Yy/Nn] " && read -r 41 | fi 42 | fi 43 | fi 44 | 45 | # If unmount fails, offer lazy unmount 46 | if [ "$REPLY" = "y" ] || [ "$REPLY" = "Y" ]; then 47 | err=0 48 | cd "$m" && fusermount -uqz "$m/$d" || err=1 49 | if [ "$err" -eq "0" ]; then 50 | rmdir "$m/$d" && clear && printf "Parent '%s' unmounted with lazy unmount. " "$d" 51 | fi 52 | fi 53 | -------------------------------------------------------------------------------- /.config/nnn/plugins/upgrade: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Check and update to latest version of nnn manually on Debian 9 Stretch 4 | # 5 | # Note: This script installs a package, should be issued with admin privilege 6 | # 7 | # Shell: POSIX-compliant 8 | # Author: Arun Prakash Jana 9 | 10 | cur="$(nnn -v)" 11 | new="$(curl -s "https://github.com/jarun/nnn/releases/latest" | grep -Eo "[0-9]+\.[0-9]+")" 12 | 13 | if [ "$cur" = "$new" ]; then 14 | echo 'Already at latest version' 15 | exit 0 16 | fi 17 | 18 | # get the package 19 | curl -Ls -O "https://github.com/jarun/nnn/releases/download/v$new/nnn_$new-1_debian9.amd64.deb" 20 | 21 | # install it 22 | sudo dpkg -i nnn_"$new"-1_debian9.amd64.deb 23 | 24 | # remove the file 25 | rm -rf nnn_"$new"-1_debian9.amd64.deb 26 | -------------------------------------------------------------------------------- /.config/nnn/plugins/upload: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Upload to Firefox Send if ffsend is found, else 4 | # Paste contents of a text a file http://ix.io 5 | # Upload a binary file to file.io 6 | # 7 | # Dependencies: ffsend (https://github.com/timvisee/ffsend), curl, jq, tr 8 | # 9 | # Note: Binary file set to expire after a week 10 | # 11 | # Shell: POSIX compliant 12 | # Author: Arun Prakash Jana 13 | 14 | if [ -n "$1" ] && [ -s "$1" ]; then 15 | if type ffsend >/dev/null 2>&1; then 16 | ffsend -fiq u "$1" 17 | elif [ "$(mimetype --output-format %m "$1" | awk -F '/' '{print $1}')" = "text" ]; then 18 | curl -F "f:1=@$1" ix.io 19 | else 20 | # Upload the file, show the download link and wait till user presses any key 21 | curl -s -F "file=@$1" https://file.io/?expires=1w | jq '.link' | tr -d '"' 22 | 23 | # To write download link to "$1".loc and exit 24 | # curl -s -F "file=@$1" https://file.io/?expires=1w -o `basename "$1"`.loc 25 | fi 26 | else 27 | printf "empty file!" 28 | fi 29 | 30 | read -r _ 31 | -------------------------------------------------------------------------------- /.config/nnn/plugins/vidthumb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Generate video thumbnails and view them 4 | # 5 | # Dependencies: 6 | # ffmpegthumbnailer: https://github.com/dirkvdb/ffmpegthumbnailer 7 | # lsix: https://github.com/hackerb9/lsix 8 | # 9 | # Shell: POSIX compliant 10 | # Author: Arun Prakash Jana 11 | 12 | mkdir .nthumbs > /dev/null 2>&1 13 | 14 | for file in *; do 15 | if [ -f "$file" ]; then 16 | ffmpegthumbnailer -i "$file" -o .nthumbs/"${file%%.*}".jpg 2> /dev/null 17 | fi 18 | done 19 | 20 | # render thumbnails in lsix 21 | lsix .nthumbs/* 22 | 23 | # remove the thumbnails 24 | rm -rf .nthumbs 25 | 26 | printf "Press any key to exit..." 27 | read -r _ 28 | -------------------------------------------------------------------------------- /.config/nnn/plugins/wall: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Set the selected image as wallpaper using nitrogen or pywal. 4 | # Usage: Hover on an image and run the script to set it as wallpaper. 5 | # 6 | # Shell: POSIX Compliant 7 | # Author: juacq97 8 | 9 | cmd_exists () { 10 | which "$1" > /dev/null 2>&1 11 | echo $? 12 | } 13 | 14 | if ! [ -z "$1" ]; then 15 | if [ "$(mimetype --output-format %m "$1" | awk -F '/' '{print $1}')" = "image" ]; then 16 | if [ "$(cmd_exists nitrogen)" -eq "0" ]; then 17 | nitrogen --set-zoom-fill --save "$1" 18 | elif [ "$(cmd_exists wal)" -eq "0" ]; then 19 | wal -i "$1" 20 | else 21 | printf "nitrogen ir pywal missing" 22 | read -r _ 23 | fi 24 | 25 | # If you want a system notification, uncomment the next 3 lines. 26 | # notify-send -a "nnn" "Wallpaper changed!" 27 | # else 28 | # notify-send -a "nnn" "No image selected" 29 | fi 30 | fi 31 | -------------------------------------------------------------------------------- /.config/nnn/plugins/wallpaper: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Set the selected image as wallpaper using nitrogen or pywal. 4 | # 5 | # Usage: Hover on an image and run the script to set it as wallpaper. 6 | # 7 | # Shell: POSIX compliant 8 | # Author: juacq97 9 | 10 | if [ -n "$1" ]; then 11 | if [ "$(file --mime-type "$1" | awk '{print $NF}' | awk -F '/' '{print $1}')" = "image" ]; then 12 | if type nitrogen >/dev/null 2>&1; then 13 | nitrogen --set-zoom-fill --save "$1" 14 | elif type wal >/dev/null 2>&1; then 15 | wal -i "$1" 16 | else 17 | printf "nitrogen or pywal missing" 18 | read -r _ 19 | fi 20 | 21 | # If you want a system notification, uncomment the next 3 lines. 22 | # notify-send -a "nnn" "Wallpaper changed!" 23 | # else 24 | # notify-send -a "nnn" "No image selected" 25 | fi 26 | fi 27 | -------------------------------------------------------------------------------- /.config/nnn/plugins/x2sel: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Copy system clipboard newline-separated file list to selection 4 | # 5 | # Dependencies: 6 | # - tr 7 | # - xclip/xsel (Linux) 8 | # - pbpaste (macOS) 9 | # - termux-clipboard-get (Termux) 10 | # - powershell (WSL) 11 | # - cygwim's /dev/clipboard (Cygwin) 12 | # - wl-paste (Wayland) 13 | # - clipboard (Haiku) 14 | # 15 | # Note: 16 | # - Limitation: breaks if a filename has newline in it 17 | # 18 | # Shell: POSIX compliant 19 | # Author: Léo Villeveygoux, after Arun Prakash Jana's .cbcp 20 | 21 | IFS="$(printf '%b_' '\n')"; IFS="${IFS%_}" # protect trailing \n 22 | 23 | selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection} 24 | 25 | getclip () { 26 | if type xsel >/dev/null 2>&1; then 27 | # Linux 28 | xsel -bo 29 | elif type xclip >/dev/null 2>&1; then 30 | # Linux 31 | xclip -sel clip -o 32 | elif type pbpaste >/dev/null 2>&1; then 33 | # macOS 34 | pbpaste 35 | elif type termux-clipboard-get >/dev/null 2>&1; then 36 | # Termux 37 | termux-clipboard-get 38 | elif type powershell.exe >/dev/null 2>&1; then 39 | # WSL 40 | powershell.exe Get-Clipboard 41 | elif [ -r /dev/clipboard ] ; then 42 | # Cygwin 43 | cat /dev/clipboard 44 | elif type wl-paste >/dev/null 2>&1; then 45 | # Wayland 46 | wl-paste 47 | elif type clipboard >/dev/null 2>&1; then 48 | # Haiku 49 | clipboard --print 50 | fi 51 | } 52 | 53 | CLIPBOARD=$(getclip) 54 | 55 | # Check if clipboard actually contains a file list 56 | for file in $CLIPBOARD ; do 57 | if [ ! -e "$file" ] ; then 58 | exit 1; 59 | fi 60 | done 61 | 62 | printf "%s" "$CLIPBOARD" | tr '\n' '\0' > "$selection" 63 | -------------------------------------------------------------------------------- /.config/nnn/plugins/xdgdefault: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Description: Sets the xdg-open's default application for the current entry's file 4 | # type. ${XDG_DATA_DIRS} and ${XDG_DATA_HOME} are set to the recommended 5 | # defaults if unset, as specified in XDG Base Directory Specification 6 | # - http://specifications.freedesktop.org/basedir-spec/. 7 | # 8 | # Dependencies: xdg-utils, fzf or dmenu (GUI) 9 | # 10 | # Shell: POSIX compliant 11 | # Author: lwnctd 12 | 13 | # set to 1 to enable GUI apps 14 | GUI="${GUI:-0}" 15 | 16 | if [ "$GUI" -ne 0 ] && command -v dmenu > /dev/null 2>& 1; then 17 | menu="dmenu -i -l 7" 18 | elif command -v fzf > /dev/null 2>& 1; then 19 | menu="fzf -e --tiebreak=begin" 20 | fi 21 | 22 | if [ -z "$1" ] || [ -z "$menu" ] > /dev/null 2>& 1; then 23 | exit 1 24 | fi 25 | 26 | ftype=$(xdg-mime query filetype "$2/$1") 27 | 28 | if [ -z "$ftype" ]; then 29 | exit 1 30 | fi 31 | 32 | dirs=${XDG_DATA_DIRS:-/usr/local/share:/usr/share} 33 | dirs=${dirs}:${XDG_DATA_HOME:-$HOME/.local/share}: 34 | 35 | while [ -n "$dirs" ]; do 36 | d=${dirs%%:*} 37 | if [ -n "$d" ] && [ -d "$d"/applications ]; then 38 | set -- "$@" "$d"/applications 39 | fi 40 | dirs=${dirs#*:} 41 | done 42 | 43 | app=$(find "$@" -iname '*.desktop' -exec grep '^Name=' {} + \ 44 | | sort -u -t ':' -k 1,1 \ 45 | | sed -E 's;.+/(.+desktop):Name=(.+);\2:\1;' \ 46 | | sort -t ':' -k 1,1 \ 47 | | column -t -s ':' -o "$(printf '\t')" \ 48 | | $menu \ 49 | | cut -f 2) 50 | 51 | if [ -n "$app" ]; then 52 | xdg-mime default "$app" "$ftype" 53 | fi 54 | -------------------------------------------------------------------------------- /.config/nvim/colors/wombat.vim: -------------------------------------------------------------------------------- 1 | " Maintainer: Lars H. Nielsen (dengmao@gmail.com) 2 | " Last Change: January 22 2007 3 | 4 | set background=dark 5 | 6 | hi clear 7 | 8 | if exists("syntax_on") 9 | syntax reset 10 | endif 11 | 12 | let colors_name = "wombat" 13 | 14 | 15 | " Vim >= 7.0 specific colors 16 | if version >= 700 17 | hi CursorLine guibg=#2d2d2d 18 | hi CursorColumn guibg=#2d2d2d 19 | hi MatchParen guifg=#f6f3e8 guibg=#857b6f gui=bold 20 | hi Pmenu guifg=#f6f3e8 guibg=#444444 21 | hi PmenuSel guifg=#000000 guibg=#cae682 22 | endif 23 | 24 | " General colors 25 | hi Cursor guifg=NONE guibg=#656565 gui=none 26 | hi Normal guifg=#f6f3e8 guibg=#242424 gui=none 27 | hi NonText guifg=#808080 guibg=#303030 gui=none 28 | hi LineNr guifg=#857b6f guibg=#000000 gui=none 29 | hi StatusLine guifg=#f6f3e8 guibg=#444444 gui=italic 30 | hi StatusLineNC guifg=#857b6f guibg=#444444 gui=none 31 | hi VertSplit guifg=#444444 guibg=#444444 gui=none 32 | hi Folded guibg=#384048 guifg=#a0a8b0 gui=none 33 | hi Title guifg=#f6f3e8 guibg=NONE gui=bold 34 | hi Visual guifg=#f6f3e8 guibg=#444444 gui=none 35 | hi SpecialKey guifg=#808080 guibg=#343434 gui=none 36 | 37 | " Syntax highlighting 38 | hi Comment guifg=#99968b gui=italic 39 | hi Todo guifg=#8f8f8f gui=italic 40 | hi Constant guifg=#e5786d gui=none 41 | hi String guifg=#95e454 gui=italic 42 | hi Identifier guifg=#cae682 gui=none 43 | hi Function guifg=#cae682 gui=none 44 | hi Type guifg=#cae682 gui=none 45 | hi Statement guifg=#8ac6f2 gui=none 46 | hi Keyword guifg=#8ac6f2 gui=none 47 | hi PreProc guifg=#e5786d gui=none 48 | hi Number guifg=#e5786d gui=none 49 | hi Special guifg=#e7f6da gui=none 50 | 51 | 52 | -------------------------------------------------------------------------------- /.config/pistol/pistol.conf: -------------------------------------------------------------------------------- 1 | application/json sh: jq --color-output '.' %pistol-filename% 2 | application/pdf sh: lines=$(tput lines); cols=$(tput cols); pdftoppm -jpeg -f 1 -singlefile %pistol-filename% | kitty +kitten icat --silent --place "${cols}"x"${lines}"@0x0 --transfer-mode=stream 3 | image/* kitty +kitten icat --silent --transfer-mode=stream --stdin=no %pistol-filename% 4 | text/* highlight --out-format=xterm256 --style=pablo %pistol-filename% 5 | inode/directory sh: eval $(dircolors ~/.dircolors); exa -T --level 2 --group-directories-first --colour=always %pistol-filename% 6 | audio/* mediainfo %pistol-filename% 7 | #*/*office* sh: NNN_PREVIEWDIR="${NNN_PREVIEWDIR:-$TMPDIR/nnn/previews}"; libreoffice --convert-to jpg "%pistol-filename%" --outdir "$NNN_PREVIEWDIR/${3%/*}" -------------------------------------------------------------------------------- /.config/ranger/colorschemes/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/ranger/colorschemes/__init__.py -------------------------------------------------------------------------------- /.config/ranger/colorschemes/__init__.pyo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/ranger/colorschemes/__init__.pyo -------------------------------------------------------------------------------- /.config/ranger/colorschemes/rangy.py: -------------------------------------------------------------------------------- 1 | # Ranger theme 2 | # Mod of Spacecolors 3 | 4 | from ranger.gui.colorscheme import ColorScheme 5 | from ranger.gui.color import * 6 | 7 | class Default(ColorScheme): 8 | def use(self, context): 9 | fg, bg, attr = default_colors 10 | 11 | if context.reset: 12 | return default_colors 13 | 14 | elif context.in_browser: 15 | if context.selected: 16 | attr = reverse 17 | else: 18 | attr = normal 19 | if context.empty or context.error: 20 | bg = red 21 | if context.border: 22 | attr |= bold 23 | fg = black 24 | if context.media: 25 | if context.image: 26 | fg = yellow 27 | else: 28 | fg = green 29 | if context.container: 30 | attr |= bold 31 | fg = magenta 32 | if context.directory: 33 | attr |= bold 34 | fg = black 35 | elif context.executable and not \ 36 | any((context.media, context.container, 37 | context.fifo, context.socket)): 38 | attr |= bold 39 | fg = green 40 | if context.socket: 41 | fg = magenta 42 | if context.fifo or context.device: 43 | fg = yellow 44 | if context.device: 45 | attr |= bold 46 | if context.link: 47 | fg = context.good and cyan or magenta 48 | if context.tag_marker and not context.selected: 49 | attr |= bold 50 | if fg in (red, magenta): 51 | fg = white 52 | else: 53 | fg = red 54 | if not context.selected and (context.cut or context.copied): 55 | fg = black 56 | attr |= bold 57 | if context.main_column: 58 | if context.selected: 59 | attr |= normal 60 | if context.marked: 61 | attr |= bold 62 | fg = yellow 63 | if context.badinfo: 64 | if attr & reverse: 65 | bg = magenta 66 | else: 67 | fg = magenta 68 | 69 | elif context.in_titlebar: 70 | attr |= bold 71 | if context.hostname: 72 | attr |= bold 73 | fg = context.bad and black or black 74 | elif context.directory: 75 | fg = cyan 76 | elif context.tab: 77 | if context.good: 78 | bg = green 79 | elif context.link: 80 | fg = cyan 81 | 82 | elif context.in_statusbar: 83 | if context.permissions: 84 | if context.good: 85 | fg = cyan 86 | elif context.bad: 87 | fg = magenta 88 | if context.marked: 89 | attr |= bold | reverse 90 | fg = yellow 91 | if context.message: 92 | if context.bad: 93 | attr |= bold 94 | fg = red 95 | 96 | if context.text: 97 | if context.highlight: 98 | attr |= reverse 99 | 100 | if context.in_taskview: 101 | if context.title: 102 | fg = blue 103 | 104 | if context.selected: 105 | attr |= reverse 106 | 107 | return fg, bg, attr 108 | -------------------------------------------------------------------------------- /.config/ranger/colorschemes/rangy.pyo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/ranger/colorschemes/rangy.pyo -------------------------------------------------------------------------------- /.config/ranger/colorschemes/zenburn.pyo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/ranger/colorschemes/zenburn.pyo -------------------------------------------------------------------------------- /.config/ranger/commands.py: -------------------------------------------------------------------------------- 1 | # This is a sample commands.py. You can add your own commands here. 2 | # 3 | # Please refer to commands_full.py for all the default commands and a complete 4 | # documentation. Do NOT add them all here, or you may end up with defunct 5 | # commands when upgrading ranger. 6 | 7 | # A simple command for demonstration purposes follows. 8 | # ----------------------------------------------------------------------------- 9 | 10 | from __future__ import (absolute_import, division, print_function) 11 | 12 | # You can import any python module as needed. 13 | import os 14 | 15 | # You always need to import ranger.api.commands here to get the Command class: 16 | from ranger.api.commands import Command 17 | 18 | 19 | # Any class that is a subclass of "Command" will be integrated into ranger as a 20 | # command. Try typing ":my_edit" in ranger! 21 | class my_edit(Command): 22 | # The so-called doc-string of the class will be visible in the built-in 23 | # help that is accessible by typing "?c" inside ranger. 24 | """:my_edit 25 | 26 | A sample command for demonstration purposes that opens a file in an editor. 27 | """ 28 | 29 | # The execute method is called when you run this command in ranger. 30 | def execute(self): 31 | # self.arg(1) is the first (space-separated) argument to the function. 32 | # This way you can write ":my_edit somefilename". 33 | if self.arg(1): 34 | # self.rest(1) contains self.arg(1) and everything that follows 35 | target_filename = self.rest(1) 36 | else: 37 | # self.fm is a ranger.core.filemanager.FileManager object and gives 38 | # you access to internals of ranger. 39 | # self.fm.thisfile is a ranger.container.file.File object and is a 40 | # reference to the currently selected file. 41 | target_filename = self.fm.thisfile.path 42 | 43 | # This is a generic function to print text in ranger. 44 | self.fm.notify("Let's edit the file " + target_filename + "!") 45 | 46 | # Using bad=True in fm.notify allows you to print error messages: 47 | if not os.path.exists(target_filename): 48 | self.fm.notify("The given file does not exist!", bad=True) 49 | return 50 | 51 | # This executes a function from ranger.core.acitons, a module with a 52 | # variety of subroutines that can help you construct commands. 53 | # Check out the source, or run "pydoc ranger.core.actions" for a list. 54 | self.fm.edit_file(target_filename) 55 | 56 | # The tab method is called when you press tab, and should return a list of 57 | # suggestions that the user will tab through. 58 | # tabnum is 1 for and -1 for by default 59 | def tab(self, tabnum): 60 | # This is a generic tab-completion function that iterates through the 61 | # content of the current directory. 62 | return self._tab_directory_content() 63 | -------------------------------------------------------------------------------- /.config/zsh/alias.zsh: -------------------------------------------------------------------------------- 1 | if [ $(uname) = Darwin ]; then 2 | alias ls='/usr/local/bin/gls --color=auto' 3 | elif command -v eza > /dev/null; then 4 | alias ls='eza --group-directories-first' 5 | fi 6 | 7 | # Kitty 8 | # https://gist.github.com/katef/fb4cb6d47decd8052bd0e8d88c03a102 9 | # https://twitter.com/thingskatedid/status/1316074032379248640 10 | alias icat="kitty +kitten icat --align left" 11 | alias kd="kitty +kitten diff" 12 | 13 | # nnn iconlookup likes gawk (GNU awk) 14 | alias awk=gawk 15 | 16 | if command -v fdfind > /dev/null; then 17 | alias fd=fdfind 18 | else 19 | alias fd=find 20 | fi 21 | 22 | if command -v batcat > /dev/null; then 23 | alias bat=batcat 24 | alias c=batcat 25 | alias b=batcat 26 | alias bp="batcat -p" 27 | else 28 | alias bat=cat 29 | alias c=cat 30 | alias b=cat 31 | alias bp=cat 32 | fi 33 | 34 | # Easier navigation: .., ..., ...., ....., ~ and - 35 | alias ..="cd .." 36 | alias ...="cd ../.." 37 | alias ....="cd ../../.." 38 | alias .....="cd ../../../.." 39 | alias -- -="cd -" 40 | 41 | # Shortcuts 42 | alias ci="cargo install --path ." 43 | alias g="git" 44 | alias ga="git add" 45 | alias gc="git commit -m" 46 | alias gca="git commit -a -m" 47 | alias gd="git diff" 48 | alias gp="git push" 49 | alias gs="git status" 50 | alias h="history" 51 | alias n="nnn -e -Pp" 52 | alias open="xdg-open" 53 | alias o="xdg-open" 54 | 55 | # Vim shortcuts 56 | if command -v nvim > /dev/null; then 57 | alias vi=nvim 58 | alias v=nvim 59 | else 60 | alias vi=vim 61 | alias v=vi 62 | fi 63 | 64 | alias vv="vim \$(z)" 65 | 66 | # Docker 67 | alias dbd="./.docker/bin/dump.sh" 68 | alias dp="docker ps" 69 | alias down='f(){ d rm -fsv $@; unset -f f; }; f' 70 | alias up='f(){ d build && d up -d $@; unset -f f; }; f' 71 | alias re='f(){ d rm -fsv $@ && d build && d up -d $@; unset -f f; }; f' 72 | alias ds="d exec php zsh -l" 73 | alias dsx="d exec php_xdebug zsh -l" 74 | alias de="d exec " 75 | alias dip="docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}'" 76 | alias lzd='lazydocker -f ./.docker/docker-compose.yml' 77 | 78 | if command -v eza > /dev/null; then 79 | alias l="eza -l --group-directories-first" 80 | alias la="eza -lag --group-directories-first" 81 | # List only directories and symbolic links that point to directories 82 | alias lsd='eza -ldg --group-directories-first *(-/DN)' 83 | # List only file beginning with "." 84 | alias lsa='eza -ldg --group-directories-first .*' 85 | else 86 | alias l="ls -F" 87 | alias ll="ls -h -l " 88 | alias la="ls -a" 89 | # List only directories and symbolic links that point to directories 90 | alias lsd='ls -ld *(-/DN)' 91 | # List only file beginning with "." 92 | alias lsa='ls -ld .*' 93 | fi 94 | 95 | if [[ -f /etc/arch-release ]] || [[ -f /etc/debian_version ]]; then 96 | alias grep="grep --color=auto" 97 | fi 98 | alias know="vim ${HOME}/.ssh/known_hosts" 99 | alias mc="mc --nosubshell" 100 | alias reload!=". ${HOME}/.zshrc" 101 | for method in GET HEAD POST PUT DELETE TRACE OPTIONS; do 102 | alias "$method"="lwp-request -m '$method'" 103 | done 104 | -------------------------------------------------------------------------------- /.config/zsh/archive/frameworks.zsh: -------------------------------------------------------------------------------- 1 | # Framework tests 2 | 3 | # Profiling method 1 4 | #zmodload zsh/zprof 5 | 6 | # Profiling method 2 7 | #zmodload zsh/datetime 8 | #setopt promptsubst 9 | #PS4='+$EPOCHREALTIME %N:%i> ' 10 | #exec 3>&2 2>/tmp/zshstart.$$.log 11 | #setopt xtrace prompt_subst 12 | 13 | # Checkout https://github.com/marlonrichert/zsh-snap 14 | 15 | FRAMEWORK="zplugin" # 0.14 16 | FRAMEWORK="oh-my-zsh" # 0.37 17 | FRAMEWORK="zpm" # 0.30 18 | FRAMEWORK="zeesh" # 0.08 19 | FRAMEWORK="zulu" # 0.39 20 | FRAMEWORK="antigen" # seconds! 21 | FRAMEWORK="zprezto" # 0.04 22 | FRAMEWORK="zim" # 0.03 23 | FRAMEWORK="zplug" # 0.09 24 | FRAMEWORK="zgen" # 0.03 25 | 26 | # Initialise plugin manager 27 | if [[ "$FRAMEWORK" = "antigen" ]] && [[ -s ${ZDOTDIR:-${HOME}}/.antigen/antigen.zsh ]]; then 28 | source ${ZDOTDIR:-${HOME}}/.antigen/antigen.zsh 29 | antigen bundle git 30 | antigen bundle zsh-users/zsh-autosuggestions 31 | antigen bundle zdharma/fast-syntax-highlighting 32 | antigen bundle zsh-users/zsh-history-substring-search 33 | antigen apply 34 | fi 35 | 36 | if [[ "$FRAMEWORK" = "zulu" ]] && [[ -s ${ZDOTDIR:-${HOME}}/.zulu/core/zulu ]]; then 37 | source "${ZULU_DIR:-"${ZDOTDIR:-$HOME}/.zulu"}/core/zulu" 38 | zulu init 39 | fi 40 | 41 | if [[ "$FRAMEWORK" = "oh-my-zsh" ]] && [[ -s ${ZDOTDIR:-${HOME}}/.oh-my-zsh/oh-my-zsh.sh ]]; then 42 | plugins=( 43 | git 44 | fasd 45 | osx 46 | zsh-autosuggestions 47 | ) 48 | 49 | export ZSH=$HOME/.oh-my-zsh 50 | source $ZSH/oh-my-zsh.sh 51 | fi 52 | 53 | if [[ "$FRAMEWORK" = "zim" ]] && [[ -s ${ZDOTDIR:-${HOME}}/.zim/init.zsh ]]; then 54 | source ${ZDOTDIR:-${HOME}}/.zim/init.zsh 55 | fi 56 | 57 | if [[ "$FRAMEWORK" = "zeesh" ]] && [[ -s ${ZDOTDIR:-${HOME}}/.zsh/zeesh.zsh ]]; then 58 | zeesh_plugins=( 59 | autocomplete 60 | git 61 | vcs-info 62 | syntax-highlighting 63 | history-substring-search 64 | ) 65 | 66 | source ${ZDOTDIR:-${HOME}}/.zsh/zeesh.zsh 67 | fi 68 | 69 | if [[ "$FRAMEWORK" = "zgen" ]]; then 70 | if [[ -s ${ZDOTDIR:-${HOME}}/.zgen/zgen.zsh ]]; then 71 | source ${ZDOTDIR:-${HOME}}/.zgen/zgen.zsh 72 | else 73 | git clone --recursive https://github.com/tarjoilija/zgen.git ${ZDOTDIR:-${HOME}}/.zgen 74 | source ${ZDOTDIR:-${HOME}}/.zgen/zgen.zsh 75 | fi 76 | # if the init scipt doesn't exist 77 | if ! zgen saved; then 78 | e_header "Creating a zgen save" 79 | 80 | # plugins 81 | zgen load zsh-users/zsh-autosuggestions 82 | zgen load bric3/nice-exit-code 83 | zgen load zdharma/fast-syntax-highlighting 84 | zgen load zsh-users/zsh-history-substring-search 85 | zgen oh-my-zsh plugins/shrink-path 86 | #zgen oh-my-zsh plugins/tmux 87 | # save all to init script 88 | zgen save 89 | fi 90 | fpath=(/${ZDOTDIR:-${HOME}}/.config/zsh/functions $fpath) 91 | fi 92 | 93 | if [[ "$FRAMEWORK" = "zplug" ]]; then 94 | if [[ -s ${ZDOTDIR:-${HOME}}/.zplug/init.zsh ]]; then 95 | source ${ZDOTDIR:-${HOME}}/.zplug/init.zsh 96 | else 97 | git clone --recursive https://github.com/zplug/zplug.git ${ZDOTDIR:-${HOME}}/.zplug 98 | source ${ZDOTDIR:-${HOME}}/.zplug/init.zsh 99 | fi 100 | # if the init scipt doesn't exist 101 | zplug zsh-users/zsh-autosuggestions 102 | zplug bric3/nice-exit-code 103 | zplug zdharma/fast-syntax-highlighting 104 | zplug zsh-users/zsh-history-substring-search 105 | zplug plugins/shrink-path, from:oh-my-zsh 106 | fpath=(/${ZDOTDIR:-${HOME}}/.config/zsh/functions $fpath) 107 | fi 108 | 109 | if [[ "$FRAMEWORK" = "zplugin" ]] && [[ -s ${ZDOTDIR:-${HOME}}/.zplugin/zplugin.zsh ]]; then 110 | source "$HOME/.zplugin/zplugin.zsh" 111 | zplugin load zsh-users/zsh-autosuggestions 112 | zplugin load zdharma/fast-syntax-highlighting 113 | zplugin snippet 'https://github.com/robbyrussell/oh-my-zsh/raw/master/plugins/git/git.plugin.zsh' 114 | zplugin load mafredri/zsh-async 115 | zplugin cdclear -q # <- forget completions provided up to this moment 116 | autoload -Uz compinit 117 | compinit -u 118 | 119 | zplugin cdreplay -q # -q is for quiet 120 | fi 121 | 122 | if [[ "$FRAMEWORK" = "zprezto" ]] && [[ -s ${ZDOTDIR:-${HOME}}/.zprezto/init.zsh ]]; then 123 | # Edit ~/.zpreztorc 124 | source "$HOME/.zprezto/init.zsh" 125 | fi 126 | 127 | if [[ "$FRAMEWORK" = "zpm" ]] then 128 | if [[ -f ~/.zpm/zpm.zsh ]]; then 129 | source ~/.zpm/zpm.zsh 130 | else 131 | git clone --recursive https://github.com/horosgrisa/zpm ~/.zpm 132 | source ~/.zpm/zpm.zsh 133 | fi 134 | fi 135 | 136 | # Profiling method 1 137 | #zprof | pbcopy 138 | 139 | # Profiling method 2 140 | #unsetopt xtrace 141 | #exec 2>&3 3>&- 142 | -------------------------------------------------------------------------------- /.config/zsh/cache/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/.config/zsh/cache/.keep -------------------------------------------------------------------------------- /.config/zsh/completion.zsh: -------------------------------------------------------------------------------- 1 | # Completion 2 | [ -d /usr/local/share/zsh-completions ] && fpath=(/usr/local/share/zsh-completions $fpath) 3 | zstyle ':completion::complete:*' use-cache on # completion caching, use rehash to clear 4 | zstyle ':completion:*' cache-path ${ZDOTDIR:-${HOME}}/.config/zsh/cache # cache path 5 | 6 | zstyle ':completion:*' auto-description 'specify: %d' 7 | zstyle ':completion:*' completer _expand _complete _correct _approximate 8 | 9 | zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31' 10 | zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd' 11 | 12 | # Case insensitive completion 13 | zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*' 14 | 15 | # Ignore completion functions for commands you don’t have 16 | zstyle ':completion:*:functions' ignored-patterns '_*' 17 | 18 | # Zstyle show completion menu if 2 or more items to select 19 | zstyle ':completion:*' menu select=2 20 | zstyle ':completion:*' menu select=long 21 | zstyle ':completion:*' list-colors '' 22 | zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} 23 | zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s 24 | zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s 25 | zstyle ':completion:*' use-compctl false 26 | 27 | # Format autocompletion style 28 | zstyle ':completion:*:descriptions' format "%{$fg[green]%}%d%{$reset_color%}" 29 | zstyle ':completion:*:corrections' format "%{$fg[orange]%}%d%{$reset_color%}" 30 | zstyle ':completion:*:messages' format "%{$fg[red]%}%d%{$reset_color%}" 31 | zstyle ':completion:*:warnings' format "%{$fg[red]%}%d%{$reset_color%}" 32 | zstyle ':completion:*' format "--[ %B%F{074}%d%f%b ]--" 33 | 34 | zstyle ':completion:*:*:*:*:*' menu select 35 | zstyle ':completion:*:matches' group 'yes' 36 | zstyle ':completion:*:options' description 'yes' 37 | zstyle ':completion:*:options' auto-description '%d' 38 | zstyle ':completion:*:default' list-prompt '%S%M matches%s' 39 | 40 | zstyle ':completion:*' group-name '' 41 | zstyle ':completion:*' verbose yes 42 | 43 | zstyle ':auto-fu:highlight' input white 44 | zstyle ':auto-fu:highlight' completion fg=black,bold 45 | zstyle ':auto-fu:highlight' completion/one fg=black,bold 46 | zstyle ':auto-fu:var' postdisplay $' -azfu-' 47 | zstyle ':auto-fu:var' track-keymap-skip opp 48 | #zstyle ':auto-fu:var' disable magic-space 49 | 50 | # Zstyle kill menu 51 | zstyle ':completion:*:*:kill:*' menu yes select 52 | zstyle ':completion:*:kill:*' force-list always 53 | zstyle ':completion:*:*:kill:*:processes' list-colors "=(#b) #([0-9]#)*=36=31" 54 | 55 | # Zstyle autocompletion 56 | zstyle ':auto-fu:highlight' input bold 57 | zstyle ':auto-fu:highlight' completion fg=black,bold 58 | zstyle ':auto-fu:highlight' completion/one fg=white,bold,underline 59 | zstyle ':auto-fu:var' postdisplay $'\n-azfu-' 60 | zstyle ':auto-fu:var' track-keymap-skip opp 61 | 62 | # History 63 | zstyle ':completion:*:history-words' stop yes 64 | zstyle ':completion:*:history-words' remove-all-dups yes 65 | zstyle ':completion:*:history-words' list false 66 | zstyle ':completion:*:history-words' menu yes 67 | -------------------------------------------------------------------------------- /.config/zsh/functions/prompt_tuurlijk_setup: -------------------------------------------------------------------------------- 1 | ../themes/tuurlijk.zsh-theme -------------------------------------------------------------------------------- /.config/zsh/keybindings.zsh: -------------------------------------------------------------------------------- 1 | # key=( 2 | # BackSpace "${terminfo[kbs]}" 3 | # Home "${terminfo[khome]}" 4 | # End "${terminfo[kend]}" 5 | # Insert "${terminfo[kich1]}" 6 | # Delete "${terminfo[kdch1]}" 7 | # Up "${terminfo[kcuu1]}" 8 | # Down "${terminfo[kcud1]}" 9 | # Left "${terminfo[kcub1]}" 10 | # Right "${terminfo[kcuf1]}" 11 | # PageUp "${terminfo[kpp]}" 12 | # PageDown "${terminfo[knp]}" 13 | # ) 14 | 15 | # Set Emacs key binding mode - ctrl+a to go to start of line 16 | bindkey -e 17 | bindkey '^w' backward-kill-word 18 | bindkey '^h' backward-delete-char 19 | autoload -U history-search-end 20 | zle -N history-beginning-search-backward-end history-search-end 21 | zle -N history-beginning-search-forward-end history-search-end 22 | bindkey "${terminfo[kcuu1]}" history-beginning-search-backward-end 23 | bindkey "${terminfo[kcud1]}" history-beginning-search-forward-end 24 | bindkey '^p' history-substring-search-up 25 | bindkey '^n' history-substring-search-down 26 | bindkey '^a' beginning-of-line 27 | bindkey '^e' end-of-line 28 | bindkey '^k' kill-line 29 | bindkey "^f" forward-word 30 | bindkey "^b" backward-word 31 | bindkey "${terminfo[khome]}" beginning-of-line 32 | bindkey "${terminfo[kend]}" end-of-line 33 | bindkey -M vicmd 'k' history-substring-search-up 34 | bindkey -M vicmd 'j' history-substring-search-down -------------------------------------------------------------------------------- /.config/zsh/style.zsh: -------------------------------------------------------------------------------- 1 | 2 | if [[ ${+FAST_HIGHLIGHT_STYLES} = 1 ]] 3 | then 4 | # Aliases and functions 5 | FAST_HIGHLIGHT_STYLES[alias]='fg=068' 6 | FAST_HIGHLIGHT_STYLES[function]='fg=028' 7 | 8 | # Commands and builtins 9 | FAST_HIGHLIGHT_STYLES[command]="fg=166" 10 | FAST_HIGHLIGHT_STYLES[hashed-command]="fg=blue" 11 | FAST_HIGHLIGHT_STYLES[builtin]="fg=202" 12 | 13 | # Paths 14 | FAST_HIGHLIGHT_STYLES[path]='fg=244' 15 | 16 | # Globbing 17 | FAST_HIGHLIGHT_STYLES[globbing]='fg=130,bold' 18 | 19 | # Options and arguments 20 | FAST_HIGHLIGHT_STYLES[single-hyphen-option]='fg=124' 21 | FAST_HIGHLIGHT_STYLES[double-hyphen-option]='fg=124' 22 | 23 | FAST_HIGHLIGHT_STYLES[back-quoted-argument]="fg=065" 24 | FAST_HIGHLIGHT_STYLES[single-quoted-argument]="fg=065" 25 | FAST_HIGHLIGHT_STYLES[double-quoted-argument]="fg=065" 26 | FAST_HIGHLIGHT_STYLES[dollar-double-quoted-argument]="fg=065" 27 | FAST_HIGHLIGHT_STYLES[back-double-quoted-argument]="fg=065" 28 | 29 | 30 | FAST_HIGHLIGHT_STYLES[default]='none' 31 | FAST_HIGHLIGHT_STYLES[unknown-token]='fg=red,bold' 32 | FAST_HIGHLIGHT_STYLES[reserved-word]='fg=green' 33 | FAST_HIGHLIGHT_STYLES[precommand]='none' 34 | FAST_HIGHLIGHT_STYLES[commandseparator]='fg=214' 35 | FAST_HIGHLIGHT_STYLES[history-expansion]='fg=blue' 36 | 37 | FAST_HIGHLIGHT_STYLES[assign]='none' 38 | 39 | # PATTERNS 40 | # rm -rf 41 | ZSH_HIGHLIGHT_PATTERNS+=('rm -rf *' 'fg=white,bold,bg=214') 42 | 43 | # Sudo 44 | ZSH_HIGHLIGHT_PATTERNS+=('sudo ' 'fg=white,bold,bg=214') 45 | fi -------------------------------------------------------------------------------- /.ghc/ghci.conf: -------------------------------------------------------------------------------- 1 | -- Lambda prompt 2 | -- Background color sequence = \ESC[48;5;236m 3 | -- where 4 | -- 236 = one of the 256 ansi color codes 5 | -- Foreground color sequence = \ESC[38;5;244m 6 | -- where 7 | -- 244 = one of the 256 ansi color codes 8 | -- Combined color sequence = \ESC[48;5;236;38;5;244m 9 | -- Reset color = \ESC[m 10 | -- 11 | -- https://en.wikipedia.org/wiki/ANSI_escape_code 12 | :set prompt "\ESC[48;5;236;38;5;244m %s\ESC[38;5;28m λ \ESC[48;5;;38;5;236m \ESC[m" 13 | -------------------------------------------------------------------------------- /.gitconfig: -------------------------------------------------------------------------------- 1 | [include] 2 | path = ~/.config/git/config 3 | [transfer] 4 | fsckObjects = true 5 | # To combat repository corruption! 6 | # Note: this global option applies during receive and transmit 7 | # https://git-scm.com/docs/git-config#git-config-transferfsckObjects 8 | # via https://groups.google.com/forum/#!topic/binary-transparency/f-BI4o8HZW0 9 | [giggle] 10 | compact-mode = false 11 | main-window-maximized = false 12 | main-window-geometry = 1918x1182+1440+0 13 | [core] 14 | excludesfile = ~/.gitignore 15 | autocrlf = input 16 | editor = vim 17 | # autocrlf = input 18 | # autocrlf = true 19 | # whitespace=fix,-indent-with-non-tab,trailing-space,cr-at-eol 20 | [color] 21 | ui = auto 22 | diff = true 23 | [color "branch"] 24 | current = 214 25 | local = 67 26 | remote = 34 27 | [color "diff"] 28 | meta = 214 29 | frag = 67 30 | old = 160 31 | new = 34 32 | whitespace = 160 reverse 33 | [color "status"] 34 | added = 214 35 | changed = 34 36 | untracked = 67 37 | [alias] 38 | lg = log --graph --pretty=format:'%Cred%h%Creset -%C(214)%d%Creset %s %C34(%cr) %C(67)<%an>%Creset' --abbrev-commit --date=relative 39 | st = status 40 | ci = commit 41 | br = branch 42 | co = checkout 43 | df = diff 44 | dc = diff --cached 45 | lol = log --graph --decorate --pretty=oneline --abbrev-commit 46 | lola = log --graph --decorate --pretty=oneline --abbrev-commit --all 47 | ls = ls-files 48 | tree = log --graph --decorate --pretty=oneline --abbrev-commit 49 | 50 | # Show files ignored by git: 51 | ign = ls-files -o -i --exclude-standard 52 | [branch] 53 | autosetuprebase = remote 54 | [commit] 55 | template = ~/.gitmessage.txt 56 | [diff "spaceman-diff"] 57 | command = ~/bin/spaceman-diff 58 | [difftool] 59 | prompt = false 60 | [mergetool] 61 | prompt = false 62 | [push] 63 | default = simple 64 | [filter "media"] 65 | required = true 66 | clean = git media clean %f 67 | smudge = git media smudge %f 68 | [filter "lfs"] 69 | clean = git-lfs clean %f 70 | smudge = git-lfs smudge %f 71 | required = true 72 | [gpg] 73 | program = /usr/local/bin/gpg 74 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | patreon: michielroos 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .ghc/ghci_history 2 | .vim/view 3 | .vim/view/* 4 | .vim/.netrwhist 5 | .vim/plugged 6 | .vim/sessions 7 | .vim/*/doc/tags 8 | .vim/backup/* 9 | backup/ 10 | .idea/ 11 | .mc/history 12 | *.zwc 13 | tags 14 | __pycache__/ 15 | *.py[cod] 16 | cache/ 17 | /.config/zsh/cache/ 18 | /.config/zsh/themes/env.zsh 19 | /.config/zsh/secrets.zsh 20 | /.config/kitty/env.conf 21 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule ".config/awesome/sharedtags"] 2 | path = .config/awesome/sharedtags 3 | url = git@github.com:Drauthius/awesome-sharedtags.git 4 | -------------------------------------------------------------------------------- /.gnuplot: -------------------------------------------------------------------------------- 1 | # Set colors 2 | red_000 = "#F9B7B0" 3 | red_025 = "#33cb4b16" 4 | red_050 = "#E62B17" 5 | red_075 = "#8F463F" 6 | red_100 = "#6D0D03" 7 | 8 | blue_000 = "#A9BDE6" 9 | blue_025 = "#0d73cc" 10 | blue_050 = "#1D4599" 11 | blue_075 = "#2F3F60" 12 | blue_100 = "#031A49" 13 | 14 | green_000 = "#A6EBB5" 15 | green_025 = "#3eb53e" 16 | green_050 = "#11AD34" 17 | green_075 = "#2F6C3D" 18 | green_100 = "#025214" 19 | 20 | brown_000 = "#F9E0B0" 21 | brown_025 = "#33ffaf5f" 22 | brown_050 = "#E69F17" 23 | brown_075 = "#8F743F" 24 | brown_100 = "#6D4903" 25 | 26 | grid_color = "#333333" 27 | text_color = "#586e75" 28 | #text_color = "#c0c0c0" 29 | 30 | # Set the font 31 | my_font = "Fira Sans Book, 13" 32 | #my_font = "Comic Neue, 13" 33 | #my_font = "Ubuntu, 13" 34 | my_font_title = "Ubuntu, 13" 35 | 36 | # Some variables 37 | my_line_width = 2 38 | my_axis_width = 1 39 | my_ps = 1 40 | resolution_x = 1024 41 | resolution_y = 768 42 | my_grid_width = 1 43 | 44 | # define the font for the terminal 45 | set terminal pngcairo enhanced size resolution_x, resolution_y enhanced font my_font 46 | 47 | # Define the position of the legend 48 | set key top left 49 | 50 | # set default point size 51 | set pointsize my_ps 52 | 53 | # FIXME use palette? http://www.gnuplotting.org/tag/linestyle/ 54 | # Set the line styles 55 | set style line 1 linecolor rgbcolor blue_025 linewidth my_line_width pt 7 56 | set style line 2 linecolor rgbcolor green_025 linewidth my_line_width pt 5 57 | set style line 3 linecolor rgbcolor red_025 linewidth my_line_width pt 9 58 | set style line 4 linecolor rgbcolor brown_025 linewidth my_line_width pt 13 59 | set style line 5 linecolor rgbcolor blue_050 linewidth my_line_width pt 11 60 | set style line 6 linecolor rgbcolor green_050 linewidth my_line_width pt 7 61 | set style line 7 linecolor rgbcolor red_050 linewidth my_line_width pt 5 62 | set style line 8 linecolor rgbcolor brown_050 linewidth my_line_width pt 9 63 | set style line 9 linecolor rgbcolor blue_075 linewidth my_line_width pt 13 64 | set style line 10 linecolor rgbcolor green_075 linewidth my_line_width pt 11 65 | set style line 11 linecolor rgbcolor red_075 linewidth my_line_width pt 7 66 | set style line 12 linecolor rgbcolor brown_075 linewidth my_line_width pt 5 67 | set style line 13 linecolor rgbcolor blue_100 linewidth my_line_width pt 9 68 | set style line 14 linecolor rgbcolor green_100 linewidth my_line_width pt 13 69 | set style line 15 linecolor rgbcolor red_100 linewidth my_line_width pt 11 70 | set style line 16 linecolor rgbcolor brown_100 linewidth my_line_width pt 7 71 | set style line 17 linecolor rgbcolor text_color linewidth my_line_width pt 5 72 | set style line 18 linecolor rgbcolor grid_color lt 1 linewidth my_axis_width 73 | set style line 19 linecolor rgbcolor grid_color lt 0 linewidth my_grid_width 74 | 75 | # this is to use the user-defined styles we just defined. 76 | set style increment user 77 | 78 | # set the color and font of the text of the axis 79 | set xtics textcolor rgb text_color font my_font 80 | set ytics textcolor rgb text_color font my_font 81 | set y2tics textcolor rgb text_color font my_font 82 | set ztics textcolor rgb text_color font my_font 83 | 84 | # set the color and font (and a default text) for the title and each axis 85 | set title "Top Title" textcolor rgb text_color font my_font_title 86 | set xlabel "X Label (unit)" textcolor rgb text_color font my_font 87 | set ylabel "Y Label (unit)" textcolor rgb text_color font my_font 88 | set y2label "Y Label (unit)" textcolor rgb text_color font my_font 89 | set zlabel "Z Label (unit)" textcolor rgb text_color font my_font 90 | 91 | # set the text color and font for the label 92 | set label textcolor rgb text_color font my_font 93 | 94 | set key textcolor rgb text_color font my_font 95 | 96 | # set the color and width of the axis border 97 | set border 31 lw my_axis_width lc rgb text_color 98 | 99 | # Set the border color 100 | set border 3 back ls 18 101 | set tics nomirror 102 | 103 | # Set a grid in the back ground 104 | set grid back ls 19 105 | 106 | set encoding utf8 107 | -------------------------------------------------------------------------------- /.mc/Tree: -------------------------------------------------------------------------------- 1 | Midnight Commander TreeStore v 2.0 2 | -------------------------------------------------------------------------------- /.mc/ini: -------------------------------------------------------------------------------- 1 | 2 | [Midnight-Commander] 3 | show_backups=1 4 | show_dot_files=1 5 | verbose=1 6 | mark_moves_down=1 7 | pause_after_run=1 8 | shell_patterns=1 9 | auto_save_setup=1 10 | auto_menu=0 11 | use_internal_view=0 12 | use_internal_edit=0 13 | clear_before_exec=1 14 | mix_all_files=0 15 | fast_reload=0 16 | fast_reload_msg_shown=0 17 | confirm_delete=1 18 | confirm_overwrite=1 19 | confirm_execute=0 20 | confirm_exit=0 21 | safe_delete=0 22 | mouse_repeat_rate=100 23 | double_click_speed=250 24 | eight_bit_clean=1 25 | full_eight_bits=0 26 | use_8th_bit_as_meta=0 27 | confirm_view_dir=0 28 | mouse_move_pages=1 29 | mouse_move_pages_viewer=1 30 | fast_refresh=0 31 | navigate_with_arrows=0 32 | drop_menus=0 33 | wrap_mode=1 34 | old_esc_mode=0 35 | cd_symlinks=1 36 | show_all_if_ambiguous=0 37 | have_fast_cpu=0 38 | max_dirt_limit=10 39 | torben_fj_mode=0 40 | use_file_to_guess_type=1 41 | alternate_plus_minus=0 42 | only_leading_plus_minus=1 43 | show_output_starts_shell=0 44 | panel_scroll_pages=1 45 | xtree_mode=0 46 | num_history_items_recorded=60 47 | file_op_compute_totals=1 48 | vfs_timeout=60 49 | ftpfs_directory_timeout=900 50 | use_netrc=1 51 | ftpfs_retry_seconds=30 52 | ftpfs_always_use_proxy=0 53 | ftpfs_use_passive_connections=1 54 | ftpfs_use_unix_list_options=1 55 | ftpfs_first_cd_then_ls=0 56 | editor_word_wrap_line_length=72 57 | editor_key_emulation=0 58 | editor_tab_spacing=8 59 | editor_fill_tabs_with_spaces=0 60 | editor_return_does_auto_indent=1 61 | editor_backspace_through_tabs=0 62 | editor_fake_half_tabs=1 63 | editor_option_save_mode=0 64 | editor_option_save_position=1 65 | editor_option_backup_ext_int=-1 66 | editor_option_auto_para_formatting=0 67 | editor_option_typewriter_wrap=0 68 | editor_edit_confirm_save=1 69 | editor_syntax_highlighting=1 70 | nice_rotating_dash=1 71 | horizontal_split=0 72 | 73 | kilobyte_si=0 74 | confirm_directory_hotlist_delete=1 75 | mouse_close_dialog=0 76 | ftpfs_use_passive_connections_over_proxy=0 77 | fish_directory_timeout=900 78 | editor_persistent_selections=1 79 | editor_cursor_beyond_eol=1 80 | editor_visible_tabs=1 81 | editor_visible_spaces=1 82 | editor_line_state=0 83 | editor_simple_statusbar=0 84 | editor_check_new_line=0 85 | mcview_remember_file_position=0 86 | auto_fill_mkdir_name=1 87 | reverse_files_only=1 88 | copymove_persistent_attr=1 89 | select_flags=6 90 | editor_backup_extension=~ 91 | skin=default 92 | keymap=mc.keymap 93 | auto_save_setup_panels=1 94 | 95 | confirm_history_cleanup=1 96 | old_esc_mode_timeout=1000000 97 | classic_progressbar=1 98 | editor_show_right_margin=0 99 | mcview_eof= 100 | scroll_pages=1 101 | filetype_mode=1 102 | permission_mode=0 103 | quick_search_case_sensitive=2 104 | ignore_ftp_chattr_errors=true 105 | 106 | [Layout] 107 | equal_split=1 108 | first_panel_size=65 109 | message_visible=1 110 | keybar_visible=1 111 | xterm_title=1 112 | output_lines=0 113 | command_prompt=1 114 | menubar_visible=1 115 | show_mini_info=1 116 | permission_mode=0 117 | filetype_mode=1 118 | 119 | free_space=1 120 | 121 | [Dirs] 122 | other_dir=/Users/michiel 123 | current_is_left=0 124 | 125 | [New Left Panel] 126 | display=listing 127 | reverse=0 128 | case_sensitive=1 129 | sort_order=name 130 | list_mode=full 131 | user_format=half type name | size | perm 132 | user_status0=half type name | size | perm 133 | user_status1=half type name | size | perm 134 | user_status2=half type name | size | perm 135 | user_status3=half type name | size | perm 136 | user_mini_status=0 137 | 138 | [New Right Panel] 139 | display=listing 140 | reverse=0 141 | case_sensitive=1 142 | sort_order=name 143 | list_mode=full 144 | user_format=half type name | size | perm 145 | user_status0=half type name | size | perm 146 | user_status1=half type name | size | perm 147 | user_status2=half type name | size | perm 148 | user_status3=half type name | size | perm 149 | user_mini_status=0 150 | 151 | [Misc] 152 | ftpfs_password=anonymous@ 153 | ftp_proxy_host=gate 154 | 155 | find_ignore_dirs= 156 | display_codepage=UTF-8 157 | source_codepage=Other_8_bit 158 | 159 | timeformat_recent=%b %e %H:%M 160 | timeformat_old=%b %e %Y 161 | autodetect_codeset= 162 | clipboard_store= 163 | clipboard_paste= 164 | 165 | [Colors] 166 | base_color= 167 | xterm-256color= 168 | color_terminals= 169 | 170 | [Panels] 171 | kilobyte_si=false 172 | mix_all_files=false 173 | show_backups=true 174 | show_dot_files=true 175 | fast_reload=false 176 | fast_reload_msg_shown=false 177 | mark_moves_down=true 178 | reverse_files_only=true 179 | auto_save_setup_panels=true 180 | navigate_with_arrows=false 181 | panel_scroll_pages=true 182 | mouse_move_pages=true 183 | filetype_mode=true 184 | permission_mode=false 185 | quick_search_mode=2 186 | 187 | [Panelize] 188 | Zoek SUID en SGID programma's=find . \\( \\( -perm -04000 -a -perm +011 \\) -o \\( -perm -02000 -a -perm +01 \\) \\) -print 189 | Zoek geweigerde patchfragmenten=find . -name \\*.rej -print 190 | Zoek naar *.orig naar het patchen=find . -name \\*.orig -print 191 | 192 | -------------------------------------------------------------------------------- /.mc/panels.ini: -------------------------------------------------------------------------------- 1 | 2 | [Dirs] 3 | other_dir=/Users/michiel 4 | current_is_left=1 5 | 6 | [New Left Panel] 7 | display=listing 8 | reverse=0 9 | case_sensitive=1 10 | sort_order=name 11 | list_mode=full 12 | user_format=half type name | size | perm 13 | user_status0=half type name | size | perm 14 | user_status1=half type name | size | perm 15 | user_status2=half type name | size | perm 16 | user_status3=half type name | size | perm 17 | user_mini_status=0 18 | 19 | exec_first=0 20 | 21 | [New Right Panel] 22 | display=listing 23 | reverse=0 24 | case_sensitive=1 25 | sort_order=name 26 | list_mode=full 27 | user_format=half type name | size | perm 28 | user_status0=half type name | size | perm 29 | user_status1=half type name | size | perm 30 | user_status2=half type name | size | perm 31 | user_status3=half type name | size | perm 32 | user_mini_status=0 33 | 34 | exec_first=0 35 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | prefix=~/.npm-packages -------------------------------------------------------------------------------- /.tmux.conf: -------------------------------------------------------------------------------- 1 | # Plugins - https://github.com/tmux-plugins/tpm 2 | set -g @plugin 'tmux-plugins/tpm' 3 | set -g @plugin 'tmux-plugins/tmux-yank' 4 | set -g @plugin 'tmux-plugins/tmux-resurrect' 5 | set -g @plugin 'tmux-plugins/tmux-continuum' 6 | 7 | run -b $HOME/.tmux/plugins/tpm/tpm 8 | 9 | # Enable restore 10 | set -g @continuum-restore 'on' 11 | 12 | if-shell "test -f ${HOME}/.tmux/airline" "source ${HOME}/.tmux/airline" 13 | set -g default-terminal "xterm-256color" 14 | set-option -g default-shell $SHELL 15 | set -g assume-paste-time 0 16 | 17 | # SSH Agent fix https://gist.github.com/admackin/4507371 18 | set -g update-environment "DISPLAY SSH_ASKPASS SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY" 19 | set-environment -g SSH_AUTH_SOCK $HOME/.ssh/ssh-auth-sock.$HOSTNAME 20 | 21 | # Show pane title in border 22 | # set -g pane-border-status top 23 | 24 | # tmux 2.1+ mouse configuration 25 | set -g mouse on 26 | 27 | # Lower escape timing from 500ms to 50ms for quicker response to scroll-buffer access. 28 | set -s escape-time 0 29 | 30 | # re-map C-b to C-a 31 | set -g prefix C-a 32 | unbind-key C-b 33 | bind-key C-a send-prefix 34 | 35 | # Note to self regarding splits: 36 | # Ctrl+a " - split pane horizontally. 37 | # Ctrl+a % - split pane vertically. 38 | # Ctrl+a arrow key - switch pane. 39 | # Hold Ctrl+a, don't release it and hold one of the arrow keys - resize pane. 40 | # Ctrl+a c - (c)reate a new window. 41 | # Ctrl+a n - move to the (n)ext window. 42 | # Ctrl+a p - move to the (p)revious window. 43 | 44 | # Split vertically using the pipe character 45 | bind / split-window -h -c "#{pane_current_path}" 46 | 47 | # Split horizontally using the dash 48 | bind - split-window -v -c "#{pane_current_path}" 49 | 50 | bind-key j command-prompt -p "join pane from:" "join-pane -s '%%'" 51 | bind-key S command-prompt -p "send pane to:" "join-pane -t '%%'" 52 | bind-key m command-prompt -p "move window to number:" "move-window -t '%%'" 53 | bind-key s command-prompt -p "switch this window with number:" "swap-window -t '%%'" 54 | bind-key r source-file ~/.tmux.conf \; display-message "tmux.conf reloaded." 55 | 56 | # Rebind navigating panes/splits to vi movements 57 | bind h select-pane -L 58 | bind j select-pane -D 59 | bind k select-pane -U 60 | bind l select-pane -R 61 | 62 | # History 63 | set -g history-limit 10000 64 | 65 | # Use vi mode keys 66 | setw -g mode-keys vi 67 | 68 | # Copy mode 69 | bind ` copy-mode 70 | unbind [ 71 | unbind p 72 | bind p paste-buffer 73 | bind-key -T copy-mode-vi Escape send -X cancel 74 | 75 | # Apply some overrides to the defaults 76 | set-option -g status-position top 77 | 78 | # Start counting windows at 1 instead of 0, so the shortcuts for tabs match those of iTerm2 79 | set -g base-index 1 80 | 81 | # Start counting panes at 1 instead of 0 82 | set-window-option -g pane-base-index 1 83 | 84 | # Activity monitoring 85 | setw -g monitor-activity on 86 | set -g visual-activity on 87 | 88 | # Rather than constraining window size to the maximum size of any client 89 | # connected to the *session*, constrain window size to the maximum size of any 90 | # client connected to *that window*. Much more reasonable. 91 | setw -g aggressive-resize off 92 | 93 | # Set quieter border styles 94 | set -g pane-border-style fg=colour59,bg=default 95 | set -g pane-active-border-style fg=colour130,bg=default 96 | 97 | # vim:set ft=tmux: 98 | -------------------------------------------------------------------------------- /.tmux/airline: -------------------------------------------------------------------------------- 1 | # This tmux statusbar config was created by tmuxline.vim 2 | # on Fri, 19 May 2017 3 | 4 | set -g status-bg "colour234" 5 | #set -g message-command-fg "colour250" 6 | set -g status-justify "left" 7 | set -g status-left-length "100" 8 | set -g status "on" 9 | #set -g pane-active-border-fg "colour245" 10 | #set -g message-bg "colour238" 11 | set -g status-right-length "100" 12 | #set -g status-right-attr "none" 13 | #set -g message-fg "colour250" 14 | #set -g message-command-bg "colour238" 15 | #set -g status-attr "none" 16 | #set -g status-utf8 "on" 17 | #set -g pane-border-fg "colour238" 18 | #set -g status-left-attr "none" 19 | #setw -g window-status-fg "colour245" 20 | #setw -g window-status-attr "none" 21 | #setw -g window-status-activity-bg "colour234" 22 | #setw -g window-status-activity-attr "none" 23 | #setw -g window-status-activity-fg "colour245" 24 | setw -g window-status-separator "" 25 | #setw -g window-status-bg "colour234" 26 | set -g status-left "#[fg=colour16,bg=colour245] #S #[fg=colour245,bg=colour234,nobold,nounderscore,noitalics]" 27 | #set -g status-right "#[fg=colour238,bg=colour234,nobold,nounderscore,noitalics]#[fg=colour250,bg=colour238] #{pane_current_path}  %Y-%m-%d  %H:%M #[fg=colour245,bg=colour238,nobold,nounderscore,noitalics]#[fg=colour16,bg=colour245] #h " 28 | set -g status-right "#[fg=colour238,bg=colour234,nobold,nounderscore,noitalics]#[fg=colour250,bg=colour238] #{pane_current_path} #[fg=colour245,bg=colour238,nobold,nounderscore,noitalics]#[fg=colour16,bg=colour245] #h " 29 | setw -g window-status-format "#[fg=colour245,bg=colour234] #I #[fg=colour245,bg=colour234] #W " 30 | setw -g window-status-current-format "#[fg=colour234,bg=colour238,nobold,nounderscore,noitalics]#[fg=colour250,bg=colour238] #I #[fg=colour250,bg=colour238] #W #[fg=colour238,bg=colour234,nobold,nounderscore,noitalics]" 31 | -------------------------------------------------------------------------------- /.vim/colors/wombat.vim: -------------------------------------------------------------------------------- 1 | " Maintainer: Lars H. Nielsen (dengmao@gmail.com) 2 | " Last Change: January 22 2007 3 | 4 | set background=dark 5 | 6 | hi clear 7 | 8 | if exists("syntax_on") 9 | syntax reset 10 | endif 11 | 12 | let colors_name = "wombat" 13 | 14 | 15 | " Vim >= 7.0 specific colors 16 | if version >= 700 17 | hi CursorLine guibg=#2d2d2d 18 | hi CursorColumn guibg=#2d2d2d 19 | hi MatchParen guifg=#f6f3e8 guibg=#857b6f gui=bold 20 | hi Pmenu guifg=#f6f3e8 guibg=#444444 21 | hi PmenuSel guifg=#000000 guibg=#cae682 22 | endif 23 | 24 | " General colors 25 | hi Cursor guifg=NONE guibg=#656565 gui=none 26 | hi Normal guifg=#f6f3e8 guibg=#242424 gui=none 27 | hi NonText guifg=#808080 guibg=#303030 gui=none 28 | hi LineNr guifg=#857b6f guibg=#000000 gui=none 29 | hi StatusLine guifg=#f6f3e8 guibg=#444444 gui=italic 30 | hi StatusLineNC guifg=#857b6f guibg=#444444 gui=none 31 | hi VertSplit guifg=#444444 guibg=#444444 gui=none 32 | hi Folded guibg=#384048 guifg=#a0a8b0 gui=none 33 | hi Title guifg=#f6f3e8 guibg=NONE gui=bold 34 | hi Visual guifg=#f6f3e8 guibg=#444444 gui=none 35 | hi SpecialKey guifg=#808080 guibg=#343434 gui=none 36 | 37 | " Syntax highlighting 38 | hi Comment guifg=#99968b gui=italic 39 | hi Todo guifg=#8f8f8f gui=italic 40 | hi Constant guifg=#e5786d gui=none 41 | hi String guifg=#95e454 gui=italic 42 | hi Identifier guifg=#cae682 gui=none 43 | hi Function guifg=#cae682 gui=none 44 | hi Type guifg=#cae682 gui=none 45 | hi Statement guifg=#8ac6f2 gui=none 46 | hi Keyword guifg=#8ac6f2 gui=none 47 | hi PreProc guifg=#e5786d gui=none 48 | hi Number guifg=#e5786d gui=none 49 | hi Special guifg=#e7f6da gui=none 50 | 51 | 52 | -------------------------------------------------------------------------------- /.vim/filetype.vim: -------------------------------------------------------------------------------- 1 | au BufRead,BufNewFile /etc/nginx/* set ft=nginx 2 | au BufRead,BufNewFile *.less set ft=css 3 | au BufRead,BufNewFile *.vcl set ft=vcl 4 | au BufRead,BufNewFile *.zsh-theme set ft=zsh 5 | au BufRead,BufNewFile tmux.conf set ft=tmux 6 | -------------------------------------------------------------------------------- /.vim/snippets/extjs.snippets: -------------------------------------------------------------------------------- 1 | snippet apply 2 | Ext.apply(${1:config}, { 3 | ${2:// code...} 4 | }); 5 | snippet aifc 6 | config = config || {}; 7 | 8 | Ext.applyIf(config, { 9 | ${2:// code...} 10 | }); 11 | snippet aif 12 | Ext.applyIf(${1:config}, { 13 | ${2:// code...} 14 | }); 15 | snippet each 16 | Ext.each(${1:Array}, ${2:function(${3}) { 17 | ${5} 18 | }${4:, this}); 19 | snippet extend 20 | (function() { 21 | /** 22 | * ${1:MyNamespace}.${2:MyClass} 23 | * @extends ${3:extendsClass} 24 | * ${4:description} 25 | */ 26 | $1.$2 = Ext.extend($3, { 27 | 28 | initComponent: function() { 29 | Ext.apply(this, { 30 | ${6:// code...} 31 | }); 32 | 33 | $1.$2.superclass.initComponent.apply(this, arguments); 34 | } 35 | }); 36 | 37 | Ext.reg('${5:xtype}', $1.$2); 38 | })(); 39 | snippet button 40 | new Ext.Button({ 41 | ui: '${1:round}', 42 | text: '${2:Button}', 43 | handler: function (button, event) { 44 | ${3:// code...} 45 | } 46 | }); 47 | snippet carousel 48 | new Ext.Carousel({ 49 | direction: '${1:horizontal}', 50 | ui: '${2:dark}', 51 | indicator: '${3:true}', 52 | defaults: { 53 | cls: 'card' 54 | }, 55 | items: [ 56 | ${4:// items...} 57 | ] 58 | }); 59 | snippet datepicker 60 | new Ext.DatePicker({ 61 | yearFrom: ${1:2000}, 62 | yearTo: ${2:2015} 63 | }); 64 | snippet list 65 | new Ext.List({ 66 | fullscreen: ${1:true}, 67 | 68 | itemTpl: '${2}', 69 | grouped: '${3:true}', 70 | indexBar: '${4:true}', 71 | 72 | ${5:data: [],} 73 | ${6:store: store} 74 | }); 75 | snippet map 76 | new Ext.Panel({ 77 | fullscreen: ${1:true}, 78 | items: [ 79 | { 80 | xtype: 'map', 81 | useCurrentLocation: ${2:true} 82 | } 83 | ] 84 | }); 85 | snippet panel 86 | new Ext.Panel({ 87 | fullscreen: ${1:true}, 88 | ${2:dockedItems: []} 89 | ${3} 90 | }); 91 | snippet picker 92 | new Ext.Picker({ 93 | slots: [ 94 | ${1} 95 | ] 96 | }); 97 | snippet tabpanel 98 | new Ext.TabPanel({ 99 | fullscreen: ${1:true}, 100 | ui: '${2:dark}', 101 | srtable: ${3:true}, 102 | items: [ 103 | ${4:// items...} 104 | ] 105 | }); 106 | snippet toolbar 107 | new Ext.Toolbar({ 108 | dock: '${1:top}', 109 | title: '${2:My toolbar}', 110 | items: [ 111 | ${3:// items...} 112 | ] 113 | }); 114 | snippet setup 115 | (function() { 116 | Ext.setup({ 117 | tabletStartupScreen: '${1:tablet_startup.png}', 118 | phoneStartupScreen: '${2:phone_startup.png}', 119 | icon: '${3:icon.png}', 120 | glossOnIcon: ${4:false}, 121 | 122 | onReady: function() { 123 | ${5:// code...} 124 | } 125 | }); 126 | })(); 127 | snippet reg 128 | Ext.reg('${1:xtype}', ${2:MyClass}); 129 | snippet item 130 | { 131 | ${1} 132 | } 133 | snippet actionsheet 134 | var actionSheet = new Ext.ActionSheet({ 135 | items: [ 136 | ${1:// items...} 137 | ] 138 | }); 139 | ${2:actionSheet.show();} 140 | snippet marker 141 | var ${1:marker} = new google.maps.Marker({ 142 | title: '${2:title}', 143 | map: '${3:map}', 144 | icon: '${4:icon.png}' 145 | }); 146 | snippet tpl 147 | tpl: [ 148 | ${1} 149 | ] 150 | -------------------------------------------------------------------------------- /.zimrc: -------------------------------------------------------------------------------- 1 | ################# 2 | # CORE SETTINGS # 3 | ################# 4 | 5 | # 6 | # Zim settings 7 | # 8 | 9 | # Select what modules you would like enabled. 10 | # The second line of modules may depend on options set by modules in the first 11 | # line. These dependencies are noted on the respective module's README.md. 12 | zmodules=(directory environment fasd git-info history input utility meta \ 13 | syntax-highlighting history-substring-search prompt completion \ 14 | tmux autosuggestions) 15 | 16 | 17 | ################### 18 | # MODULE SETTINGS # 19 | ################### 20 | 21 | # 22 | # Prompt 23 | # 24 | 25 | # Set your desired prompt here 26 | #zprompt_theme="pure" 27 | 28 | # 29 | # Completion 30 | # 31 | 32 | # set an optional host-specific filename for the completion cache file 33 | # if none is provided, the default '.zcompdump' is used. 34 | #zcompdump_file=".zcompdump-${HOST}-${ZSH_VERSION}" 35 | 36 | # 37 | # Utility 38 | # 39 | 40 | # Uncomment to enable command correction prompts 41 | # See: http://zsh.sourceforge.net/Doc/Release/Options.html#Input_002fOutput 42 | #setopt CORRECT 43 | 44 | # 45 | # Environment 46 | # 47 | 48 | # Set the string below to the desired terminal title format string. 49 | # The terminal title is redrawn upon directory change, however, variables like 50 | # ${PWD} are only evaluated once. Use prompt expansion strings for dynamic data: 51 | # http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Simple-Prompt-Escapes 52 | # The example below uses the following format: 'username@host:/current/directory' 53 | ztermtitle='%n@%m:%~' 54 | 55 | # 56 | # Input 57 | # 58 | 59 | # Uncomment to enable double-dot expansion. 60 | # This appends '../' to your input for each '.' you type after an initial '..' 61 | #zdouble_dot_expand='true' 62 | 63 | # 64 | # Syntax-Highlighting 65 | # 66 | 67 | # This determines what highlighters will be used with the syntax-highlighting module. 68 | # Documentation of the highlighters can be found here: 69 | # https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters.md 70 | # For (u)rxvt, termite and gnome-terminal users, 71 | # removing the 'cursor' highlighter will fix the disappearing cursor problem 72 | zhighlighters=(main brackets cursor) 73 | 74 | 75 | # 76 | # SSH 77 | # 78 | 79 | # Load these ssh identities with the ssh module 80 | #zssh_ids=(id_rsa) 81 | 82 | 83 | # 84 | # Pacman 85 | # 86 | 87 | # Set (optional) pacman front-end. 88 | #zpacman_frontend='powerpill' 89 | 90 | # Load any helper scripts as defined here 91 | #zpacman_helper=(aur) 92 | 93 | zstyle ':zim:tmux:auto-start' local 'no' 94 | -------------------------------------------------------------------------------- /.zlogin: -------------------------------------------------------------------------------- 1 | # 2 | # startup file read in interactive login shells 3 | # 4 | # Re-create cached files if needed 5 | (compileAllTheThings) &! 6 | 7 | if [[ ${+WINDOWID} = 0 ]] 8 | then 9 | # We are remote 10 | else 11 | # We are local 12 | ~/bin/kittyMode.sh 13 | fi 14 | -------------------------------------------------------------------------------- /.zlogout: -------------------------------------------------------------------------------- 1 | # 2 | # Executes commands at logout. 3 | # 4 | # Authors: 5 | # Sorin Ionescu 6 | # 7 | 8 | # Print the message. 9 | #cat <<-EOF 10 | # 11 | #Thank you. Come again! 12 | # -- Dr. Apu Nahasapeemapetilon 13 | #EOF 14 | 15 | -------------------------------------------------------------------------------- /.zprofile: -------------------------------------------------------------------------------- 1 | # 2 | # Executes commands at login pre-zshrc. 3 | # 4 | # Authors: 5 | # Sorin Ionescu 6 | # 7 | 8 | # 9 | # Paths 10 | # 11 | 12 | # Ensure path arrays do not contain duplicates. 13 | typeset -gU cdpath fpath mailpath path 14 | 15 | # Set the the list of directories that cd searches. 16 | # cdpath=( 17 | # $cdpath 18 | # ) 19 | 20 | # Set the list of directories that Zsh searches for programs. 21 | path=( 22 | /usr/local/{bin,sbin} 23 | $path 24 | ) 25 | 26 | # 27 | # Less 28 | # 29 | 30 | # Set the default Less options. 31 | # Mouse-wheel scrolling has been disabled by -X (disable screen clearing). 32 | # Remove -X and -F (exit if the content fits on one screen) to enable it. 33 | export LESS='-g -i -M -R -S -w -z-4' 34 | 35 | # Kitty theme 36 | if [[ ${+WINDOWID} = 0 ]] 37 | then 38 | # We are remote 39 | else 40 | # We are local 41 | ~/bin/kittyMode.sh 42 | fi 43 | source ${ZDOTDIR:-${HOME}}/.config/zsh/themes/env.zsh 44 | 45 | # Set the Less input preprocessor. 46 | if (( $+commands[lesspipe.sh] )); then 47 | export LESSOPEN='| /usr/bin/env lesspipe.sh %s 2>&-' 48 | fi 49 | 50 | # 51 | # Temporary Files 52 | # 53 | 54 | if [[ ! -d "$TMPDIR" ]]; then 55 | export TMPDIR="/tmp/$USER" 56 | mkdir -p -m 700 "$TMPDIR" 57 | fi 58 | 59 | TMPPREFIX="${TMPDIR%/}/zsh" 60 | if [[ ! -d "$TMPPREFIX" ]]; then 61 | mkdir -p "$TMPPREFIX" 62 | fi 63 | 64 | unsetopt global_rcs 65 | -------------------------------------------------------------------------------- /.zshenv: -------------------------------------------------------------------------------- 1 | # 2 | # Defines environment variables. 3 | # 4 | # Authors: 5 | # Sorin Ionescu 6 | # 7 | 8 | # Ensure that a non-login, non-interactive shell has a defined environment. 9 | if [[ "$SHLVL" -eq 1 && ! -o LOGIN && -s "${ZDOTDIR:-$HOME}/.zprofile" ]]; then 10 | source "${ZDOTDIR:-$HOME}/.zprofile" 11 | fi 12 | 13 | . "$HOME/.cargo/env" 14 | -------------------------------------------------------------------------------- /.zshrc: -------------------------------------------------------------------------------- 1 | # Uncomment to profile zsh startup 2 | #zmodload zsh/zprof 3 | 4 | # Set umask 5 | umask g-w,o-rwx 6 | 7 | # If command is a path, cd into it 8 | setopt auto_cd 9 | 10 | # Colorful messages 11 | e_header() { echo -e "\n\033[1m$@\033[0m"; } 12 | e_success() { echo -e " \033[1;32m✔\033[0m $@"; } 13 | e_error() { echo -e " \033[1;31m✖\033[0m $@"; } 14 | 15 | # Croptesting 16 | #source ${ZDOTDIR:-${HOME}}/.config/zsh/archive/frameworks.zsh 17 | 18 | # Show path in title 19 | precmd() {print -Pn "\e]0;${PWD/$HOME/\~}\a"} 20 | 21 | # Load zgenom only if a user types a zgenom command 22 | zgenom() { 23 | if [[ ! -s ${ZDOTDIR:-${HOME}}/.zgenom/zgenom.zsh ]]; then 24 | git clone https://github.com/jandamm/zgenom.git "${ZDOTDIR:-${HOME}}/.zgenom" 25 | fi 26 | # load zgenom 27 | source "${ZDOTDIR:-${HOME}}/.zgenom/zgenom.zsh" 28 | zgenom "$@" 29 | } 30 | 31 | # Generate zgenom init script if needed 32 | if [[ ! -s ${ZDOTDIR:-${HOME}}/.zgenom/sources/init.zsh ]]; then 33 | zgenom load zsh-users/zsh-autosuggestions 34 | zgenom load zdharma-continuum/fast-syntax-highlighting 35 | zgenom load zsh-users/zsh-history-substring-search 36 | zgenom ohmyzsh plugins/shrink-path 37 | zgenom ohmyzsh plugins/ssh-agent 38 | zgenom ohmyzsh --completion plugins/docker-compose 39 | # generate the init script from plugins above 40 | zgenom save 41 | fi 42 | 43 | # This needs to be loaded before ssh-agent plugin 44 | zstyle :omz:plugins:ssh-agent lazy yes 45 | 46 | # Load dircolors 47 | if [ -s ${ZDOTDIR:-${HOME}}/.dircolors ]; then 48 | eval $(command dircolors -b ${ZDOTDIR:-${HOME}}/.dircolors) 49 | fi 50 | 51 | # Load complete compiled settings file including zgenom init 52 | if [[ ! -s ${ZDOTDIR:-${HOME}}/.config/zsh/cache/settings.zsh ]]; then 53 | source ${ZDOTDIR:-${HOME}}/.config/zsh/0_functions.zsh 54 | recreateCachedSettingsFile 55 | fi 56 | source ${ZDOTDIR:-${HOME}}/.config/zsh/cache/settings.zsh 57 | 58 | eval $(zoxide init --cmd j zsh) 59 | 60 | # Load customized prompt 61 | fpath=(/${ZDOTDIR:-${HOME}}/.config/zsh/functions $fpath) 62 | autoload -Uz promptinit && promptinit 63 | prompt tuurlijk 64 | 65 | # Remove whitespace after the RPROMPT 66 | #ZLE_RPROMPT_INDENT=0 67 | 68 | # Uncomment to profile zsh startup 69 | #zprof 70 | -------------------------------------------------------------------------------- /Background/awesome-desktop-backgrounds-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/Background/awesome-desktop-backgrounds-2.jpg -------------------------------------------------------------------------------- /Background/awesome-paint.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/Background/awesome-paint.jpg -------------------------------------------------------------------------------- /Background/bridge.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/Background/bridge.jpg -------------------------------------------------------------------------------- /Background/dwm-mypattern.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/Background/dwm-mypattern.jpg -------------------------------------------------------------------------------- /Background/dwm-mypattern.light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/Background/dwm-mypattern.light.jpg -------------------------------------------------------------------------------- /Background/dwm-mypattern.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/Background/dwm-mypattern.png -------------------------------------------------------------------------------- /Background/leaves.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/Background/leaves.jpg -------------------------------------------------------------------------------- /Background/paardebloem.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/Background/paardebloem.jpg -------------------------------------------------------------------------------- /Background/road.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/Background/road.jpeg -------------------------------------------------------------------------------- /Background/shroom.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/Background/shroom.jpg -------------------------------------------------------------------------------- /Icon/terminal.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | dotfiles 2 | ======== 3 | My dotfiles `¯\_(ツ)_/¯`. I've tried to use as much native zsh code and as few dependencies as possible. This keeps this setup snappy. 4 | 5 | ## How Snappy? 6 | ``` 7 | ~  TIMEFMT=$'real %E\tuser %U\tsys %S' 8 | ~  repeat 10 {time zsh -i -c exit} 9 | real 0.04s user 0.03s sys 0.02s 10 | real 0.04s user 0.03s sys 0.01s 11 | real 0.04s user 0.03s sys 0.01s 12 | real 0.04s user 0.03s sys 0.01s 13 | real 0.04s user 0.03s sys 0.01s 14 | real 0.04s user 0.03s sys 0.01s 15 | real 0.04s user 0.02s sys 0.02s 16 | real 0.04s user 0.03s sys 0.01s 17 | real 0.04s user 0.03s sys 0.01s 18 | real 0.04s user 0.03s sys 0.02s 19 | ``` 20 | 21 | 60ms for a tmux pane split is nice :-) 22 | 23 | ## What does it contain? 24 | * Vim is powered by [Plug](https://github.com/junegunn/vim-plug) 25 | * Zsh is powered by [zgenom](https://github.com/jandamm/zgenom). 26 | * Tmux bar code is generated by [TmuxLine.vim](https://github.com/edkolev/tmuxline.vim) 27 | 28 | This setup will work on both OSX and Linux (and may work on other platforms). 29 | 30 | ![](Screenshots/Dotfiles.png) 31 | 32 | ## Requirements 33 | * You have `zsh` installed (known to work from 4.3.17 to 5.3.1) 34 | * You have `tmux` installed (`2.1`+ or you will have issues with the supplied `.tmux.conf` ) 35 | * You have `vim` installed (optionally compiled with `ruby` and `python` support) 36 | * You have `ruby`, `ruby-devel`, `python` and `python-pip` installed - if you wish to use Command-T plugin in vim 37 | * You will need a [Powerline capable font](https://github.com/powerline/fonts) 38 | * `Exuberant Ctags`, as TagBar will not work with GNU ctags. On OSX: `brew install ctags` fail. 39 | 40 | ## Installation 41 | ``` 42 | git clone https://github.com/tuurlijk/dotfiles "${ZDOTDIR:-$HOME}/dotfiles" 43 | cd "${ZDOTDIR:-$HOME}/dotfiles" 44 | ./setup.sh 45 | 46 | chsh -s /bin/zsh 47 | ``` 48 | 49 | The installer will also install `zgenom` for you. 50 | 51 | ## Troubleshooting 52 | It might be the case that the `Command-T` vim plugin causes a segfault on your system when you use the bootstrap script. 53 | This is due to the fact that it was compiled for a different architecture than your vim. 54 | See the [Command-T manual](http://git.wincent.com/command-t.git/blob_plain/HEAD:/doc/command-t.txt) for instructions. 55 | 56 | Specifically: 57 | 58 | ``` 59 | First you have to check the platform Vim was built for: 60 | 61 | vim --version 62 | ... 63 | Compilation: gcc ... -arch i386 ... 64 | ... 65 | 66 | and make sure you use the correct ARCHFLAGS during compilation: 67 | 68 | export ARCHFLAGS="-arch i386" 69 | make 70 | ``` 71 | -------------------------------------------------------------------------------- /Screenshots/Dotfiles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tuurlijk/dotfiles/5d2da911758dd26bef8652df0b890b4b06416efa/Screenshots/Dotfiles.png -------------------------------------------------------------------------------- /bin/fzf-preview.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # The purpose of this script is to demonstrate how to preview a file or an 4 | # image in the preview window of fzf. 5 | # 6 | # Dependencies: 7 | # - https://github.com/sharkdp/bat 8 | # - https://github.com/hpjansson/chafa 9 | # - https://iterm2.com/utilities/imgcat 10 | 11 | if [[ $# -ne 1 ]]; then 12 | >&2 echo "usage: $0 FILENAME[:LINENO][:IGNORED]" 13 | exit 1 14 | fi 15 | 16 | file=${1/#\~\//$HOME/} 17 | 18 | center=0 19 | if [[ ! -r $file ]]; then 20 | if [[ $file =~ ^(.+):([0-9]+)\ *$ ]] && [[ -r ${BASH_REMATCH[1]} ]]; then 21 | file=${BASH_REMATCH[1]} 22 | center=${BASH_REMATCH[2]} 23 | elif [[ $file =~ ^(.+):([0-9]+):[0-9]+\ *$ ]] && [[ -r ${BASH_REMATCH[1]} ]]; then 24 | file=${BASH_REMATCH[1]} 25 | center=${BASH_REMATCH[2]} 26 | fi 27 | fi 28 | 29 | type=$(file --brief --dereference --mime -- "$file") 30 | 31 | if [[ ! $type =~ image/ ]]; then 32 | if [[ $type =~ =binary ]]; then 33 | file "$1" 34 | exit 35 | fi 36 | 37 | # Sometimes bat is installed as batcat. 38 | if command -v batcat > /dev/null; then 39 | batname="batcat" 40 | elif command -v bat > /dev/null; then 41 | batname="bat" 42 | else 43 | cat "$1" 44 | exit 45 | fi 46 | 47 | ${batname} --style="${BAT_STYLE:-numbers}" --color=always --pager=never --highlight-line="${center:-0}" -- "$file" 48 | exit 49 | fi 50 | 51 | dim=${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES} 52 | if [[ $dim = x ]]; then 53 | dim=$(stty size < /dev/tty | awk '{print $2 "x" $1}') 54 | elif ! [[ $KITTY_WINDOW_ID ]] && (( FZF_PREVIEW_TOP + FZF_PREVIEW_LINES == $(stty size < /dev/tty | awk '{print $1}') )); then 55 | # Avoid scrolling issue when the Sixel image touches the bottom of the screen 56 | # * https://github.com/junegunn/fzf/issues/2544 57 | dim=${FZF_PREVIEW_COLUMNS}x$((FZF_PREVIEW_LINES - 1)) 58 | fi 59 | 60 | # 1. Use icat (from Kitty) if kitten is installed 61 | if [[ $KITTY_WINDOW_ID ]] || [[ $GHOSTTY_RESOURCES_DIR ]] && command -v kitten > /dev/null; then 62 | # 1. 'memory' is the fastest option but if you want the image to be scrollable, 63 | # you have to use 'stream'. 64 | # 65 | # 2. The last line of the output is the ANSI reset code without newline. 66 | # This confuses fzf and makes it render scroll offset indicator. 67 | # So we remove the last line and append the reset code to its previous line. 68 | kitten icat --clear --transfer-mode=memory --unicode-placeholder --stdin=no --place="$dim@0x0" "$file" | sed '$d' | sed $'$s/$/\e[m/' 69 | 70 | # 2. Use chafa with Sixel output 71 | elif command -v chafa > /dev/null; then 72 | chafa -s "$dim" "$file" 73 | # Add a new line character so that fzf can display multiple images in the preview window 74 | echo 75 | 76 | # 3. If chafa is not found but imgcat is available, use it on iTerm2 77 | elif command -v imgcat > /dev/null; then 78 | # NOTE: We should use https://iterm2.com/utilities/it2check to check if the 79 | # user is running iTerm2. But for the sake of simplicity, we just assume 80 | # that's the case here. 81 | imgcat -W "${dim%%x*}" -H "${dim##*x}" "$file" 82 | 83 | # 4. Cannot find any suitable method to preview the image 84 | else 85 | file "$file" 86 | fi 87 | 88 | -------------------------------------------------------------------------------- /bin/kittyMode.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # See ~/bin/dusktodawn or ~/Projects/Rust/dusktodawn 3 | # */5 * * * * ~/bin/kittyMode.sh 4 | 5 | declare -A kitty_background 6 | kitty_background=( 7 | [dark]="#000000" 8 | [light]="#fdf6e3" 9 | ) 10 | declare -A kitty_foreground 11 | kitty_foreground=( 12 | [dark]="#c0c0c0" 13 | [light]="#444444" 14 | ) 15 | declare -A kitty_background_image 16 | kitty_background_image=( 17 | [dark]="${HOME}/Pictures/Backgrounds/termBg.png" 18 | [light]="${HOME}/Pictures/Backgrounds/termBg.day.png" 19 | ) 20 | declare -A bat_theme 21 | bat_theme=( 22 | [dark]="OneHalfDark" 23 | [light]="OneHalfLight" 24 | ) 25 | declare -A iconlookup_dirtxt 26 | iconlookup_dirtxt=( 27 | [dark]="67" 28 | [light]="67" 29 | ) 30 | declare -A iconlookup_filetxt 31 | iconlookup_filetxt=( 32 | [dark]="250" 33 | [light]="238" 34 | ) 35 | 36 | # Needed to run from cron 37 | export DISPLAY=:0 38 | export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus 39 | export PATH=/bin:/usr/bin/:/usr/local/bin 40 | 41 | # Is it light or dark? 42 | nowHourMin=$(date +%s) 43 | 44 | mode=dark 45 | if [ $nowHourMin -ge $(${HOME}/bin/dusktodawn --dusk) ] && [ $nowHourMin -lt $(${HOME}/bin/dusktodawn --dawn) ]; then 46 | mode=light 47 | fi 48 | 49 | if [ "$1" != "" ]; then 50 | mode=$1 51 | fi 52 | 53 | # Should we recreate the config files for zsh and kitty? 54 | nowTimestamp=$(date +%s) 55 | aWhileAgo=$(expr $nowTimestamp - 300) 56 | recreate=false 57 | 58 | kittyThemeEnvironment="${ZDOTDIR:-${HOME}}/.config/kitty/env.conf" 59 | if [[ ! -s "$kittyThemeEnvironment" || $(stat --format=%Y $kittyThemeEnvironment) -le $aWhileAgo ]]; then 60 | recreate=true 61 | fi 62 | 63 | zshThemeEnvironment="${ZDOTDIR:-${HOME}}/.config/zsh/themes/env.zsh" 64 | if [[ ! -s "$zshThemeEnvironment" || $(stat --format=%Y $zshThemeEnvironment) -le $aWhileAgo ]]; then 65 | recreate=true 66 | fi 67 | 68 | if [ "$1" != "" ] || ($recreate); then 69 | # Debug 70 | # notify-send 'KittyMode' "Refreshing kitty theme file" -a 'KittyMode' -i "/usr/lib/kitty/logo/kitty.png" 71 | 72 | rm $kittyThemeEnvironment 73 | echo "# This file is generated automatically, do not edit by hand!" >$kittyThemeEnvironment 74 | echo "# $(date)" >>$kittyThemeEnvironment 75 | echo "# Edit ~/bin/kittyMode.sh instead!" >>$kittyThemeEnvironment 76 | 77 | rm $zshThemeEnvironment 78 | echo "# This file is generated automatically, do not edit by hand!" >$zshThemeEnvironment 79 | echo "# $(date)" >>$zshThemeEnvironment 80 | echo "# Edit ~/bin/kittyMode.sh instead!" >>$zshThemeEnvironment 81 | 82 | # New terminals 83 | echo "background_image ${kitty_background_image[$mode]}" >>$kittyThemeEnvironment 84 | echo "background ${kitty_background[$mode]}" >>$kittyThemeEnvironment 85 | echo "foreground ${kitty_foreground[$mode]}" >>$kittyThemeEnvironment 86 | 87 | # New zsh prompt and bat themes 88 | echo "export BAT_THEME=\"${bat_theme[$mode]}\"" >>$zshThemeEnvironment 89 | echo "export IL_C_DIRTXT=\"${iconlookup_dirtxt[$mode]}\"" >>$zshThemeEnvironment 90 | echo "export IL_C_FILETXT=\"${iconlookup_filetxt[$mode]}\"" >>$zshThemeEnvironment 91 | fi 92 | 93 | # Active terminals 94 | if pgrep -x kitty >/dev/null 95 | then 96 | kitty @ --to unix:@kitty-$(pidof kitty) set-colors -a background=${kitty_background[$mode]} foreground=${kitty_foreground[$mode]} 97 | kitty @ --to unix:@kitty-$(pidof kitty) set-background-image "${kitty_background_image[$mode]}" 98 | fi 99 | 100 | # Gnome color-scheme 101 | gsettings set org.gnome.desktop.interface color-scheme prefer-$mode 102 | -------------------------------------------------------------------------------- /bin/tmux-launch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export PATH=$PATH:/usr/local/bin 3 | 4 | # abort if we're already inside a TMUX session 5 | [ "$TMUX" == "" ] || exit 0 6 | 7 | # startup a "default" session if none currently exists 8 | tmux has-session -t ops 2>/dev/null || tmux new-session -s ops 9 | 10 | # present menu for user to choose which workspace to open 11 | PS3="Please choose your session: " 12 | options=($(tmux list-sessions -F "#S") "NEW SESSION" "BASH") 13 | echo "Available sessions" 14 | echo "------------------" 15 | echo " " 16 | select opt in "${options[@]}" 17 | do 18 | case $opt in 19 | "NEW SESSION") 20 | read -p "Enter new session name: " SESSION_NAME 21 | tmux new -s "$SESSION_NAME" 22 | break 23 | ;; 24 | "BASH") 25 | bash --login 26 | break 27 | ;; 28 | "Regular ZSH Shell") 29 | break 30 | ;; 31 | *) 32 | tmux attach-session -t $opt 33 | break 34 | ;; 35 | esac 36 | done 37 | -------------------------------------------------------------------------------- /setup.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | # Logging stuff. 4 | e_header() { echo -e "\n\033[1m$@\033[0m"; } 5 | e_success() { echo -e " \033[1;32m✔\033[0m $@"; } 6 | e_error() { echo -e " \033[1;31m✖\033[0m $@"; } 7 | e_arrow() { echo -e " \033[1;34m➜\033[0m $@"; } 8 | 9 | main () { 10 | # Take home dir as parameter for use in puppet script 11 | local home 12 | if [[ -z $1 ]] 13 | then 14 | home=${ZDOTDIR:-${HOME}} 15 | else 16 | home=$1 17 | fi 18 | 19 | # Get the directory in which the script resides 20 | local dotfileDir=${0:a:h} 21 | 22 | e_header "Creating symlinks..." 23 | mkdir -p $dotfileDir/backup 24 | 25 | setopt EXTENDED_GLOB 26 | local ohMyGlob='^(.idea|.git*|.config|Background|bin|backup|Icon|IntelliJ|README*|Screenshots|setup.sh|tags)(D)' 27 | for dir ('/' '/bin/' '/.config/'); do 28 | mkdir -p ${home}${dir} 29 | mkdir -p $dotfileDir/backup${dir} 30 | for rcfile in ${dotfileDir}${dir}${~ohMyGlob}; do 31 | local target="${home}${dir}${rcfile:t}" 32 | [[ -a "${target}" ]] && mv "${target}" "$dotfileDir/backup/${dir}" 2>/dev/null 33 | if [ $(uname) = Darwin ]; then 34 | command ln -h -s -F "$rcfile" "${target}" 35 | else 36 | command ln -s "$rcfile" "${target}" 37 | fi 38 | done 39 | done 40 | 41 | e_header "Installing vim plugins..." 42 | vim -S <(echo -e "PlugInst \n q \n q") 43 | 44 | # e_header "Compiling command-t for current ruby version..." 45 | # pushd $home/${PWD##*/}/.vim/plugged/command-t/ruby/command-t 46 | # if command -v ruby > /dev/null 2>&1; then 47 | # ruby extconf.rb 48 | # if command -v make > /dev/null 2>&1; then 49 | # make 50 | # fi 51 | # fi 52 | # popd 53 | # 54 | # e_header "Installing tmux plugins..." 55 | # pushd $home/${PWD##*/}/.tmux 56 | # if command -v tmux > /dev/null 2>&1; then 57 | # e_arrow We have tmux 58 | # if command -v git > /dev/null 2>&1; then 59 | # if [[ ! -d plugins/tpm ]]; then 60 | # e_arrow Cloning tpm 61 | # git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm 62 | # else 63 | # e_arrow Tpm already installed, updating 64 | # pushd plugins/tpm 65 | # git pull 66 | # popd 67 | # fi 68 | # fi 69 | # fi 70 | # popd 71 | 72 | source $home/.config/zsh/0_functions.zsh 73 | e_header "Concatenating .config/zsh files into single file..." 74 | recreateCachedSettingsFile 75 | e_header "Compiling zsh files for increased speed..." 76 | compileAllTheThings 77 | 78 | echo 79 | e_success "All done!" 80 | } 81 | 82 | main "$1" 83 | --------------------------------------------------------------------------------