commit 3d4784d386f523c99e942f141e84f2d3771dc7c0 Author: winston Date: Sat Jul 30 07:17:12 2022 +0200 chore: make dots public diff --git a/.chezmoi.yaml.tmpl b/.chezmoi.yaml.tmpl new file mode 100644 index 0000000..d3c356a --- /dev/null +++ b/.chezmoi.yaml.tmpl @@ -0,0 +1,20 @@ +encryption: gpg + +gpg: + recipient: hey@winston.sh + +edit: + command: nvim +diff: + command: nvim + args: + - "-d" + - "{{`{{ .Destination }}`}}" + - "{{`{{ .Target }}`}}" +merge: + command: nvim + args: + - "-d" + - "{{`{{ .Destination }}`}}" + - "{{`{{ .Source }}" + - "{{ .Target }}`}}" diff --git a/.chezmoiexternal.yaml b/.chezmoiexternal.yaml new file mode 100644 index 0000000..0764f83 --- /dev/null +++ b/.chezmoiexternal.yaml @@ -0,0 +1,14 @@ +.antigen/antigen.zsh: + type: file + url: "https://raw.githubusercontent.com/zsh-users/antigen/master/bin/antigen.zsh" + refreshPeriod: 168h + +.config/tmux/plugins/tpm: + type: git-repo + url: "https://github.com/tmux-plugins/tpm" + refreshPeriod: 168h + +.config/wezterm/colors/catppuccin: + type: git-repo + url: "https://github.com/catppuccin/wezterm.git" + refreshPeriod: 168h diff --git a/.chezmoiignore b/.chezmoiignore new file mode 100644 index 0000000..9a1c54e --- /dev/null +++ b/.chezmoiignore @@ -0,0 +1,21 @@ +# ignore the README, of course... +README.md +{{- if ne .chezmoi.os "linux" }} +# ignore linux configuration +.config/dunst/ +.config/i3/ +.config/polybar/ +.config/rofi/ +.config/picom.conf +.config/redshift.conf +.local/bin/launch_polybar +.xscreensaver +.Xmodmap +{{- end }} +{{- if ne .chezmoi.os "darwin" }} +# ignore macOS configuration +.config/sketchybar/ +.config/skhd/ +.config/yabai/ +.qutebrowser +{{- end }} diff --git a/dot_Xmodmap b/dot_Xmodmap new file mode 100644 index 0000000..dafbd78 --- /dev/null +++ b/dot_Xmodmap @@ -0,0 +1,2 @@ +pointer = 1 2 3 5 4 7 6 8 9 10 11 12 +clear Lock diff --git a/dot_config/bugwarrior/encrypted_bugwarriorrc.asc b/dot_config/bugwarrior/encrypted_bugwarriorrc.asc new file mode 100644 index 0000000..f8f6107 --- /dev/null +++ b/dot_config/bugwarrior/encrypted_bugwarriorrc.asc @@ -0,0 +1,16 @@ +-----BEGIN PGP MESSAGE----- + +hF4Dt852JJsu9zQSAQdA/A+ep8XtO5CmUVsTReTRTwcekGyYT5rYVLHfp+0wZHIw +ReGpYdfjRu8/fyxHAXuu8bjfoLeowpwt2UWl+7NIOXvDlNB4N65hm52OCFYWBRJf +0sEAAc3clPjQia5ZeqEqNUWc/lhg0xmfuq6bWmmr9gC1jinhCB+RcpUKIFcHxBmx +UxO6TjKz/oQVGubQju15AzjE2w3DmiZXTnPBTD7Pnu68wBCPcoVQZYVxlPpappc+ +E/mI2xrIg6riES+QZkajQPJvsI7sSCyQVct3y3eAv/UX+7NDHujtEcrEIPvR5MBW +1/OCE8rQlqzqwxL1DazaIuISRF6QVCdic0VEHTCSZzoxxIkAca8vJvK0gSshgyhv +mBjR2EhJFcW7nwP4LfSuOGRVyr4+lXeoNFE1Hj4m0JJHZ0bs63tFClLUHL3SuLfs +VG9ii6PZCN0sgfS00VKyv9fc6PHIV6hg5Pg6q+RijLQ+cFJKl6y8kgSx5xWzjpAY +HlNxtwOMe5Zz+gGkEZrBnq0IgWOBL5wM7WjHsxxU4/QvqB8wzzfzOTSQQd0T76pq +rd/IH/phCf+CA9jTvxPICD822BgoIwqOKGlh65RBuA/+5qn0MbEvuW+tQkaB2pR8 +pkGVl5wGMfaXLb8U8PEKQVNxi8f6gw4JSLIvxAlz8re++pOhr5FyHCb7i1GJHfGp +I5dlbQ4/XaH7OiorM94CCZGDug== +=TMnT +-----END PGP MESSAGE----- diff --git a/dot_config/dunst/dunstrc b/dot_config/dunst/dunstrc new file mode 100644 index 0000000..3a2c4a1 --- /dev/null +++ b/dot_config/dunst/dunstrc @@ -0,0 +1,152 @@ +# See dunst(5) for all configuration options +# vim:ft=cfg +[global] + frame_width = 3 + frame_color = "#89B4FA" + font = Victor Mono 12 + + width = 300 + height = 300 + + # Allow a small subset of html markup: + markup = yes + + # The format of the message. + format = "%a\n%s %p\n%b" + + # Sort messages by urgency. + sort = yes + + # Show how many messages are currently hidden (because of geometry). + indicate_hidden = yes + + # Alignment of message text. + # Possible values are "left", "center" and "right". + alignment = left + + # The frequency with wich text that is longer than the notification + # window allows bounces back and forth. + # This option conflicts with "word_wrap". + # Set to 0 to disable. + bounce_freq = 5 + + + # Show age of message if message is older than show_age_threshold + # seconds. + # Set to -1 to disable. + show_age_threshold = 60 + + # Split notifications into multiple lines if they don't fit into + # geometry. + word_wrap = no + + # Ignore newlines '\n' in notifications. + ignore_newline = no + + # Shrink window if it's smaller than the width. Will be ignored if + # width is 0. + shrink = yes + + # The transparency of the window. Range: [0; 100]. + transparency = 5 + + # Don't remove messages, if the user is idle (no mouse or keyboard input) + # for longer than idle_threshold seconds. + idle_threshold = 30 + + # Which monitor should the notifications be displayed on. + monitor = 0 + + # Display notification on focused monitor. Possible modes are: + # keyboard: follow window with keyboard focus + follow = keyboard + + # Should a notification popped up from history be sticky or timeout + # as if it would normally do. + sticky_history = yes + + # Maximum amount of notifications kept in history + history_length = 20 + + # Display indicators for URLs (U) and actions (A). + show_indicators = yes + + # The height of a single line. If the height is smaller than the + # font height, it will get raised to the font height. + # This adds empty space above and under the text. + line_height = 2 + + # Draw a line of "separator_height" pixel height between two + # notifications. + # Set to 0 to disable. + separator_height = 1 + + # Padding between text and separator. + # padding = 8 + padding = 2 + + # Padding between text and icon. + text_icon_padding = 4 + + # Define a color for the separator. + # possible values are: + # * auto: dunst tries to find a color fitting to the background; + # * foreground: use the same color as the foreground; + # * frame: use the same color as the frame; + # * anything else will be interpreted as a X color. + separator_color= frame + + # Print a notification on startup. + # This is mainly for error detection, since dbus (re-)starts dunst + # automatically after a crash. + startup_notification = false + + # dmenu path. + dmenu = /usr/bin/dmenu -p dunst: + + # Browser for opening urls in context menu. + browser = firefox + + # Align icons left/right/off + icon_position = left + + # Paths to default icons. + icon_path = /usr/share/icons/Papirus-Dark/16x16/status/:/usr/share/icons/Papirus-Dark/16x16/devices/:/usr/share/icons/Papirus-Dark/16x16/legacy/ + + min_icon_size=24 + max_icon_size=64 + +[shortcuts] + + # Shortcuts are specified as [modifier+][modifier+]...key + # Available modifiers are "ctrl", "mod1" (the alt-key), "mod2", + # "mod3" and "mod4" (windows-key). + # Xev might be helpful to find names for keys. + + # Close notification. + close = mod1+space + + # Close all notifications. + # close_all = ctrl+shift+space + close_all = ctrl+mod1+space + + # Redisplay last message(s). + # On the US keyboard layout "grave" is normally above TAB and left + # of "1". + history = ctrl+mod4+h + + # Context menu. + context = ctrl+mod1+c + +[urgency_low] +background = "#1e1e2e" +foreground = "#cdd6f4" + +[urgency_normal] +background = "#1e1e2e" +foreground = "#cdd6f4" + +[urgency_critical] +background = "#1e1e2e" +foreground = "#cdd6f4" +frame_color = "#fab387" diff --git a/dot_config/git/encrypted_personal.asc b/dot_config/git/encrypted_personal.asc new file mode 100644 index 0000000..18cd6d1 --- /dev/null +++ b/dot_config/git/encrypted_personal.asc @@ -0,0 +1,11 @@ +-----BEGIN PGP MESSAGE----- + +hF4Dt852JJsu9zQSAQdAnRakjI8f1Sw1YzEkKfnYr6DjhhMgi+DvrqTiY2dRTEcw +t9LEuARvsckZDvzt7e9V+hTCPHLFAyhg1OUPXwfoLZAIy9tYdA7Kl/NnffPEeccy +0sALAW+7vpMXEdu2fQgMH/jKwwSjQLjm7uTX2t2aToYP4DNsuvbbZhrOciF2Y6uf +UaTL4ao9tqZhuhDl3L0F/+l+MUU/x0DTud5xaV97FcVPJkOoEEEDmWZ65Rg0BO6m +r17fnuAkg5w+zVtXdpWB6dNeGURewBBL2t8uSccWhmrxnAQLWpMc8vZdMY2+884y +CPHY/Eb56MsYoCi7JkSukAtgqGDdtYxT/nQH7Ev7o125nvjkPklLgyPbtY54SCp2 +8XId9/4vG4P23sTC6Jc= +=mlWV +-----END PGP MESSAGE----- diff --git a/dot_config/git/encrypted_pseudonym.asc b/dot_config/git/encrypted_pseudonym.asc new file mode 100644 index 0000000..d638ccf --- /dev/null +++ b/dot_config/git/encrypted_pseudonym.asc @@ -0,0 +1,11 @@ +-----BEGIN PGP MESSAGE----- + +hF4Dt852JJsu9zQSAQdAH6u8KuzZ7V+9Rh1r8DyA1En64bqAjuoIUe9YRgprSH4w +vo2DqLAss0dn67m9IOQWhvT+xY5YV5khhrPNbuOE8TlPfkxF05C8wnuOesZd6S/A +0sAAAUMgdUgfx/TyKWQGYQYwj44m26IUWGNVJDZ4lQXbE4Z+pEaQguohsoeKTEhQ +A890l1IryH317sbFcgR37kHKMoL8T2cDbjfRWsaIZOnioXUS6RcdzkkInE36enge +PwxThiiSk179DYFkKQUfoq54QXIhK0x3BImbzbiaxCvAS55Np1jzWeQMF7h+IK5/ +nxF3kQxJOZbGL4b0IfixgrIi3P1xAo/QY1xTUGNgobhH/+cOc9dwahY0xqUyvytx ++Jy1 +=AH1k +-----END PGP MESSAGE----- diff --git a/dot_config/git/encrypted_work.asc b/dot_config/git/encrypted_work.asc new file mode 100644 index 0000000..45a67b9 --- /dev/null +++ b/dot_config/git/encrypted_work.asc @@ -0,0 +1,11 @@ +-----BEGIN PGP MESSAGE----- + +hF4Dt852JJsu9zQSAQdACJl4yfv5C/LftHTmzr6+8ke7CVsR10M0J+HMw65n6Tsw +2j2U+6Shvb5yXOw0dljSjpCdoPKw4bgXkTkMoeh5uDTGAXr3c2YhGJLeS+T9LEoE +0sAPAQShiPnSYvZrTMlYT/PPLOEJaN7wz3IDIK1MXL1876YdUtve3YybQk36wPoJ +xw1vsXGwVrw7Ia3SQIGPANkXWx6GKYWjbbrYTBj2gVkG79CV5DTL8vCQLHNAjuwR +JiLEOuuOKUv19QjEcfA0LJOIZSEEKj9XaFYWavqijqOFU560AZY1cyldq63Mg6wg +O0j7L0LGg0E/GJ+if2og4FJ7z5ML1g6UUUoigDGfAH4XwhK3Y5DExPZtUy0/W4zM ++LicLJATW4ziaC0lk5IG0xgm +=1ncJ +-----END PGP MESSAGE----- diff --git a/dot_config/git/ignore b/dot_config/git/ignore new file mode 100644 index 0000000..a1cc87f --- /dev/null +++ b/dot_config/git/ignore @@ -0,0 +1,3 @@ +.DS_Store +.idea +*.log diff --git a/dot_config/i3/config b/dot_config/i3/config new file mode 100644 index 0000000..2ddebe9 --- /dev/null +++ b/dot_config/i3/config @@ -0,0 +1,337 @@ +# vim:ft=i3config +# Please see http://i3wm.org/docs/userguide.html for a complete reference! + +# Set mod key (Mod1=, Mod4=) +set $mod Mod4 + +# Set DPI value +set_from_resource $dpi Xft.dpi 96 + +# Configure border style +default_border pixel 2 +default_floating_border normal + +# Hide borders +hide_edge_borders none + +# change borders +bindsym $mod+u border none +bindsym $mod+y border pixel 2 +bindsym $mod+n border normal + +# Font for window titles. Will also be used by the bar unless a different font +# is used in the bar {} block below. +font xft:Inter 11 + +# Use Mouse+$mod to drag floating windows +floating_modifier $mod + +# start a terminal +bindsym $mod+Shift+Return exec wezterm + +# kill focused window +bindsym $mod+Shift+q kill + +# Start Applications +bindsym $mod+F2 exec firefox +bindsym $mod+F3 exec wezterm start ranger +bindsym $mod+ShiftF3 exec pcmanfm +bindsym $mod+t exec --no-startup-id pkill picom +bindsym $mod+Ctrl+p --release exec --no-startup-id flameshot gui +bindsym $mod+Ctrl+t exec --no-startup-id picom --experimental-backends -b +bindsym $mod+Ctrl+x --release exec --no-startup-id xkill + +focus_follows_mouse yes + +# change focus +bindsym $mod+Ctrl+h focus left +bindsym $mod+Ctrl+j focus down +bindsym $mod+Ctrl+k focus up +bindsym $mod+Ctrl+l focus right + +# alternatively, you can use the cursor keys: +bindsym $mod+Ctrl+Left focus left +bindsym $mod+Ctrl+Down focus down +bindsym $mod+Ctrl+Up focus up +bindsym $mod+Ctrl+Right focus right + +# move focused window +bindsym $mod+Shift+h move left +bindsym $mod+Shift+j move down +bindsym $mod+Shift+k move up +bindsym $mod+Shift+l move right + +# alternatively, you can use the cursor keys: +bindsym $mod+Shift+Left move left +bindsym $mod+Shift+Down move down +bindsym $mod+Shift+Up move up +bindsym $mod+Shift+Right move right + +# workspace back and forth (with/without active container) +workspace_auto_back_and_forth no + +# split orientation +bindsym $mod+q split toggle + +# toggle fullscreen mode for the focused container +bindsym $mod+f fullscreen toggle + +# change container layout (stacked, tabbed, toggle split) +bindsym $mod+s layout stacking +bindsym $mod+w layout tabbed +bindsym $mod+e layout toggle split + +# toggle tiling / floating +bindsym $mod+Shift+d floating toggle + +# change focus between tiling / floating windows +bindsym $mod+d focus mode_toggle + +# toggle sticky +bindsym $mod+Shift+s sticky toggle + +# focus the parent container +bindsym $mod+a focus parent + +# move the currently focused window to the scratchpad +bindsym $mod+Shift+Tab move scratchpad + +# Show the next scratchpad window or hide the focused scratchpad window. +# If there are multiple scratchpad windows, this command cycles through them. +bindsym $mod+Tab scratchpad show + +# Workspace names +# to display names or symbols instead of plain workspace numbers you can use +# something like: set $ws1 1:mail +# set $ws2 2: +set $ws1 1 +set $ws2 2 +set $ws3 3 +set $ws4 4 +set $ws5 5 +set $ws6 6 +set $ws7 7 +set $ws8 8 +set $ws9 9 + +# switch to workspace +bindsym $mod+Ctrl+1 workspace $ws1 +bindsym $mod+Ctrl+2 workspace $ws2 +bindsym $mod+Ctrl+3 workspace $ws3 +bindsym $mod+Ctrl+4 workspace $ws4 +bindsym $mod+Ctrl+5 workspace $ws5 +bindsym $mod+Ctrl+6 workspace $ws6 +bindsym $mod+Ctrl+7 workspace $ws7 +bindsym $mod+Ctrl+8 workspace $ws8 +bindsym $mod+Ctrl+9 workspace $ws9 +bindsym $mod+Ctrl+0 workspace $ws10 + +# Move to workspace with focused container +bindsym $mod+Shift+1 move container to workspace $ws1; workspace $ws1 +bindsym $mod+Shift+2 move container to workspace $ws2; workspace $ws2 +bindsym $mod+Shift+3 move container to workspace $ws3; workspace $ws3 +bindsym $mod+Shift+4 move container to workspace $ws4; workspace $ws4 +bindsym $mod+Shift+5 move container to workspace $ws5; workspace $ws5 +bindsym $mod+Shift+6 move container to workspace $ws6; workspace $ws6 +bindsym $mod+Shift+7 move container to workspace $ws7; workspace $ws7 +bindsym $mod+Shift+8 move container to workspace $ws8; workspace $ws8 +bindsym $mod+Shift+9 move container to workspace $ws9; workspace $ws9 +bindsym $mod+Shift+0 move container to workspace $ws10; workspace $ws10 + +### Open specific applications in specific modes +# fullscreen +for_window [class="Oblogout"] fullscreen enable + +# floating sticky +for_window [class="Lxappearance"] floating enable sticky enable border normal +for_window [class="Nitrogen"] floating enable sticky enable border normal +for_window [class="Qtconfig-qt4"] floating enable sticky enable border normal +for_window [class="qt5ct"] floating enable sticky enable border normal +for_window [class="1Password"] floating enable sticky enable border pixel 1 +for_window [title="Blender Render"] floating enable border pixel 1 +for_window [title="(?i)SteamTinkerLaunch"] floating enable border pixel 1 + +# floating with 1px border +for_window [class="Galculator"] floating enable border pixel 1 +for_window [title="alsamixer"] floating enable border pixel 1 + +# floating with normal border (titled) +for_window [class="(?i)System-config-printer.py"] floating enable border normal +for_window [class="(?i)virtualbox"] floating enable border normal +for_window [class="GParted"] floating enable border normal +for_window [class="Manjaro Settings Manager"] floating enable border normal +for_window [class="Simple-scan"] floating enable border normal +for_window [class="Timeset-gui"] floating enable border normal +for_window [class="calamares"] floating enable border normal + +# floating without special settings +for_window [class="Clipgrab"] floating enable +for_window [class="Lightdm-settings"] floating enable +for_window [class="Manjaro-hello"] floating enable +for_window [class="Pamac-manager"] floating enable +for_window [class="Pavucontrol"] floating enable +for_window [class="Xfburn"] floating enable +for_window [class="fpakman"] floating enable +for_window [class="octopi"] floating enable +for_window [title="File Transfer*"] floating enable +for_window [title="MuseScore: Play Panel"] floating enable +for_window [title="Steam Guard - Computer Authorization Required"] floating enable + +# general WM role settings +for_window [window_role="pop-up"] floating enable +for_window [window_role="task_dialog"] floating enable + +# super special Jetbrains Settings +for_window [class="jetbrains-.+" title="Welcome to .+"] floating enable border pixel 1 +for_window [class="jetbrains-.+" title="win0"] floating enable + +# gksu via yad +for_window [class="Yad" title="Authentication"] floating enable + +# switch to workspace with urgent window automatically +for_window [urgent=latest] focus + +# reload the configuration file +bindsym $mod+Shift+c reload + +# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) +bindsym $mod+Shift+r restart + +# exit i3 (logs you out of your X session) +bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'" + +# Set shut down, restart and locking features +bindsym $mod+Escape mode "$mode_system" +set $mode_system (l)ock, (e)xit, switch_(u)ser, (s)uspend, (h)ibernate, (r)eboot, (Shift+s)hutdown +mode "$mode_system" { + bindsym l exec --no-startup-id i3exit lock, mode "default" + bindsym s exec --no-startup-id i3exit suspend, mode "default" + bindsym u exec --no-startup-id i3exit switch_user, mode "default" + bindsym e exec --no-startup-id i3exit logout, mode "default" + bindsym h exec --no-startup-id i3exit hibernate, mode "default" + bindsym r exec --no-startup-id i3exit reboot, mode "default" + bindsym Shift+s exec --no-startup-id i3exit shutdown, mode "default" + + # exit system mode: "Enter" or "Escape" + bindsym Return mode "default" + bindsym Escape mode "default" +} + +# Resize window (you can also use the mouse for that) +bindsym $mod+r mode "resize" +mode "resize" { + # These bindings trigger as soon as you enter the resize mode + # Pressing left will shrink the window’s width. + # Pressing right will grow the window’s width. + # Pressing up will shrink the window’s height. + # Pressing down will grow the window’s height. + bindsym h resize shrink width 5 px or 5 ppt + bindsym j resize grow height 5 px or 5 ppt + bindsym k resize shrink height 5 px or 5 ppt + bindsym l resize grow width 5 px or 5 ppt + + # same bindings, but for the arrow keys + bindsym Left resize shrink width 10 px or 10 ppt + bindsym Down resize grow height 10 px or 10 ppt + bindsym Up resize shrink height 10 px or 10 ppt + bindsym Right resize grow width 10 px or 10 ppt + + # exit resize mode: Enter or Escape + bindsym Return mode "default" + bindsym Escape mode "default" +} + +# Autostart applications +exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 +exec --no-startup-id ~/.local/bin/launch_polybar +exec --no-startup-id ~/.fehbg +exec --no-startup-id 1password --silent +exec --no-startup-id blueman-applet +exec --no-startup-id dunst +exec --no-startup-id pa-applet +exec --no-startup-id pcmanfm -d +exec --no-startup-id redshift +exec --no-startup-id sleep 1; picom -b + +# xcursor tweak by oberon +exec_always --no-startup-id fix_xcursor +# caps is also ctrl +exec_always --no-startup-id setxkbmap -option "ctrl:nocaps" -option "compose:ralt" + +# Theme colors +# class border backgr. text indic. child_border +client.focused #F5C2E7 #313244 #CDD6F4 #F5E0DC #FF80BF +client.focused_inactive #F5C2E7 #313244 #CDD6F4 #F5E0DC #9580FF +client.unfocused #CBA6F7 #313244 #CDD6F4 #F5E0DC #9580FF +client.urgent #F38BA8 #313244 #CDD6F4 #F5E0DC #FF9580 +client.placeholder #F2CDCD #313244 #CDD6F4 #F5E0DC #282A36 +client.background #F2CDCD + +############################# +### settings for i3-gaps: ### +############################# + +# Set inner/outer gaps +gaps inner 8 +gaps outer 0 + +# Additionally, you can issue commands with the following syntax. This is useful to bind keys to changing the gap size. +# gaps inner|outer current|all set|plus|minus +# gaps inner all set 10 +# gaps outer all plus 5 + +# Smart gaps (gaps used if only more than one container on the workspace) +smart_gaps off + +# Smart borders (draw borders around container only if it is not the only container on this workspace) +# on|no_gaps (on=always activate and no_gaps=only activate if the gap size to the edge of the screen is 0) +smart_borders no_gaps + +# Press $mod+Shift+g to enter the gap mode. Choose o or i for modifying outer/inner gaps. Press one of + / - (in-/decrement for current workspace) or 0 (remove gaps for current workspace). If you also press Shift with these keys, the change will be global for all workspaces. +set $mode_gaps Gaps: (o) outer, (i) inner +set $mode_gaps_outer Outer Gaps: +|-|0 (local), Shift + +|-|0 (global) +set $mode_gaps_inner Inner Gaps: +|-|0 (local), Shift + +|-|0 (global) +bindsym $mod+Shift+g mode "$mode_gaps" + +mode "$mode_gaps" { + bindsym o mode "$mode_gaps_outer" + bindsym i mode "$mode_gaps_inner" + bindsym Return mode "default" + bindsym Escape mode "default" +} + +mode "$mode_gaps_inner" { + bindsym plus gaps inner current plus 5 + bindsym minus gaps inner current minus 5 + bindsym 0 gaps inner current set 0 + + bindsym Shift+plus gaps inner all plus 5 + bindsym Shift+minus gaps inner all minus 5 + bindsym Shift+0 gaps inner all set 0 + + bindsym Return mode "default" + bindsym Escape mode "default" +} + +mode "$mode_gaps_outer" { + bindsym plus gaps outer current plus 5 + bindsym minus gaps outer current minus 5 + bindsym 0 gaps outer current set 0 + + bindsym Shift+plus gaps outer all plus 5 + bindsym Shift+minus gaps outer all minus 5 + bindsym Shift+0 gaps outer all set 0 + + bindsym Return mode "default" + bindsym Escape mode "default" +} + +# rofi instead of drun +bindsym $mod+space exec --no-startup-id rofi -show run -dpi $dpi + +# 1password +bindsym $mod+backslash exec --no-startup-id 1password --quick-access + +# move workspaces across monitors +bindsym $mod+Ctrl+greater move workspace to output right +bindsym $mod+Ctrl+less move workspace to output left diff --git a/dot_config/khard/khard.conf b/dot_config/khard/khard.conf new file mode 100644 index 0000000..2b176f7 --- /dev/null +++ b/dot_config/khard/khard.conf @@ -0,0 +1,53 @@ +# example configuration file for khard version > 0.14.0 +# place it under ~/.config/khard/khard.conf +# This file is parsed by the configobj library. The syntax is described at +# https://configobj.readthedocs.io/en/latest/configobj.html#the-config-file-format + +[addressbooks] +[[default]] +path = ~/.local/share/contacts/Default/ + +[general] +debug = no +default_action = list +# These are either strings or comma seperated lists +editor = nvim +merge_editor = nvim -d + +[contact table] +# display names by first or last name: first_name / last_name / formatted_name +display = first_name +# group by address book: yes / no +group_by_addressbook = no +# reverse table ordering: yes / no +reverse = no +# append nicknames to name column: yes / no +show_nicknames = no +# show uid table column: yes / no +show_uids = yes +# sort by first or last name: first_name / last_name / formatted_name +sort = last_name +# localize dates: yes / no +localize_dates = yes +# set a comma separated list of preferred phone number types in descending priority +# or nothing for non-filtered alphabetical order +preferred_phone_number_type = pref, cell, home +# set a comma separated list of preferred email address types in descending priority +# or nothing for non-filtered alphabetical order +preferred_email_address_type = pref, work, home + +[vcard] +# extend contacts with your own private objects +# these objects are stored with a leading "X-" before the object name in the vcard files +# every object label may only contain letters, digits and the - character +# example: +# private_objects = Jabber, Skype, Twitter +# default: , (the empty list) +private_objects = Jabber, Skype, Twitter +# preferred vcard version: 3.0 / 4.0 +preferred_version = 3.0 +# Look into source vcf files to speed up search queries: yes / no +search_in_source_files = no +# skip unparsable vcard files: yes / no +skip_unparsable = no + diff --git a/dot_config/kitty/kitty.conf b/dot_config/kitty/kitty.conf new file mode 100644 index 0000000..ae075b3 --- /dev/null +++ b/dot_config/kitty/kitty.conf @@ -0,0 +1,108 @@ +# vim:fileencoding=utf-8:foldmethod=marker + +# rice {{{ +# font +font_family Victor Mono +font_size 14 + +# nerd fonts +symbol_map U+23FB-U+23FE,U+2665,U+26A1,U+2B58,U+E000-U+E00A,U+E0A0-U+E0A3,U+E0B0-U+E0C8,U+E0CA,U+E0CC-U+E0D2,U+E0D4,U+E200-U+E2A9,U+E300-U+E3E3,U+E5FA-U+E62F,U+E700-U+E7C5,U+F000-U+F2E0,U+F300-U+F31C,U+F400-U+F4A9,U+F500-U+F8FF,U+FB26 Symbols Nerd Font + +# window +# don't center +placement_strategy top-left +# don't use pixel-perfect resize mode +resize_in_steps yes +# width between panes +window_border_width 2pt +# text alpha in inacive panes +inactive_text_alpha 0.8 +hide_window_decorations yes + +# tab bar +active_tab_font_style normal +inactive_tab_font_style italic +tab_bar_style powerline +tab_bar_align left +tab_bar_edge bottom +tab_powerline_style slanted +tab_bar_margin_width 0.0 + +include mocha.conf +# }}} + +# mouse stuff {{{ +mouse_hide_wait 0.5 +detect_urls yes + +# mouse pointer +pointer_shape_when_grabbed beam +default_pointer_shape arrow + +# url highlighting style and detection +url_style single +url_prefixes http https file ftp gemini irc gopher mailto news git + +# word detection +strip_trailing_spaces never +select_by_word_characters @-./_~?&=%+# +# }}} + +# other settings {{{ +enable_audio_bell no +editor nvim +# }}} + +# tmux-like config {{{ +# super key mod: CTRL+S +# splits ftw, stack is for emulating tmux pane zoom +enabled_layouts splits, stack +# this emulates zooming panes +map ctrl+s>z toggle_layout stack + +## panes +# create new panes +map ctrl+s>- launch --location=hsplit --cwd=current +map ctrl+s>\ launch --location=vsplit --cwd=current +# jump to other panes +map ctrl+s>h neighboring_window left +map ctrl+s>l neighboring_window right +map ctrl+s>k neighboring_window up +map ctrl+s>j neighboring_window down +map ctrl+s>q focus_visible_window +# move panes +map ctrl+s>ctrl+k move_window up +map ctrl+s>ctrl+h move_window left +map ctrl+s>ctrl+l move_window right +map ctrl+s>ctrl+j move_window down +# manipulate panes +map ctrl+s>ctrl+r start_resizing_window +map ctrl+s>r layout_action rotate +map ctrl+s>x close_window +# open ui panel to move the pane somewhere else +map ctrl+s>m detach_window ask + +## tabs - tmux-like tabs +# always show tab bar +tab_bar_min_tabs 1 +# show index for easier switching, show number of panes +tab_title_template "{index}: {title}{sup.num_windows if num_windows > 1 else ''}{activity_symbol}{bell_symbol}" +map ctrl+s>c new_tab +map ctrl+s>n next_tab +map ctrl+s>p previous_tab +map ctrl+s>1 goto_tab 1 +map ctrl+s>2 goto_tab 2 +map ctrl+s>3 goto_tab 3 +map ctrl+s>4 goto_tab 4 +map ctrl+s>5 goto_tab 5 +map ctrl+s>6 goto_tab 6 +map ctrl+s>7 goto_tab 7 +map ctrl+s>8 goto_tab 8 +map ctrl+s>9 goto_tab 9 +# }}} + +# power mode: +# spawn a pane which broadcasts its input to all other panes +map F3 launch --allow-remote-control kitty +kitten broadcast +# reload config +map F5 load_config_file diff --git a/dot_config/kitty/latte.conf b/dot_config/kitty/latte.conf new file mode 100644 index 0000000..e3fb955 --- /dev/null +++ b/dot_config/kitty/latte.conf @@ -0,0 +1,80 @@ +# vim:ft=kitty + +## name: Catppuccin-Latte +## author: Pocco81 (https://github.com/Pocco81) +## license: MIT +## upstream: https://github.com/catppuccin/kitty/blob/main/latte.conf +## blurb: Soothing pastel theme for the high-spirited! + + + +# The basic colors +foreground #4C4F69 +background #EFF1F5 +selection_foreground #EFF1F5 +selection_background #DC8A78 + +# Cursor colors +cursor #DC8A78 +cursor_text_color #EFF1F5 + +# URL underline color when hovering with mouse +url_color #DC8A78 + +# Kitty window border colors +active_border_color #7287FD +inactive_border_color #9CA0B0 +bell_border_color #DF8E1D + +# OS Window titlebar colors +wayland_titlebar_color system +macos_titlebar_color system + +# Tab bar colors +active_tab_foreground #EFF1F5 +active_tab_background #8839EF +inactive_tab_foreground #4C4F69 +inactive_tab_background #9CA0B0 +tab_bar_background #BCC0CC + +# Colors for marks (marked text in the terminal) +mark1_foreground #EFF1F5 +mark1_background #7287fD +mark2_foreground #EFF1F5 +mark2_background #8839EF +mark3_foreground #EFF1F5 +mark3_background #209FB5 + +# The 16 terminal colors + +# black +color0 #5C5F77 +color8 #6C6F85 + +# red +color1 #D20F39 +color9 #D20F39 + +# green +color2 #40A02B +color10 #40A02B + +# yellow +color3 #DF8E1D +color11 #DF8E1D + +# blue +color4 #1E66F5 +color12 #1E66F5 + +# magenta +color5 #EA76CB +color13 #EA76CB + +# cyan +color6 #179299 +color14 #179299 + +# white +color7 #ACB0BE +color15 #BCC0CC diff --git a/dot_config/kitty/mocha.conf b/dot_config/kitty/mocha.conf new file mode 100644 index 0000000..2533db7 --- /dev/null +++ b/dot_config/kitty/mocha.conf @@ -0,0 +1,80 @@ +# vim:ft=kitty + +## name: Catppuccin-Mocha +## author: Pocco81 (https://github.com/Pocco81) +## license: MIT +## upstream: https://github.com/catppuccin/kitty/blob/main/mocha.conf +## blurb: Soothing pastel theme for the high-spirited! + + + +# The basic colors +foreground #CDD6F4 +background #1E1E2E +selection_foreground #1E1E2E +selection_background #F5E0DC + +# Cursor colors +cursor #F5E0DC +cursor_text_color #1E1E2E + +# URL underline color when hovering with mouse +url_color #F5E0DC + +# Kitty window border colors +active_border_color #B4BEFE +inactive_border_color #6C7086 +bell_border_color #F9E2AF + +# OS Window titlebar colors +wayland_titlebar_color system +macos_titlebar_color system + +# Tab bar colors +active_tab_foreground #11111B +active_tab_background #CBA6F7 +inactive_tab_foreground #CDD6F4 +inactive_tab_background #181825 +tab_bar_background #11111B + +# Colors for marks (marked text in the terminal) +mark1_foreground #1E1E2E +mark1_background #B4BEFE +mark2_foreground #1E1E2E +mark2_background #CBA6F7 +mark3_foreground #1E1E2E +mark3_background #74C7EC + +# The 16 terminal colors + +# black +color0 #45475A +color8 #585B70 + +# red +color1 #F38BA8 +color9 #F38BA8 + +# green +color2 #A6E3A1 +color10 #A6E3A1 + +# yellow +color3 #F9E2AF +color11 #F9E2AF + +# blue +color4 #89B4FA +color12 #89B4FA + +# magenta +color5 #F5C2E7 +color13 #F5C2E7 + +# cyan +color6 #94E2D5 +color14 #94E2D5 + +# white +color7 #BAC2DE +color15 #A6ADC8 diff --git a/dot_config/msmtp/encrypted_config.asc b/dot_config/msmtp/encrypted_config.asc new file mode 100644 index 0000000..2c14e3e --- /dev/null +++ b/dot_config/msmtp/encrypted_config.asc @@ -0,0 +1,12 @@ +-----BEGIN PGP MESSAGE----- + +hF4Dt852JJsu9zQSAQdAvVYo3oVO5iscwOFwogD+NKHS0n0WE7r/L/dLFxBpX0sw +CJkY0KU0LIB63VlkU8sdoC2A73IJwLg3KFoRWNT+5C9G2iet8Kbg0DYXmkQ0TwoN +0sBcAWYVjnsf54fGYvGtM7SZ+OUW3Q/sKZPLP+5FjcPNGL/TeWmtcSDr+ymSbw6r +AsqClFzLHYixD3fVMGnY/rLdj/+C7I2Kia0mUU7A1vWHqDyiRdsZNC0icoe0oDNY +WycZuXVDxpZ1ikhYA2ENp0tv5XRrvsuuLXm3RLLSYiY41R1NUepWpve6UimcAzcf +Et1Arq7ptW7Gw/etQxx+P40I1tmLJg8g5zlIQM0BZjyq9bt39lUTvYpbvpJXZ/uc +/WeW5M5hyEVPY9td8KheCDcESxHXPbbS9lPDYsD3PURQpeyCAEE/C4yaZKpBYPbV +qZEawSOS0L7dVxdGoP4IeAd3d0MXHrFgYy4INslBKecTv3khxCrH2YGo/nYTHL8= +=OlAq +-----END PGP MESSAGE----- diff --git a/dot_config/mutt/accounts/encrypted_1-personal.muttrc.asc b/dot_config/mutt/accounts/encrypted_1-personal.muttrc.asc new file mode 100644 index 0000000..853f38c --- /dev/null +++ b/dot_config/mutt/accounts/encrypted_1-personal.muttrc.asc @@ -0,0 +1,21 @@ +-----BEGIN PGP MESSAGE----- + +hF4Dt852JJsu9zQSAQdAg0t08EcfvRvVW4hLDq1IZkzALytZW8hjw86tVI0RZxgw +T+37J65ib0rWFWS/x2McFR4itiW2xYEzDaa9Z1CAx71EeYxSq2ARMyxwGMKvq94e +0ukBfuMQpRtrrvjvH1GOAdggkILBq2Rnql967yxkrf6iwlSJlNpbkMsXZdCWeGrD +mM6bd3B9D8lsBOeePNXdu5ejh5YnA2/SHRkf+JKsioPo4gvTnAQ+adb1Xa/ADruS +vbJz7V3Ji+LMgq5rdsUsT0ctR/85RqyFsXbLOYojB+Etud3//Yzovbc2TgZe6qA5 +1wEBKtWjBgTlGGCxnYR6ht0f7ymMkL4aARkIpM+DTnkWSmoDEq6oO8ib4NRh3Mnd +kNDV+yEdViaj5fu8a7h1DWQsHa1xs+g0ppHOWfXPNbJq0RRTWROztGfhuPhXLC+x +K8KOv+k0euMjxgXkxkKK8b5Hw7Dq9kHlyoqXxDz+FBT0neh3s8+UDoDlBOzG80JC +ByPzBZ42cfWbbJ8JHABG1AeGmxDNYsMBUro9JjRR1cjZ++adezQQdnBZZcB3ATGy +QE1wwTG41TGVLdo1MvqfHncjtG1YoubG//HLjvYq0gLCa46IkVagsEzsc/sNcV7f +5nNOkvGwhjxVgo/0emBNS7IEdFKpszoxpQOI50wRfdkE2nB6XjHiNiJbMADPUHAW +om2zlTRFrE9AFI+YFE053BfhJC9bbiuoXsPEF75RMQkbzjdh2jRw5d9o4Tr69N3y +trP1TfZyEshNeKSU7H07p3zJ3rzMRAU4HVRtSzIKPN251cAJcn5Yg4aCegOHoJ1U +naQRs7xiPihlViQTDjdyn397oSO1+YFfDtG2a1MJilUVmPLFNLtkQeWj2oC/L4m0 +i5KQ+x+7UPrSMa0FFtjWNLhh7tXHEYCDzhKRNUcgAwmrqG6uL/Zs3ktsiPhlX0cL +Dzb8dsitfYtZ43rt5QUMAQeqrKOsfTjrXmn994H31sjRmFqqSTZUA1EibEGxacTp +U+80nmQW2cPPGDZjXt2bp/OymqyfkNI3Llv2fJGRpRvge8eSrI9BE+BOgKXP +=jaGP +-----END PGP MESSAGE----- diff --git a/dot_config/mutt/accounts/encrypted_2-work.muttrc.asc b/dot_config/mutt/accounts/encrypted_2-work.muttrc.asc new file mode 100644 index 0000000..17edcf5 --- /dev/null +++ b/dot_config/mutt/accounts/encrypted_2-work.muttrc.asc @@ -0,0 +1,23 @@ +-----BEGIN PGP MESSAGE----- + +hF4Dt852JJsu9zQSAQdAeIEi26S8uxkG1vm2FyVx1XceCD2wIZe0PmAjvf/ZuQUw +dbJC6pu2RDHuvmquGxOO5kRn5abN9MCm+8xcZ4ze49qVeoFJ9URP451Fx4iww6WE +0ukBR4+JKeyppPZ71tMiGNqVsveE1O2iXHrFDaH1uY7X0zPgHoiKyzIqAQHJnC9p ++wQaaJZ/5is9iJGtNbNAfSPt//lHlKtcS8ocziZhUJKCrQ4scI0VLQrvmgxr1D6E +wEwl/eBmPgUtAIbs9MNaTZ5v/6WLDBJnb6NJx2S2vdrSd7BFjnR5qoCie9bLy03b +DZAzlrf0qtuKFQrauaSfDumArpm59uVMT/McZbO9FU2+Q0yz7nEDRXqAOmCoq66N +RsMdkOBoeEdVKFxQovriOvY4fxHxqAnD4h04icbj6l32VfGoDGUElUMlpsMLmE5T +F6mirp2AWZWH59VTRKCbFNr1Y2XVFO9V3rPB9XRTeM4xJ5cIAvhfcHOfv6UEXV6Y +ihlibwClnzGEGqNi3n84CDtLIzf6Gc8saVNsHOPNF2fXXgYdebU8Bt3V64uyhPRK +1GkzzuH2QGH/2GU23dGNT1BVKzVUheB/nPmGFaqEA+nsDzvjzt0htQE6oht1EpIg +aULIMk/rospSkZs2Px4xmUYb75o1GOS0xduaVRozEIvpf0FsTuzYv4NhhI6ni5bu +KyRY9x/Ojaccx11v8XxKHBBtW7RQlcsGJVGPWz9R9HPbOgHgcykYVUixz8vgVmvl +QLy04AIy17fYoxvggtcXiKY6Wm1oFeZkS/RFFcloWME2yMBYnbSW9Qm0CA/TxeXs +1QzkI5b8VzT8iNO8fWxMBIGfKBeL4uKo3d4bhCCdhUGsPcnkFXqKD37CsYZ4ikfz +u8A/jM8sbYcYG9uJ0YaKkn5B52g05GRaGsot/XsaatKfuVrReVI36fMO2jEmrbG3 +S05Sb/nwceMv99BX1oJPWgeF9LT6C/NmO4YCY45biDnkCD4B9b6WXfWLvao+yd/9 +Fxkl3Q+C6x5R3uI646RunZo9AQ1HRlNcO/KPec34s66fj236Vrnj3AO/jn64+B2w +PCFvzp6Uvcwu23iEW8dC2/HkAXZSyDT7boYT1VNj6D2lE5KmTJB+XPcUfQfPqgpy +LX3LPaKvZAnARNojVq64qQpqC9XKXCkT0t0Ipw== +=Rvrb +-----END PGP MESSAGE----- diff --git a/dot_config/mutt/muttrc.tmpl b/dot_config/mutt/muttrc.tmpl new file mode 100644 index 0000000..e1ecbee --- /dev/null +++ b/dot_config/mutt/muttrc.tmpl @@ -0,0 +1,32 @@ +# vim: filetype=neomuttrc +{{ if eq .chezmoi.os "darwin" -}} +source /usr/local/share/mutt-wizard/mutt-wizard.muttrc +{{ else }} +source /usr/share/mutt-wizard/mutt-wizard.muttrc +{{- end }} +# use thread sorting +set sort="threads" +set sort_aux="reverse-last-date-received" + +# compose with pandoc / Markdown +macro compose m \ +"set pipe_decode\ +docker run -i -v /tmp:/tmp --rm pandoc/core -f gfm -t plain -o /tmp/msg.txt\ +docker run -i -v /tmp:/tmp -v ~/.config/mutt/templates/work.html:/mutt/templates/work.html --rm pandoc/core -s -f gfm --self-contained -o /tmp/msg.html --resource-path /mutt/templates/ --template work\ +unset pipe_decode\ +/tmp/msg.txt\ +/tmp/msg.html\ +" \ +"Convert markdown to HTML5 and plaintext alternative content types" + +# khard / vdirsyncer as an autocompleting addressbook +set query_command = "khard email --parsable %s" +bind editor complete-query +bind editor ^T complete + +# default account +source ~/.config/mutt/accounts/1-personal.muttrc + +# swap between accounts +macro index,pager i1 'source ~/.config/mutt/accounts/1-personal.muttrc!;' "switch to personal" +macro index,pager i2 'source ~/.config/mutt/accounts/2-work.muttrc!;' "switch to work" diff --git a/dot_config/mutt/templates/email.html b/dot_config/mutt/templates/email.html new file mode 100644 index 0000000..8c15480 --- /dev/null +++ b/dot_config/mutt/templates/email.html @@ -0,0 +1,25 @@ + + + + + + +$for(css)$ + +$endfor$ + +$for(header-includes)$ + $header-includes$ +$endfor$ + + + $body$ + $for(include-after)$ + $include-after$ + $endfor$ + + diff --git a/dot_config/mutt/templates/encrypted_work.html.asc b/dot_config/mutt/templates/encrypted_work.html.asc new file mode 100644 index 0000000..a549c69 --- /dev/null +++ b/dot_config/mutt/templates/encrypted_work.html.asc @@ -0,0 +1,34 @@ +-----BEGIN PGP MESSAGE----- + +hF4Dt852JJsu9zQSAQdADlzt6BIwyLO/Yf1mYOdx/CqpOIW2cvqi5vDZVGrTAFMw +g0nPQUZDQBW6ILWD8gOs/DjQzrTLeBTO/kQrICuQR1EVi3LU0B7gNJvpuoKS0AWB +0uoB4KNirsq9pOmjbyOL0znyOUlLpfLbgLZZlnPG/to3IzjYUUlzlYI/9Fsu7p9J +J9pvVe3BLDMGadsc9d7Ja2K03BUulA12mq6amOxnRFAbZWkbWLcOax3FazPd44v2 +L2XRXb+Jc2gyB47y5TpjY3u+TmqLnGueu/nQhrOX4hL05SPhi3DdlTLUAMdjS0iF +q4bl5UlQmXvOf4uttnN39sHJ93IEKMi/Kh6ANIme2dPnXXuTXK91V8JoETdTIUwX +z29aX/pNsFxWReuCFJQoPCAdg87+SP+SZ45JCCG8iUIHvgMVEUaHdEtwR2Lo2Bnn +2EyOVjaBaY05M2sFJmxj7Mmfquhm/TkfPzMS/9x27i075ZWDuknEaJeD0IvKFR2h +vZN4Vcv6eYP9e1HL+vWha0HyWB4PD56clfRWPmhrWlmZx8k7f9trTod1wI8Z9pnt +nVQaj6wyCMQO5oliePGUwDWosssEKhyE0Ca3peQxPNg+TYreIrE9sWEaaySgzB70 +Rl7MUQiZ1aLiWHfnijqv6G2yV1fsIuTOvoBLAQVY4ajU3+TcC2krz4aIP2xapFC2 +mdlrbqNExwgMctTrjv/PsxbJgCLaK0rf9RaZBhm+mDORcKToqN+odhGHo8vnzYKe +p7g2nq4eL++uM4R+4CjE700zaKTmEzV3KUpTE9KCkL5VtDr+w+cmMNHGmR95P/+q +/Bgh33OY1bJOY7LNAHsWPl0BjrJLsTi7/eIJ8nKCT0vllW7TvNfVotNmjtWX/KIw +sJO/xoyvply9/eAIBiVK2n+Kav9XBuiToK+84tw8TiyAPXxDg9nEf4TNIgyB90gO +oDKQhmRL/jRBHP/k/k5flgg+OY60owx+letq8L03UyReFt6mW2oLuizRACBJ6wUq +RKmfPmajvtBPyIzv23zYGmRtubhwgeKQtQCMNJJ4wbQ/iFdJCBO8qKoYhxNonF94 +/aRCvQQOKT6enj1W7RnAPPGzEmyLRu1pu0G3KlIQHIL4Lnj5NKUomES1Cu9K5dER +OUqVaXiW8hAXHEClYRMV1UIxMDPOI0aSfU0FCtiK8NPKARMCZbcnePetJTnlwCaQ +by1evvis2DY0U5lZ6+9dwvp7diQ0dtw4193FGHjBWiF2jhPlfzjrouo6II2v1u1w +0j2Ntt6KtMVVFpzYMkaB4fdxms8lVxyw5U0pjSOBxo1po3kPFSA4P/ZgT2+IXvuz +EQZzRl9bE3EZRtf8YouSnErQIo5ppBzrawzSdFSpzQ+qbnostmmEgfMIX7DXE8CE +z4zlHStoZsEZGnbOZA5I4dAyOSgy1EG3E+nhkDzSkCth7FO8Lrlz0cVjiVb0fMx8 +b2x110Qedv4WAglhdJEsjKemwG6CyrcDoEf2UfbM8lkrkdoFndcr4ThkhYDUMprq +Bsfm476j00dc+W6RPaheZyGPGSHjz3oJJOG3sbD6vfVy30TTPOjSTAqGsPZHk/7q +SAVI7kOMHArkQRb/NSO4+bU/297WRM4IskiLFAj8wBQUf0JLQLbAShkXkhqyIHl6 +LM9MqAv0gir8nMuXUF35tjfrkp1+2tKhuv0OSYPjuJR9xIFbpFxiBbAaqrUAzXdS +TIbbwyh3gpjs+DRq6pC2Yv14+M0tdtrjHJiYCsosLisz+0mcF0mpVFmg+7qUw10+ +wrMphGtxzESSzXNfs+RQ6vUM0n4SdBXvZJXCN4xmPBxmfdB1HX9HAdQDWMTMsSo7 +daMHAmp9G9Fxs+okin3QAq4C6UoVLSu7qnO+geEcj7/qKQ== +=8s1o +-----END PGP MESSAGE----- diff --git a/dot_config/newsboat/urls b/dot_config/newsboat/urls new file mode 100644 index 0000000..0ce8856 --- /dev/null +++ b/dot_config/newsboat/urls @@ -0,0 +1,2 @@ +https://this-week-in-neovim.org/rss +https://neomutt.org/feed.xml diff --git a/dot_config/nvim/init.lua b/dot_config/nvim/init.lua new file mode 100644 index 0000000..9a773b2 --- /dev/null +++ b/dot_config/nvim/init.lua @@ -0,0 +1,109 @@ +-- vim:fdm=marker +pcall(require, "impatient") + +-- packer {{{ +local fn = vim.fn +local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim" +if fn.empty(fn.glob(install_path)) > 0 then + print("Cloning packer ..") + + fn.system({ "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path }) + + -- install plugins + compile their configs + vim.cmd("packadd packer.nvim") + require("plugins") + require("packer").sync() +end + +require("utils") +require("lsp") + +-- custom packer command +local packer_cmd = function(callback) + return function() + require("plugins") + require("packer")[callback]() + end +end + +local function cmd(lhs, fun, opt) + vim.api.nvim_create_user_command(lhs, fun, opt or {}) +end + +cmd("PackerClean", packer_cmd("clean")) +cmd("PackerCompile", packer_cmd("compile")) +cmd("PackerInstall", packer_cmd("install")) +cmd("PackerProfile", packer_cmd("profile")) +cmd("PackerStatus", packer_cmd("status")) +cmd("PackerSync", packer_cmd("sync")) +cmd("PackerUpdate", packer_cmd("update")) +-- }}} + +-- prelude +vim.opt.laststatus = 3 +vim.opt.list = true +vim.opt.number = true +vim.opt.relativenumber = true +vim.opt.scrolloff = 5 +vim.opt.showtabline = 2 +vim.opt.sidescrolloff = 15 +vim.opt.splitbelow = true +vim.opt.splitright = true +vim.opt.termguicolors = true +vim.opt.shadafile = nil + +-- basic boring stuff +vim.g.mapleader = " " +vim.opt.mouse = "nv" + +-- redefine word boundaries - '_' is a word seperator, this helps with snake_case +vim.cmd("set iskeyword-=_") + +-- easier split navigation +Nmap("", "j") +Nmap("", "k") +Nmap("", "l") +Nmap("", "h") +-- escape :terminal easier +vim.cmd([[tnoremap ]]) + +-- indentations settings +vim.opt.shiftwidth = 2 +vim.opt.tabstop = 2 +vim.opt.softtabstop = 2 +vim.opt.expandtab = true +-- indentation autocmds for some filetypes +vim.cmd([[ +" smol spaces for soydev +autocmd FileType html,css,js,jsreact,ts,tsreact,json,yaml setlocal ts=2 sw=2 sts=0 et +" Tabs, yikes +autocmd FileType go,lua setlocal ts=4 sw=4 sts=4 noet +" Spaces, based languages +autocmd FileType python,rust setlocal ts=4 sw=4 sts=4 et +]]) + +vim.api.nvim_create_autocmd("BufWritePost", { + pattern = "*.lua", + callback = function() + vim.defer_fn(function() + if vim.fn.expand("%:p"):match(vim.fn.resolve(vim.fn.stdpath("config"))) then + packer_cmd("compile") + end + end, 0) + end, +}) + +if vim.g.neovide then + vim.cmd("cd $HOME") + vim.g.neovide_cursor_vfx_mode = "ripple" + vim.g.neovide_input_macos_alt_is_meta = true + vim.o.guifont = "VictorMono Nerd Font:h18" + -- allow copy & paste in neovide, + -- https://github.com/neovide/neovide/issues/1263 + vim.cmd([[ + map "+p + map! + + tmap + + vmap "+y + ]]) +end diff --git a/dot_config/nvim/lua/config/barbar.lua b/dot_config/nvim/lua/config/barbar.lua new file mode 100644 index 0000000..d079aa9 --- /dev/null +++ b/dot_config/nvim/lua/config/barbar.lua @@ -0,0 +1,38 @@ +require("bufferline").setup({ + closable = false, + icons = "both", + insert_at_end = true, + no_name_title = "", +}) + +-- hop between buffers in order of the bar +Nmap("", "BufferPrevious") +Nmap("", "BufferNext") +-- Re-order to previous/next +Nmap("", "BufferMovePrevious") +Nmap(">", "BufferMoveNext") +-- Goto buffer in position... +Nmap("", "BufferGoto 1") +Nmap("", "BufferGoto 2") +Nmap("", "BufferGoto 3") +Nmap("", "BufferGoto 4") +Nmap("", "BufferGoto 5") +Nmap("", "BufferGoto 6") +Nmap("", "BufferGoto 7") +Nmap("", "BufferGoto 8") +Nmap("", "BufferGoto 9") +Nmap("", "BufferLast") +-- Pin/unpin buffer +Nmap("", "BufferPin") +-- Close buffer +Nmap("", "BufferClose") +Nmap("", "BufferClose!") +-- create new buffer +Nmap("", "enew") +-- pick buffer +Nmap("", "BufferPick") +-- Sort automatically by... +Nmap("bb", "BufferOrderByBufferNumber") +Nmap("bd", "BufferOrderByDirectory") +Nmap("bl", "BufferOrderByLanguage") +Nmap("bw", "BufferOrderByWindowNumber") diff --git a/dot_config/nvim/lua/config/catppuccin.lua b/dot_config/nvim/lua/config/catppuccin.lua new file mode 100644 index 0000000..e31f3c9 --- /dev/null +++ b/dot_config/nvim/lua/config/catppuccin.lua @@ -0,0 +1,75 @@ +-- use transparency in terminal only +local useTransparentBG = true +if vim.g.neovide then + useTransparentBG = false +end + +vim.g.catppuccin_flavour = "mocha" + +require("catppuccin").setup({ + transparent_background = false, + term_colors = true, + dim_inactive = { + enable = false, + shade = "dark", + percentage = 0.05, + }, + styles = { + comments = { "italic" }, + conditionals = { "italic" }, + }, + integrations = { + treesitter = true, + native_lsp = { + enabled = true, + virtual_text = { + errors = { "italic" }, + hints = { "italic" }, + warnings = { "italic" }, + information = { "italic" }, + }, + underlines = { + errors = { "underline" }, + hints = { "underline" }, + warnings = { "underline" }, + information = { "underline" }, + }, + }, + cmp = true, + coc_nvim = false, + lsp_saga = true, + lsp_trouble = true, + nvimtree = { + enabled = false, + }, + neotree = { + enabled = true, + show_root = false, + transparent_panel = false, + }, + which_key = true, + indent_blankline = { + enabled = true, + colored_indent_levels = true, + }, + barbar = false, + bufferline = true, + dashboard = true, + fern = false, + gitgutter = false, + gitsigns = true, + hop = false, + leap = false, + lightspeed = false, + markdown = true, + neogit = true, + notify = true, + symbols_outline = true, + telekasten = false, + telescope = true, + ts_rainbow = true, + vim_sneak = false, + } +}) + +vim.cmd("colorscheme catppuccin") diff --git a/dot_config/nvim/lua/config/dashboard.lua b/dot_config/nvim/lua/config/dashboard.lua new file mode 100644 index 0000000..79bfe68 --- /dev/null +++ b/dot_config/nvim/lua/config/dashboard.lua @@ -0,0 +1,66 @@ +local home = os.getenv("HOME") +local db = require("dashboard") + +db.custom_header = function() + local quotes = { + "Demonic presence at unsafe levels.", + "Rip and tear, until it is done.", + "So you walk eternally through the shadow realms.", + "The only thing they fear... is you.", + "There he lies still, and ever more, in silent suffering.", + "We will send unto them...only you.", + "What you see now in this facility is the cost. Of progress.", + "You can't just shoot a hole in the surface of mars!", + "WARNING: The Slayer has entered the facility.", + "DANGER: THE SLAYER HAS CONTROL OF THE BFG.", + } + local random_quote = quotes[math.random(#quotes)] + return { + [[]], + [[ _ _ _____ _ _ _____ _____ _____ _ _ _ _ ________ ___]], + [[| | | |_ _| \ | |/ ___|_ _| _ | \ | | | | | |_ _| \/ |]], + [[| | | | | | | \| |\ `--. | | | | | | \| | | | | | | | | . . |]], + [[| |/\| | | | | . ` | `--. \ | | | | | | . ` | | | | | | | | |\/| |]], + [[\ /\ /_| |_| |\ |/\__/ / | | \ \_/ / |\ | _ \ \_/ /_| |_| | | |]], + [[ \/ \/ \___/\_| \_/\____/ \_/ \___/\_| \_/ (_) \___/ \___/\_| |_/]], + [[]], + random_quote, + [[]], + } +end + +db.custom_center = { + { + icon = " ", + desc = "Restore latest session ", + action = "SessionLoad", + }, + { + icon = " ", + desc = "Open Projects ", + action = "Telescope project", + }, + { + icon = " ", + desc = "Find File ", + action = "Telescope find_files find_command=rg,--hidden,--files", + }, + { + icon = " ", + desc = "File Browser ", + action = "Telescope file_browser", + }, + { + icon = " ", + desc = "Find word ", + action = "Telescope live_grep", + }, + { + icon = " ", + desc = "Open Settings ", + action = function() + vim.cmd("cd " .. home .. "/.config/nvim/") + vim.cmd("edit init.lua") + end + }, +} diff --git a/dot_config/nvim/lua/config/empty_init.lua b/dot_config/nvim/lua/config/empty_init.lua new file mode 100644 index 0000000..e69de29 diff --git a/dot_config/nvim/lua/config/feline.lua b/dot_config/nvim/lua/config/feline.lua new file mode 100644 index 0000000..0bb6ef1 --- /dev/null +++ b/dot_config/nvim/lua/config/feline.lua @@ -0,0 +1,58 @@ +local clrs = require("catppuccin.palettes.init").get_palette() +local ctp_feline = require("catppuccin.groups.integrations.feline") + +ctp_feline.setup({ + assets = { + left_separator = "", + right_separator = "", + bar = "█", + mode_icon = " ", + }, + sett = { + show_modified = true, + curr_dir = clrs.mauve, + curr_file = clrs.blue, + }, +}) + +require("feline").setup({ + components = ctp_feline.get(), + force_inactive = { + filetypes = { + "^packer$", + "^startify$", + "^fugitive$", + "^fugitiveblame$", + "^qf$", + "^help$", + }, + buftypes = { + "^terminal$", + }, + bufnames = {}, + }, +}) + +-- local navic = require("nvim-navic") + +-- local wbar = { +-- active = {}, +-- inactive = {} +-- } +-- table.insert(wbar.active, {}) +-- table.insert(wbar.active, {}) +-- table.insert(wbar.active, {}) + +-- table.insert(wbar.active[1], { +-- provider = function() +-- return navic.get_location() +-- end, +-- enabled = function() +-- return navic.is_available() +-- end, +-- }) +-- table.insert(wbar.active[3], { +-- provider = 'lsp_client_names' +-- }) + +-- require("feline").winbar.setup({ components = wbar }) diff --git a/dot_config/nvim/lua/config/gitsigns.lua b/dot_config/nvim/lua/config/gitsigns.lua new file mode 100644 index 0000000..480e01b --- /dev/null +++ b/dot_config/nvim/lua/config/gitsigns.lua @@ -0,0 +1,63 @@ +require("gitsigns").setup({ + signs = { + add = { + hl = "GitSignsAdd", + text = "+", + numhl = "GitSignsAddNr", + linehl = "GitSignsAddLn", + }, + change = { + hl = "GitSignsChange", + text = "~", + numhl = "GitSignsChangeNr", + linehl = "GitSignsChangeLn", + }, + delete = { + hl = "GitSignsDelete", + text = "_", + numhl = "GitSignsDeleteNr", + linehl = "GitSignsDeleteLn", + }, + topdelete = { + hl = "GitSignsDelete", + text = "‾", + numhl = "GitSignsDeleteNr", + linehl = "GitSignsDeleteLn", + }, + changedelete = { + hl = "GitSignsChange", + text = "x", + numhl = "GitSignsChangeNr", + linehl = "GitSignsChangeLn", + }, + }, + linehl = false, + numhl = false, + signcolumn = true, + word_diff = false, + watch_gitdir = { interval = 1000, follow_files = true }, + attach_to_untracked = true, + -- current line highlighting + current_line_blame = true, + current_line_blame_opts = { + delay = 1000, + ignore_whitespace = true, + virt_text = true, + virt_text_pos = "eol", + }, + current_line_blame_formatter = ", - | ", + -- perf + max_file_length = 40000, + sign_priority = 6, + update_debounce = 100, + -- use the included status formatter + status_formatter = nil, + preview_config = { + border = "single", + style = "minimal", + relative = "cursor", + row = 0, + col = 1, + }, + yadm = { enable = false }, +}) diff --git a/dot_config/nvim/lua/config/lspsaga.lua b/dot_config/nvim/lua/config/lspsaga.lua new file mode 100644 index 0000000..2ce7cfe --- /dev/null +++ b/dot_config/nvim/lua/config/lspsaga.lua @@ -0,0 +1,111 @@ +local saga = require("lspsaga") +saga.init_lsp_saga({ + symbol_in_winbar = { + in_custom = true, + enable = true, + separator = " > ", + show_file = true, + click_support = function(node, clicks, button, modifier) + -- To see all avaiable defails: vim.pretty_print(node) + local st = node.range.start + local en = node.range["end"] + if button == "l" then + if modifier == "c" then + print("lspsaga") -- ctrl left click to print "lspsaga" + end -- jump to node's ending line+char + if clicks == 2 then + -- double left click to visual select + vim.fn.cursor(st.line + 1, st.character + 1) + vim.cmd.normal("v") + vim.fn.cursor(en.line + 1, en.character + 1) + else -- jump to node's starting line+char + vim.fn.cursor(st.line + 1, st.character + 1) + end + elseif button == "r" then + if modifier == "c" then + print("lspsaga") -- shift right click to print "lspsaga" + end -- jump to node's ending line+char + vim.fn.cursor(en.line + 1, en.character + 1) + elseif button == "m" then + -- middle click to visual select node + vim.fn.cursor(st.line + 1, st.character + 1) + vim.cmd.normal("v") + vim.fn.cursor(en.line + 1, en.character + 1) + end + end, + }, +}) + +Nmap("gr", "Lspsaga rename") +Nmap("gx", "Lspsaga code_action") +Xmap("gx", ":Lspsaga range_code_action") +Nmap("K", "Lspsaga hover_doc") +Nmap("go", "Lspsaga show_line_diagnostics") +Nmap("gj", "Lspsaga diagnostic_jump_next") +Nmap("gk", "Lspsaga diagnostic_jump_prev") +Nmap("", "lua require('lspsaga.action').smart_scroll_with_saga(-1, '')", {}) +Nmap("", "lua require('lspsaga.action').smart_scroll_with_saga(1, '')", {}) + +-- nullchilly winbar +local function get_file_name(include_path) + local file_name = require("lspsaga.symbolwinbar").get_file_name() + if vim.fn.bufname("%") == "" then + return "" + end + if include_path == false then + return file_name + end + -- Else if include path: ./lsp/saga.lua -> lsp > saga.lua + local sep = vim.loop.os_uname().sysname == "Windows" and "\\" or "/" + local path_list = vim.split(string.gsub(vim.fn.expand("%:~:.:h"), "%%", ""), sep) + local file_path = "" + for _, cur in ipairs(path_list) do + file_path = (cur == "." or cur == "~") and "" or file_path .. cur .. " " .. "%#LspSagaWinbarSep#>%*" .. " %*" + end + return file_path .. file_name +end + +local function config_winbar() + local exclude = { + ["teminal"] = true, + ["toggleterm"] = true, + ["prompt"] = true, + ["NvimTree"] = true, + ["help"] = true, + } -- Ignore float windows and exclude filetype + if vim.api.nvim_win_get_config(0).zindex or exclude[vim.bo.filetype] then + vim.wo.winbar = "" + else + local ok, lspsaga = pcall(require, "lspsaga.symbolwinbar") + local sym + if ok then + sym = lspsaga.get_symbol_node() + end + local win_val = "" + win_val = get_file_name(true) -- set to true to include path + if sym ~= nil then + win_val = win_val .. sym + end + vim.wo.winbar = win_val + end +end + +local events = { "BufEnter", "BufWinEnter", "CursorMoved" } +vim.api.nvim_create_autocmd(events, { + pattern = "*", + callback = function() + config_winbar() + end, +}) + +vim.api.nvim_create_autocmd("User", { + pattern = "LspsagaUpdateSymbol", + callback = function() + config_winbar() + end, +}) + +vim.cmd([[ + nnoremap lua require('lspsaga.floaterm').open_float_terminal() + tnoremap :lua require('lspsaga.floaterm').close_float_terminal() +]]) diff --git a/dot_config/nvim/lua/config/presence.lua b/dot_config/nvim/lua/config/presence.lua new file mode 100644 index 0000000..2fed32d --- /dev/null +++ b/dot_config/nvim/lua/config/presence.lua @@ -0,0 +1,106 @@ +function string.starts(self, str) + return self:find('^' .. str) ~= nil +end + +local conceal = function() + local home = os.getenv("HOME") + local blacklist = { + [home .. "/git/work"] = "Working...", + [home .. "/git/freelance"] = "Freelancing...", + [home .. "/git/freelance"] = "Freelancing...", + } + + local cur_file = vim.fn.expand("%:p") + for k, v in pairs(blacklist) do + if cur_file:starts(k) then + return v + end + end + return false +end + +require("presence"):setup({ + -- General options + auto_update = true, + neovim_image_text = "The Soydev's Kryptonite", + -- Main image display (either "neovim" or "file") + main_image = "file", + -- A list of strings or Lua patterns that disable Rich Presence if the current file name, path, or workspace matches + ---@diagnostic disable-next-line: unused-local + buttons = function(buffer, repo_url) + -- ignore where no repo_url is set + if repo_url == nil then + return false + end + + -- only show certain org/user repos, don't leak clients or work + local visible_urls = { + "github.com/catppuccin", + "github.com/farbenfroh", + "github.com/nekowinston", + } + + -- check if repo_url is in the list of visible urls + for _, visible_url in ipairs(visible_urls) do + if repo_url:find(visible_url) then + return { + { + label = "Steal the code", + url = repo_url, + }, + } + end + end + + -- if not, return false + return false + end, + debounce_timeout = 10, + file_assets = { + ["k8s.yaml"] = { + "Kubernetes", + "https://raw.githubusercontent.com/kubernetes/kubernetes/master/logo/logo.png", + }, + ["Chart.yaml"] = { + "Helm Chart", + "https://raw.githubusercontent.com/helm/community/main/art/images/Logo-Tweak-Dark.png", + }, + ["helmfile.yaml"] = { + "helmfile", + "https://raw.githubusercontent.com/helm/community/main/art/images/Logo-Tweak-Dark.png", + } + }, + -- Rich Presence text options + editing_text = function(s) + local concealed = conceal() + if concealed then + return concealed + end + return "✍️ " .. s + end, + reading_text = function(s) + local concealed = conceal() + if concealed then + return concealed + end + return "📖 " .. s + end, + file_explorer_text = function(s) + local concealed = conceal() + if concealed then + return concealed + end + return "📁 " .. s + end, + workspace_text = function(s) + local concealed = conceal() + if s ~= nil and not concealed then + return "🗂️ ".. s + else + return nil + end + end, + git_commit_text = "Committing changes", + plugin_manager_text = "🤹 Plugins", + line_number_text = "L%s of %s", +}) diff --git a/dot_config/nvim/lua/config/treesitter.lua b/dot_config/nvim/lua/config/treesitter.lua new file mode 100644 index 0000000..99f96da --- /dev/null +++ b/dot_config/nvim/lua/config/treesitter.lua @@ -0,0 +1,65 @@ +require("nvim-treesitter.configs").setup({ + auto_install = true, + ignore_install = { + -- woulnd't install sometimes, not needed + "phpdoc", + }, + highlight = { + enable = true, + }, + ensure_installed = { + "bash", + "c", + "cmake", + "comment", + "cpp", + "css", + "dockerfile", + "fish", + "gdscript", + "glsl", + "go", + "godot_resource", + "gomod", + "gowork", + "graphql", + "help", + "hjson", + "html", + "http", + "java", + "javascript", + "jsdoc", + "json", + "json5", + "jsonc", + "kotlin", + "latex", + "lua", + "make", + "markdown", + "ninja", + "perl", + "php", + "prisma", + "proto", + "pug", + "python", + "rasi", + "regex", + "ruby", + "rust", + "scss", + "sql", + "svelte", + "swift", + "teal", + "todotxt", + "toml", + "tsx", + "typescript", + "vim", + "vue", + "yaml", + }, +}) diff --git a/dot_config/nvim/lua/lsp.lua b/dot_config/nvim/lua/lsp.lua new file mode 100644 index 0000000..3e8c666 --- /dev/null +++ b/dot_config/nvim/lua/lsp.lua @@ -0,0 +1,236 @@ +require("mason").setup({ + ui = { + border = "none", + icons = { + package_installed = " ", + package_pending = " ", + package_uninstalled = " ", + }, + }, +}) +require("mason-lspconfig").setup({ automatic_installation = true }) + +vim.opt.completeopt = "menu,menuone,noselect" + +-- debug mode enabled +vim.lsp.set_log_level("debug") + +-- Setup nvim-cmp. +local cmp = require("cmp") +cmp.setup({ + snippet = { + expand = function(args) + vim.fn["vsnip#anonymous"](args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping.confirm({ select = true }), + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "vsnip" }, + }, { { name = "buffer" } }), +}) + +-- Set configuration for specific filetype. +cmp.setup.filetype("gitcommit", { + sources = cmp.config.sources({ + { name = "cmp_git" }, + }, { { name = "buffer" } }), +}) +-- search +cmp.setup.cmdline("/", { + mapping = cmp.mapping.preset.cmdline(), + sources = { { name = "buffer" } }, +}) +-- Use cmdline & path source for ':' +cmp.setup.cmdline(":", { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources( + { { + name = "path", + option = { trailing_slash = true }, + } }, + { { name = "cmdline" } } + ), +}) + +-- Setup lspconfig. +local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()) + +-- Mappings. +-- See `:help vim.diagnostic.*` for documentation on any of the below functions +local opts = { noremap = true, silent = true } +vim.keymap.set("n", "e", vim.diagnostic.open_float, opts) +vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) +vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts) +vim.keymap.set("n", "q", vim.diagnostic.setloclist, opts) + +-- Use an on_attach function to only map the following keys +-- after the language server attaches to the current buffer +---@diagnostic disable-next-line: unused-local +local on_attach = function(client, bufnr) + -- Enable completion triggered by + vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc") + + -- disable yaml diagnostics on Helm files + if vim.bo[bufnr].buftype ~= "" or vim.bo[bufnr].filetype == "helm" then + vim.diagnostic.disable() + end + + -- Mappings. + -- See `:help vim.lsp.*` for documentation on any of the below functions + local bufopts = { noremap = true, silent = true, buffer = bufnr } + vim.keymap.set("n", "gD", vim.lsp.buf.declaration, bufopts) + vim.keymap.set("n", "gd", vim.lsp.buf.definition, bufopts) + vim.keymap.set("n", "K", vim.lsp.buf.hover, bufopts) + vim.keymap.set("n", "gi", vim.lsp.buf.implementation, bufopts) + vim.keymap.set("n", "", vim.lsp.buf.signature_help, bufopts) + vim.keymap.set("n", "wa", vim.lsp.buf.add_workspace_folder, bufopts) + vim.keymap.set("n", "wr", vim.lsp.buf.remove_workspace_folder, bufopts) + vim.keymap.set("n", "wl", function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, bufopts) + vim.keymap.set("n", "D", vim.lsp.buf.type_definition, bufopts) + vim.keymap.set("n", "rn", vim.lsp.buf.rename, bufopts) + vim.keymap.set("n", "ca", vim.lsp.buf.code_action, bufopts) + vim.keymap.set("n", "gr", vim.lsp.buf.references, bufopts) + vim.keymap.set("n", "nf", function() + vim.lsp.buf.format({ + -- filter to only use null-ls + filter = function(c) + return c.name == "null-ls" + end, + bufnr = bufnr, + }) + end, bufopts) +end + +local common_config = { + on_attach = on_attach, +} + +local lsp = require("lspconfig") +-- joke language +lsp.sumneko_lua.setup({ + on_attach = on_attach, + capabilities = capabilities, + settings = { + Lua = { + workspace = { + -- Make the server aware of Neovim runtime files + library = vim.api.nvim_get_runtime_file("", true), + checkThirdParty = false, + maxPreload = 100000, + preloadFileSize = 10000, + }, + diagnostics = { + -- Get the language server to recognize the `vim` global + globals = { "vim" }, + }, + telemetry = { + enable = false, + }, + }, + }, +}) + +--- the cool kids +lsp.bashls.setup(common_config) +lsp.gopls.setup(common_config) +lsp.pyright.setup(common_config) +lsp.rust_analyzer.setup(common_config) + +--- Web Development +lsp.cssls.setup(common_config) +local emmet_cap = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()) +emmet_cap.textDocument.completion.completionItem.snippetSupport = true +lsp.emmet_ls.setup({ + on_attach = on_attach, + capabilities = emmet_cap, + filetypes = { + "javascriptreact", + "typescriptreact", + "html", + "svelte", + "css", + "less", + "sass", + "scss", + }, +}) +-- lsp.html.setup(common_config) +lsp.tailwindcss.setup({ + on_attach = on_attach, + capabilities = capabilities, + settings = { + emmetCompletions = true, + }, +}) + +-- soydev +lsp.prismals.setup(common_config) +lsp.svelte.setup(common_config) +-- attach tsserver only when there's a 'package.json' file in the CWD +lsp.tsserver.setup({ + on_attach = on_attach, + capabilities = capabilities, + root_dir = lsp.util.root_pattern("package.json"), +}) +-- attach deno only when there's a 'deps.ts' file in the CWD +lsp.denols.setup({ + on_attach = on_attach, + capabilities = capabilities, + root_dir = lsp.util.root_pattern("deps.ts"), + single_file_support = false, +}) + +-- data formats +lsp.dockerls.setup(common_config) +lsp.graphql.setup({ + on_attach = on_attach, + capabilities = capabilities, + root_dir = lsp.util.root_pattern(".graphqlrc*", ".graphql.config.*", "graphql.config.*"), + settings = { + graphql = { + schemaPath = "schema.graphql", + }, + }, +}) +lsp.jsonls.setup({ + on_attach = on_attach, + capabilities = capabilities, + settings = { + json = { + schemas = require("schemastore").json.schemas(), + validate = { enable = true }, + }, + }, +}) +lsp.yamlls.setup({ + on_attach = on_attach, + capabilities = capabilities, + settings = { + redhat = { + telemetry = { + enabled = false, + }, + }, + yaml = { + schemas = { + ["https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.24.2-standalone-strict/all.json"] = { + "*.k8s.yaml", + "*.k8s.yml", + "kubectl-edit-*.yaml", + }, + }, + }, + }, +}) + +--- Documentation +lsp.ltex.setup(common_config) +-- lsp.marksman.setup(common_config) +-- lsp.prosemd_lsp.setup(common_config) diff --git a/dot_config/nvim/lua/plugins.lua b/dot_config/nvim/lua/plugins.lua new file mode 100644 index 0000000..2539513 --- /dev/null +++ b/dot_config/nvim/lua/plugins.lua @@ -0,0 +1,471 @@ +require("utils") + +vim.cmd([[packadd packer.nvim]]) +local packer = require("packer") +-- slow internet... +packer.init({ + git = { clone_timeout = 180 }, + profile = { + enable = true, + }, +}) + +return packer.startup(function(use) + -- Packer managing itself + use("wbthomason/packer.nvim") + -- startup time or some shit + use("lewis6991/impatient.nvim") + + -- colour scheme + use({ + "catppuccin/nvim", + as = "catppuccin", + branch = "dev", + config = function() + require("config/catppuccin") + end, + }) + use({ + "Pocco81/true-zen.nvim", + branch = "main", + config = function() + require("true-zen").setup({ + modes = { + ataraxis = { + shade = "dark", + backdrop = 0.00, + quit_untoggles = true, + padding = { + left = 52, + right = 52, + top = 0, + bottom = 0, + }, + }, + narrow = { + run_ataraxis = true, + }, + }, + integrations = { + tmux = true, + }, + }) + end, + }) + + -- git gutter + use({ + "lewis6991/gitsigns.nvim", + config = function() + require("config/gitsigns") + end, + }) + + -- rainbow indents + use({ + "lukas-reineke/indent-blankline.nvim", + config = function() + require("indent_blankline").setup({ + space_char_blankline = " ", + show_current_conext = true, + char_highlight_list = { + "IndentBlanklineIndent1", + "IndentBlanklineIndent2", + "IndentBlanklineIndent3", + "IndentBlanklineIndent4", + "IndentBlanklineIndent5", + "IndentBlanklineIndent6", + }, + }) + vim.g.indent_blankline_filetype_exclude = { + "dashboard", + "help", + "neogitstatus", + "fugitive", + "packer", + "NvimTree", + "Trouble", + } + end, + }) + + -- top bar + use({ + "akinsho/bufferline.nvim", + config = function() + require("bufferline").setup({ + options = { + show_close_icon = false, + separator_style = "slant", + close_icon = "", + offsets = { { filetype = "NvimTree" } }, + left_mouse_command = "buffer %d", + middle_mouse_command = "bdelete! %d", + right_mouse_command = nil, + }, + }) + -- hop between buffers in order of the bar + Nmap("", "BufferLineCyclePrev") + Nmap("", "BufferLineCycleNext") + -- Re-order to previous/next + Nmap("", "BufferLineMovePrev") + Nmap(">", "BufferLineMoveNext") + -- Goto buffer in position... + Nmap("", "BufferLineGoToBuffer 1") + Nmap("", "BufferLineGoToBuffer 2") + Nmap("", "BufferLineGoToBuffer 3") + Nmap("", "BufferLineGoToBuffer 4") + Nmap("", "BufferLineGoToBuffer 5") + Nmap("", "BufferLineGoToBuffer 6") + Nmap("", "BufferLineGoToBuffer 7") + Nmap("", "BufferLineGoToBuffer 8") + Nmap("", "BufferLineGoToBuffer 9") + Nmap("", "BufferLineGoToBuffer -1") + -- Pin/unpin buffer + Nmap("", "BufferLineTogglePin") + -- Close buffer + Nmap("", "bdelete") + Nmap("", "bdelete!") + -- create new buffer + Nmap("", "enew") + -- pick buffer + Nmap("", "BufferLinePick") + -- Sort automatically by... + Nmap("bd", "BufferLineSortByDirectory") + Nmap("bl", "BufferLineSortByExtension") + end, + }) + + -- bottom bar + use({ + "feline-nvim/feline.nvim", + requires = "kyazdani42/nvim-web-devicons", + after = { "catppuccin" }, + config = function() + require("config/feline") + end, + }) + + -- DJI Osmo + use({ + "luukvbaal/stabilize.nvim", + config = function() + require("stabilize").setup() + end, + }) + + -- syntax + use({ + "nvim-treesitter/nvim-treesitter", + run = ":TSUpdate", + config = function() + require("config/treesitter") + end, + }) + use({ "p00f/nvim-ts-rainbow", requires = "nvim-treesitter/nvim-treesitter" }) + + -- show possible key combos + use({ + "folke/which-key.nvim", + config = function() + require("which-key").setup({}) + end, + }) + -- we IDE now + use({ + "rcarriga/nvim-notify", + config = function() + require("notify").setup({ + fps = 60, + timeout = 2500, + stages = "fade", + }) + end, + }) + + -- syntax + use("alker0/chezmoi.vim") + use("digitaltoad/vim-pug") + use("ron-rs/ron.vim") + use("elkowar/yuck.vim") + + -- tooling + use({ + "editorconfig/editorconfig-vim", + config = function() + -- add fugitive buffers to the editorconfig excludes + vim.g.EditorConfig_exclude_patterns = { "fugitive://.*", "scp://.*" } + end, + }) + -- read and write encrypted pgp files + use("jamessan/vim-gnupg") + + -- additional functionality + use("tpope/vim-commentary") + use("tpope/vim-surround") + use("ggandor/lightspeed.nvim") + -- make those above work in repeat commands + use("tpope/vim-repeat") + + use({ + "windwp/nvim-autopairs", + config = function() + require("nvim-autopairs").setup({}) + local cmp_autopairs = require("nvim-autopairs.completion.cmp") + local cmp = require("cmp") + cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) + end, + }) + use({ + "windwp/nvim-ts-autotag", + config = function() + require("nvim-ts-autotag").setup() + end, + }) + use({ + "heavenshell/vim-jsdoc", + run = "make install", + config = function() + Nmap("jd", "JsDoc") + end, + }) + + -- git + use("tpope/vim-fugitive") + -- why not both? + use({ + "TimUntersberger/neogit", + requires = "nvim-lua/plenary.nvim", + config = function() + Nmap("ng", "Neogit") + end, + }) + use("christoomey/vim-sort-motion") + use("dhruvasagar/vim-table-mode") + use({ + "kyazdani42/nvim-tree.lua", + config = function() + require("nvim-tree").setup({ update_cwd = true }) + Nmap("", ":NvimTreeToggle") + Nmap("r", ":NvimTreeRefresh") + end, + }) + use({ + "RRethy/vim-hexokinase", + run = "make", + config = function() + vim.g.Hexokinase_highlighters = { "virtual" } + end, + }) + use({ + "simrat39/symbols-outline.nvim", + config = function() + Nmap("so", ":SymbolsOutline") + end, + }) + + -- databases + use({ + "kristijanhusak/vim-dadbod-ui", + requires = "tpope/vim-dadbod", + config = function() + Nmap("db", ":DBUIToggle") + vim.g.db_ui_use_nerd_fonts = true + vim.g.db_ui_win_position = "right" + end, + }) + use({ + "kristijanhusak/vim-dadbod-completion", + requires = { { "tpope/vim-dadbod" }, { "hrsh7th/nvim-cmp" } }, + config = function() + require("cmp").setup.buffer({ sources = { { name = "vim-dadbod-completion" } } }) + end, + }) + + -- telescope + use({ + "nvim-telescope/telescope.nvim", + requires = "nvim-lua/plenary.nvim", + config = function() + -- Find files using Telescope command-line sugar. + Nmap("fc", "Telescope conventional_commits") + Nmap("fr", "Telescope asynctasks all") + Nmap("ff", "Telescope find_files") + Nmap("fg", "Telescope live_grep") + Nmap("fb", "Telescope buffers") + Nmap("fh", "Telescope help_tags") + end, + }) + use({ + "nvim-telescope/telescope-fzf-native.nvim", + run = "make", + requires = "nvim-telescope/telescope.nvim", + config = function() + local telescope = require("telescope") + telescope.setup({ + extensions = { + fzf = { + fuzzy = true, + override_generic_sorter = true, + override_file_sorter = true, + case_mode = "smart_case", + }, + }, + }) + telescope.load_extension("fzf") + end, + }) + use({ + "nvim-telescope/telescope-file-browser.nvim", + config = function() + require("telescope").load_extension("file_browser") + end, + }) + use({ + "nvim-telescope/telescope-project.nvim", + config = function() + require("telescope").load_extension("project") + end, + }) + use({ + "olacin/telescope-cc.nvim", + requires = { + { "nvim-telescope/telescope.nvim" }, + { "nvim-lua/popup.nvim" }, + }, + config = function() + require("telescope").load_extension("conventional_commits") + end, + }) + use({ + "sudormrfbin/cheatsheet.nvim", + }) + + use({ + "andweeb/presence.nvim", + config = function() + require("config/presence") + end, + }) + use({ "iamcco/markdown-preview.nvim", run = "cd app && yarn install" }) + + -- external extensions + use("williamboman/mason.nvim") + -- LSP + use("williamboman/mason-lspconfig.nvim") + use("neovim/nvim-lspconfig") + -- completion + use("hrsh7th/nvim-cmp") + use("hrsh7th/cmp-buffer") + use("hrsh7th/cmp-cmdline") + use("hrsh7th/cmp-nvim-lsp") + use("hrsh7th/cmp-path") + use("hrsh7th/cmp-vsnip") + use("hrsh7th/vim-vsnip") + use("petertriho/cmp-git") + -- other + use({ + "jose-elias-alvarez/null-ls.nvim", + config = function() + local null_ls = require("null-ls") + null_ls.setup({ + sources = { + null_ls.builtins.formatting.gofmt, + null_ls.builtins.formatting.prettier, + null_ls.builtins.formatting.rustfmt, + null_ls.builtins.formatting.stylua, + }, + }) + end, + requires = { "nvim-lua/plenary.nvim" }, + }) + + use({ + "simrat39/rust-tools.nvim", + config = function() + require("rust-tools").setup({}) + end, + }) + use("b0o/schemastore.nvim") + -- + use({ + "folke/trouble.nvim", + config = function() + require("trouble").setup({}) + end, + }) + use({ + "glepnir/lspsaga.nvim", + config = function() + require("config/lspsaga") + end, + }) + -- + use({ + "github/copilot.vim", + config = function() + Imap("", "copilot#Accept()", { noremap = true, silent = true, expr = true }) + vim.g.copilot_no_tab_map = true + end, + }) + + -- organization + use({ + "vimwiki/vimwiki", + branch = "dev", + config = function() + vim.g.vimwiki_global_ext = 0 + vim.g.vimwiki_list = { + { + auto_export = 1, + path_html = "~/.local/share/vimwiki/", + path = "~/.local/share/vimwiki/", + syntax = "markdown", + ext = ".md", + }, + } + end, + }) + use("tools-life/taskwiki") + use({ + "skywind3000/asyncrun.vim", + config = function() + vim.g.asyncrun_open = 6 + end, + }) + use({ "skywind3000/asynctasks.vim" }) + use({ + "GustavoKatel/telescope-asynctasks.nvim", + config = function() + require("telescope").load_extension("asynctasks") + end, + }) + + -- startup + use({ + "glepnir/dashboard-nvim", + config = function() + require("config/dashboard") + end, + }) + + -- automatic theme switching + use({ + "f-person/auto-dark-mode.nvim", + config = function() + local auto_dark_mode = require("auto-dark-mode") + auto_dark_mode.setup({ + ---@diagnostic disable-next-line: assign-type-mismatch + update_interval = 5000, + set_dark_mode = function() + vim.cmd("Catppuccin mocha") + end, + set_light_mode = function() + vim.cmd("Catppuccin latte") + end, + }) + auto_dark_mode.init() + end, + cond = vim.fn.has("macunix"), + }) +end) diff --git a/dot_config/nvim/lua/utils.lua b/dot_config/nvim/lua/utils.lua new file mode 100644 index 0000000..f16d2ae --- /dev/null +++ b/dot_config/nvim/lua/utils.lua @@ -0,0 +1,18 @@ +local function map(mode, shortcut, command, opt) + vim.keymap.set(mode, shortcut, command, opt) +end + +function Nmap(shortcut, command, opt) + opt = opt or { noremap = true, silent = true } + map("n", shortcut, command, opt) +end + +function Imap(shortcut, command, opt) + opt = opt or { noremap = true, silent = true } + map("i", shortcut, command, opt) +end + +function Xmap(shortcut, command, opt) + opt = opt or { noremap = true, silent = true } + map("x", shortcut, command, opt) +end diff --git a/dot_config/pass-git-helper/encrypted_git-pass-mapping.ini.asc b/dot_config/pass-git-helper/encrypted_git-pass-mapping.ini.asc new file mode 100644 index 0000000..029eea7 --- /dev/null +++ b/dot_config/pass-git-helper/encrypted_git-pass-mapping.ini.asc @@ -0,0 +1,10 @@ +-----BEGIN PGP MESSAGE----- + +hF4Dt852JJsu9zQSAQdAJKDgbUchDhAHfojOyIOHRBU+WIJXHstaCPOrPWxvfW4w +RJt2LYBB2EynZ2URPGKb7JuIOnaQVHrUpdqLqTewv6PgrCIhSvj8bmxM0uJCRp0k +0rsBLe30wj1au6VG3nlz2j4Wip8Sz9JrzfDdFR/4V6+hGFXH9Wy4qkdPWj6vZm3+ +TFG9LlUMV6NxmzyrI3Lf7oVQ589KX4mn617xkErGDjgITdGN7rfpd24ML94uQYbA +cF0PYFH2bxHh+AtAMYq6Tg+Af7nhQm7CZMTrcYhnl99/O+WXgq3RGEK1bqGe63XL +/Y721oRPf4egZvahAGzchjqHXJXlxvK1vJC3YasqF2722BTKiqVwZSr5+sIZ +=sh0b +-----END PGP MESSAGE----- diff --git a/dot_config/picom.conf b/dot_config/picom.conf new file mode 100644 index 0000000..7b28933 --- /dev/null +++ b/dot_config/picom.conf @@ -0,0 +1,417 @@ +################################# +# Shadows # +################################# + + +# Enabled client-side shadows on windows. Note desktop windows +# (windows with '_NET_WM_WINDOW_TYPE_DESKTOP') never get shadow, +# unless explicitly requested using the wintypes option. +# +# shadow = false +shadow = true + +# The blur radius for shadows, in pixels. (defaults to 12) +# shadow-radius = 12 +shadow-radius = 8 + +# The opacity of shadows. (0.0 - 1.0, defaults to 0.75) +shadow-opacity = .5 + +# The left offset for shadows, in pixels. (defaults to -15) +# shadow-offset-x = -15 +shadow-offset-x = -7 + +# The top offset for shadows, in pixels. (defaults to -15) +# shadow-offset-y = -15 +shadow-offset-y = -7 + +# Red color value of shadow (0.0 - 1.0, defaults to 0). +# shadow-red = 0 + +# Green color value of shadow (0.0 - 1.0, defaults to 0). +# shadow-green = 0 + +# Blue color value of shadow (0.0 - 1.0, defaults to 0). +# shadow-blue = 0 + +# Hex string color value of shadow (#000000 - #FFFFFF, defaults to #000000). This option will override options set shadow-(red/green/blue) +# shadow-color = "#000000" + +# Specify a list of conditions of windows that should have no shadow. +# +# examples: +# shadow-exclude = "n:e:Notification"; +# +# shadow-exclude = [] +shadow-exclude = [ + "name = 'Notification'", + "class_g = 'Conky'", + "class_g ?= 'Notify-osd'", + "class_g = 'Cairo-clock'", + "_GTK_FRAME_EXTENTS@:c" +]; + +# Specify a list of conditions of windows that should have no shadow painted over, such as a dock window. +# clip-shadow-above = [] + +# Specify a X geometry that describes the region in which shadow should not +# be painted in, such as a dock window region. Use +# shadow-exclude-reg = "x10+0+0" +# for example, if the 10 pixels on the bottom of the screen should not have shadows painted on. +# +# shadow-exclude-reg = "" + +# Crop shadow of a window fully on a particular Xinerama screen to the screen. +# xinerama-shadow-crop = false + + +################################# +# Fading # +################################# + + +# Fade windows in/out when opening/closing and when opacity changes, +# unless no-fading-openclose is used. +# fading = false +fading = false; + +# Opacity change between steps while fading in. (0.01 - 1.0, defaults to 0.028) +# fade-in-step = 0.028 +fade-in-step = 0.03; + +# Opacity change between steps while fading out. (0.01 - 1.0, defaults to 0.03) +# fade-out-step = 0.03 +fade-out-step = 0.03; + +# The time between steps in fade step, in milliseconds. (> 0, defaults to 10) +# fade-delta = 10 + +# Specify a list of conditions of windows that should not be faded. +# fade-exclude = [] + +# Do not fade on window open/close. +# no-fading-openclose = false + +# Do not fade destroyed ARGB windows with WM frame. Workaround of bugs in Openbox, Fluxbox, etc. +# no-fading-destroyed-argb = false + + +################################# +# Transparency / Opacity # +################################# + + +# Opacity of inactive windows. (0.1 - 1.0, defaults to 1.0) +# inactive-opacity = 1 +#inactive-opacity = 0.8; + +# Opacity of window titlebars and borders. (0.1 - 1.0, disabled by default) +# frame-opacity = 1.0 +#frame-opacity = 1.0; + +# Let inactive opacity set by -i override the '_NET_WM_WINDOW_OPACITY' values of windows. +# inactive-opacity-override = true +inactive-opacity-override = false; + +# Default opacity for active windows. (0.0 - 1.0, defaults to 1.0) +# active-opacity = 1.0 + +# Dim inactive windows. (0.0 - 1.0, defaults to 0.0) +# inactive-dim = 0.0 + +# Specify a list of conditions of windows that should never be considered focused. +# focus-exclude = [] +focus-exclude = []; + +# Use fixed inactive dim value, instead of adjusting according to window opacity. +# inactive-dim-fixed = 1.0 + +# Specify a list of opacity rules, in the format `PERCENT:PATTERN`, +# like `50:name *= "Firefox"`. picom-trans is recommended over this. +# Note we don't make any guarantee about possible conflicts with other +# programs that set '_NET_WM_WINDOW_OPACITY' on frame or client windows. +# example: +# opacity-rule = [ "80:class_g = 'URxvt'" ]; +# +# opacity-rule = [] + + +################################# +# Corners # +################################# + +# Sets the radius of rounded window corners. When > 0, the compositor will +# round the corners of windows. Does not interact well with +# `transparent-clipping`. +# corner-radius = 20; + +# Exclude conditions for rounded corners. +rounded-corners-exclude = [ + "window_type = 'dock'", + "window_type = 'desktop'" +]; + + +################################# +# Background-Blurring # +################################# + + +# Parameters for background blurring, see the *BLUR* section for more information. +# blur-method = +# blur-size = 12 +# +# blur-deviation = false +# +blur-method = "dual_kawase" +blur-strength = 2 + +# Blur background of semi-transparent / ARGB windows. +# Bad in performance, with driver-dependent behavior. +# The name of the switch may change without prior notifications. +# +# blur-background = false + +# Blur background of windows when the window frame is not opaque. +# Implies: +# blur-background +# Bad in performance, with driver-dependent behavior. The name may change. +# +# blur-background-frame = false + + +# Use fixed blur strength rather than adjusting according to window opacity. +blur-background-fixed = true + + +# Specify the blur convolution kernel, with the following format: +# example: +# blur-kern = "5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"; +# +# blur-kern = "" +blur-kern = "3x3box"; + + +# Exclude conditions for background blur. +# blur-background-exclude = [] +blur-background-exclude = [ + # "window_type = 'dock'", + # "window_type = 'desktop'", + # "_GTK_FRAME_EXTENTS@:c" +]; + +################################# +# General Settings # +################################# + +# Enable remote control via D-Bus. See the man page for more details. +# dbus = true + +# Daemonize process. Fork to background after initialization. Causes issues with certain (badly-written) drivers. +# daemon = false + +# Specify the backend to use: `xrender`, `glx`, or `xr_glx_hybrid`. +# `xrender` is the default one. +# +backend = "glx" +# backend = "xrender"; + +# Enable/disable VSync. +# vsync = false +vsync = true; + +# Enable remote control via D-Bus. See the *D-BUS API* section below for more details. +# dbus = false + +# Try to detect WM windows (a non-override-redirect window with no +# child that has 'WM_STATE') and mark them as active. +# +# mark-wmwin-focused = false +mark-wmwin-focused = true; + +# Mark override-redirect windows that doesn't have a child window with 'WM_STATE' focused. +# mark-ovredir-focused = false +mark-ovredir-focused = true; + +# Try to detect windows with rounded corners and don't consider them +# shaped windows. The accuracy is not very high, unfortunately. +# +# detect-rounded-corners = false +detect-rounded-corners = true; + +# Detect '_NET_WM_WINDOW_OPACITY' on client windows, useful for window managers +# not passing '_NET_WM_WINDOW_OPACITY' of client windows to frame windows. +# +# detect-client-opacity = false +detect-client-opacity = true; + +# Use EWMH '_NET_ACTIVE_WINDOW' to determine currently focused window, +# rather than listening to 'FocusIn'/'FocusOut' event. Might have more accuracy, +# provided that the WM supports it. +# +# use-ewmh-active-win = false + +# Unredirect all windows if a full-screen opaque window is detected, +# to maximize performance for full-screen windows. Known to cause flickering +# when redirecting/unredirecting windows. +# +# unredir-if-possible = false + +# Delay before unredirecting the window, in milliseconds. Defaults to 0. +# unredir-if-possible-delay = 0 + +# Conditions of windows that shouldn't be considered full-screen for unredirecting screen. +# unredir-if-possible-exclude = [] + +# Use 'WM_TRANSIENT_FOR' to group windows, and consider windows +# in the same group focused at the same time. +# +# detect-transient = false +detect-transient = true; + +# Use 'WM_CLIENT_LEADER' to group windows, and consider windows in the same +# group focused at the same time. This usually means windows from the same application +# will be considered focused or unfocused at the same time. +# 'WM_TRANSIENT_FOR' has higher priority if detect-transient is enabled, too. +# +# detect-client-leader = false + +# Resize damaged region by a specific number of pixels. +# A positive value enlarges it while a negative one shrinks it. +# If the value is positive, those additional pixels will not be actually painted +# to screen, only used in blur calculation, and such. (Due to technical limitations, +# with use-damage, those pixels will still be incorrectly painted to screen.) +# Primarily used to fix the line corruption issues of blur, +# in which case you should use the blur radius value here +# (e.g. with a 3x3 kernel, you should use `--resize-damage 1`, +# with a 5x5 one you use `--resize-damage 2`, and so on). +# May or may not work with *--glx-no-stencil*. Shrinking doesn't function correctly. +# +# resize-damage = 1 + +# Specify a list of conditions of windows that should be painted with inverted color. +# Resource-hogging, and is not well tested. +# +# invert-color-include = [] + +# GLX backend: Avoid using stencil buffer, useful if you don't have a stencil buffer. +# Might cause incorrect opacity when rendering transparent content (but never +# practically happened) and may not work with blur-background. +# My tests show a 15% performance boost. Recommended. +# +# glx-no-stencil = false + +# GLX backend: Avoid rebinding pixmap on window damage. +# Probably could improve performance on rapid window content changes, +# but is known to break things on some drivers (LLVMpipe, xf86-video-intel, etc.). +# Recommended if it works. +# +# glx-no-rebind-pixmap = false + +# Disable the use of damage information. +# This cause the whole screen to be redrawn everytime, instead of the part of the screen +# has actually changed. Potentially degrades the performance, but might fix some artifacts. +# The opposing option is use-damage +# +# no-use-damage = false +use-damage = true; + +# Use X Sync fence to sync clients' draw calls, to make sure all draw +# calls are finished before picom starts drawing. Needed on nvidia-drivers +# with GLX backend for some users. +# +# xrender-sync-fence = false + +# GLX backend: Use specified GLSL fragment shader for rendering window contents. +# See `compton-default-fshader-win.glsl` and `compton-fake-transparency-fshader-win.glsl` +# in the source tree for examples. +# +# glx-fshader-win = "" + +# Force all windows to be painted with blending. Useful if you +# have a glx-fshader-win that could turn opaque pixels transparent. +# +# force-win-blend = false + +# Do not use EWMH to detect fullscreen windows. +# Reverts to checking if a window is fullscreen based only on its size and coordinates. +# +# no-ewmh-fullscreen = false + +# Dimming bright windows so their brightness doesn't exceed this set value. +# Brightness of a window is estimated by averaging all pixels in the window, +# so this could comes with a performance hit. +# Setting this to 1.0 disables this behaviour. Requires --use-damage to be disabled. (default: 1.0) +# +# max-brightness = 1.0 + +# Make transparent windows clip other windows like non-transparent windows do, +# instead of blending on top of them. +# +# transparent-clipping = false + +# Set the log level. Possible values are: +# "trace", "debug", "info", "warn", "error" +# in increasing level of importance. Case doesn't matter. +# If using the "TRACE" log level, it's better to log into a file +# using *--log-file*, since it can generate a huge stream of logs. +# +# log-level = "debug" +log-level = "warn"; + +# Set the log file. +# If *--log-file* is never specified, logs will be written to stderr. +# Otherwise, logs will to written to the given file, though some of the early +# logs might still be written to the stderr. +# When setting this option from the config file, it is recommended to use an absolute path. +# +# log-file = "/path/to/your/log/file" + +# Show all X errors (for debugging) +# show-all-xerrors = false + +# Write process ID to a file. +# write-pid-path = "/path/to/your/log/file" + +# Window type settings +# +# 'WINDOW_TYPE' is one of the 15 window types defined in EWMH standard: +# "unknown", "desktop", "dock", "toolbar", "menu", "utility", +# "splash", "dialog", "normal", "dropdown_menu", "popup_menu", +# "tooltip", "notification", "combo", and "dnd". +# +# Following per window-type options are available: :: +# +# fade, shadow::: +# Controls window-type-specific shadow and fade settings. +# +# opacity::: +# Controls default opacity of the window type. +# +# focus::: +# Controls whether the window of this type is to be always considered focused. +# (By default, all window types except "normal" and "dialog" has this on.) +# +# full-shadow::: +# Controls whether shadow is drawn under the parts of the window that you +# normally won't be able to see. Useful when the window has parts of it +# transparent, and you want shadows in those areas. +# +# clip-shadow-above::: +# Controls wether shadows that would have been drawn above the window should +# be clipped. Useful for dock windows that should have no shadow painted on top. +# +# redir-ignore::: +# Controls whether this type of windows should cause screen to become +# redirected again after been unredirected. If you have unredir-if-possible +# set, and doesn't want certain window to cause unnecessary screen redirection, +# you can set this to `true`. +# +wintypes: +{ + tooltip = { fade = true; shadow = true; opacity = 0.75; focus = true; full-shadow = false; }; + dock = { shadow = false; clip-shadow-above = true; } + dnd = { shadow = false; } + popup_menu = { opacity = 0.8; } + dropdown_menu = { opacity = 0.8; } +}; diff --git a/dot_config/polybar/colors/latte.ini b/dot_config/polybar/colors/latte.ini new file mode 100644 index 0000000..a22f8db --- /dev/null +++ b/dot_config/polybar/colors/latte.ini @@ -0,0 +1,28 @@ +[colors] +rosewater = #dc8a78 +flamingo = #dd7878 +pink = #ea76cb +mauve = #8839ef +red = #d20f39 +maroon = #e64553 +peach = #fe640b +yellow = #df8e1d +green = #40a02b +teal = #179299 +sky = #04a5e5 +sapphire = #209fb5 +blue = #1e66f5 +lavender = #7287fd +text = #4c4f69 +subtext1 = #5c5f77 +subtext0 = #6c6f85 +overlay2 = #7c7f93 +overlay1 = #8c8fa1 +overlay0 = #9ca0b0 +surface2 = #acb0be +surface1 = #bcc0cc +surface0 = #ccd0da +base = #eff1f5 +mantle = #e6e9ef +crust = #dce0e8 +crust_bg = #f2dce0e8 diff --git a/dot_config/polybar/colors/mocha.ini b/dot_config/polybar/colors/mocha.ini new file mode 100644 index 0000000..bc03876 --- /dev/null +++ b/dot_config/polybar/colors/mocha.ini @@ -0,0 +1,28 @@ +[colors] +rosewater = #f5e0dc +flamingo = #f2cdcd +pink = #f5c2e7 +mauve = #cba6f7 +red = #f38ba8 +maroon = #eba0ac +peach = #fab387 +yellow = #f9e2af +green = #a6e3a1 +teal = #94e2d5 +sky = #89dceb +sapphire = #74c7ec +blue = #89b4fa +lavender = #b4befe +text = #cdd6f4 +subtext0 = #bac2de +subtext1 = #a6adc8 +overlay0 = #9399b2 +overlay1 = #7f849c +overlay2 = #6c7086 +surface0 = #585b70 +surface1 = #45475a +surface2 = #313244 +base = #1e1e2e +mantle = #181825 +crust = #11111b +crust_bg = #f211111b diff --git a/dot_config/polybar/config.ini b/dot_config/polybar/config.ini new file mode 100644 index 0000000..5954aea --- /dev/null +++ b/dot_config/polybar/config.ini @@ -0,0 +1,162 @@ +;# vim:ft=dosini + +include-file = colors/mocha.ini + +[global/wm] +margin-top = 0 +margin-bottom = 0 + +[settings] +screenchange-reload = true + +[bar/main] +monitor = ${env:MONITOR:HDMI-0} + +height = 24pt +width = 100% +fixed-center = true + +background = ${colors.crust_bg} +foreground = ${colors.text} + +line-size = 1pt + +module-margin-left = 4pt +module-margin-right = 4pt + +font-0 = "Inter:style=Medium:size=14;4" +font-1 = "Victor Mono:style=SemiBold Italic:size=14;3" +; font for nerdfont icons +font-2 = "Symbols Nerd Font:style=1000-em:size=14;4" + +modules-left = i3 title +modules-center = nowplaying +modules-right = task mail volume battery vpn date time + +tray-position = none + +[module/i3] +type = internal/i3 +format = +index-sort = true +wrapping-scroll = false + +; Only show workspaces on the same output as the bar +pin-workspaces = true + +label-mode-foreground = ${colors.mauve} + +; focused = Active workspace on focused monitor +label-focused = %icon% +label-focused-foreground = ${colors.pink} +label-focused-padding = 8pt + +; unfocused = Inactive workspace on any monitor +label-unfocused = %icon% +label-unfocused-foreground = ${colors.mauve} +label-unfocused-padding = ${self.label-focused-padding} + +; visible = Active workspace on unfocused monitor +label-visible = %icon% +label-visible-foreground = ${colors.mauve} +label-visible-padding = ${self.label-focused-padding} + +; urgent = Workspace with urgency hint set +label-urgent = %icon% +label-urgent-foreground = ${colors.red} +label-urgent-padding = ${self.label-focused-padding} + +ws-icon-0=1; +ws-icon-1=2; +ws-icon-2=3; +ws-icon-3=4; +ws-icon-4=5; +ws-icon-5=6; +ws-icon-6=7; +ws-icon-7=8; +ws-icon-8=9; +ws-icon-9=10; +ws-icon-default= + +[module/title] +type = custom/script +exec = i3-window-title +tail = true + +[module/mail] +type = custom/script +exec = mailcount +interval = 10 +format-prefix = " " +format-foreground = ${colors.red} + +[module/task] +type = custom/script +exec = taskcount +interval = 10 +format-foreground = ${colors.red} + +[module/vpn] +type = custom/script +exec = mullvad-status +tail = true +format-foreground = ${colors.green} + +[module/date] +type = custom/script +interval = 60 + +# fall back to normie date if discordian date is not available +exec = (ddate +'%{%A, %b %d%}' || date +'%A, %b %d') +format-foreground = ${colors.blue} +label =  %output% + +[module/time] +type = internal/date + +time = "%H:%M" + +format-foreground = ${colors.mauve} +format-padding = 4pt + +label =  %time% + +[module/nowplaying] +type = custom/script +interval = 3 +exec = media-status +tail = true +format-foreground = ${colors.text} +click-left = playerctl play-pause +label-font = 2 + +[module/battery] +type = internal/battery + +label = Test +format-foreground = ${colors.yellow} +full-at = 99 + +; If an inotify event haven't been reported in this many +; seconds, manually poll for new values. +; Needed as a fallback for systems that don't report events +; on sysfs/procfs. +poll-interval = 10 + +[module/volume] +type = internal/pulseaudio +format-volume-foreground = ${colors.peach} +format-muted-foreground = ${colors.peach} + +use-ui-max = false + +; Interval for volume increase/decrease (in percent points) +interval = 5 + +label-muted = ﱝ 0% +ramp-volume-0 = 奄 +ramp-volume-1 = 奔 +ramp-volume-2 = 墳 + +format-volume = +click-right = pavucontrol diff --git a/dot_config/private_qutebrowser/config.py b/dot_config/private_qutebrowser/config.py new file mode 100644 index 0000000..952f590 --- /dev/null +++ b/dot_config/private_qutebrowser/config.py @@ -0,0 +1,111 @@ +import catppuccin + +config.load_autoconfig() +catppuccin.setup(c, "mocha") + +### general stuff +# macOS keybinds :kekw: +c.bindings.commands = { + "normal": { + "": "open -t", + "": "tab-close", + "": "reload", + "": "tab-focus 1", + "": "tab-focus 2", + "": "tab-focus 3", + "": "tab-focus 4", + "": "tab-focus 5", + "": "tab-focus 6", + "": "tab-focus 7", + "": "tab-focus 8", + "": "tab-focus 9", + "": "tab-focus 10", + "": "quit", + } +} +# search when typing in the address bar, and use DDG +c.url.auto_search = "naive" +c.url.searchengines = {"DEFAULT": "https://duckduckgo.com/?q={}"} + +### rice +# a teensy bit more padding... +c.statusbar.padding = {"bottom": 4, "left": 4, "right": 4, "top": 4} +c.tabs.padding = {"bottom": 4, "left": 4, "right": 4, "top": 4} +# don't show the tab indicator +c.tabs.indicator.width = 0 +## fonts +c.fonts.default_size = "14pt" +# default Comic Code +c.fonts.default_family = "Victor Mono" +# Inter for UI +c.fonts.tabs.selected = "default_size Inter var" +c.fonts.tabs.unselected = "default_size Inter var" +c.fonts.hints = "default_size Inter var" +# uppercase for hints, a la vimium +c.hints.uppercase = True + +### other stuff +# use brave blocker + hosts file +c.content.blocking.method = "both" + +# self explanatory +c.content.javascript.can_access_clipboard = True +c.content.pdfjs = True + +# flags +c.qt.args = [ + "--force-color-profile=srgb", +] + +# experimental Privacy-Redirect +from pprint import pprint +import re +from PyQt5.QtCore import QUrl +from qutebrowser.api import interceptor + +privacy_mappings = [ + { + "pattern": r'.*\.youtube.com', + "redirect": "https://iv.winston.sh", + } +] + +# compile the regexes +privacy_mappings_re = [re.compile(host["pattern"]) for host in privacy_mappings] + + +def redirect_to_proxies(info: interceptor.Request): + """keep me productive by redirecting certain hosts""" + global privacy_mappings + req_host = info.request_url.host() + print(info.request_url) + + if any(host.match(req_host) for host in privacy_mappings_re): + try: + print([host for host in privacy_mappings_re if host["pattern"].match(req_host)]) + # info.redirect(new_url) + except: + pass + return True + + +def redirect_80_to_443(info: interceptor.Request): + url = info.request_url + scheme = url.scheme() + req_host = url.host() + allowlist = [ + "localhost", + "127.0.0.1" + ] + + if scheme == "http" and req_host not in allowlist: + url.setScheme("https") + try: + info.redirect(url) + except: + pass + return True + + +# interceptor.register(redirect_to_proxies) +interceptor.register(redirect_80_to_443) diff --git a/dot_config/ranger/commands.py b/dot_config/ranger/commands.py new file mode 100644 index 0000000..97b7909 --- /dev/null +++ b/dot_config/ranger/commands.py @@ -0,0 +1,62 @@ +# This is a sample commands.py. You can add your own commands here. +# +# Please refer to commands_full.py for all the default commands and a complete +# documentation. Do NOT add them all here, or you may end up with defunct +# commands when upgrading ranger. + +# A simple command for demonstration purposes follows. +# ----------------------------------------------------------------------------- + +from __future__ import (absolute_import, division, print_function) + +# You can import any python module as needed. +import os + +# You always need to import ranger.api.commands here to get the Command class: +from ranger.api.commands import Command + + +# Any class that is a subclass of "Command" will be integrated into ranger as a +# command. Try typing ":my_edit" in ranger! +class my_edit(Command): + # The so-called doc-string of the class will be visible in the built-in + # help that is accessible by typing "?c" inside ranger. + """:my_edit + + A sample command for demonstration purposes that opens a file in an editor. + """ + + # The execute method is called when you run this command in ranger. + def execute(self): + # self.arg(1) is the first (space-separated) argument to the function. + # This way you can write ":my_edit somefilename". + if self.arg(1): + # self.rest(1) contains self.arg(1) and everything that follows + target_filename = self.rest(1) + else: + # self.fm is a ranger.core.filemanager.FileManager object and gives + # you access to internals of ranger. + # self.fm.thisfile is a ranger.container.file.File object and is a + # reference to the currently selected file. + target_filename = self.fm.thisfile.path + + # This is a generic function to print text in ranger. + self.fm.notify("Let's edit the file " + target_filename + "!") + + # Using bad=True in fm.notify allows you to print error messages: + if not os.path.exists(target_filename): + self.fm.notify("The given file does not exist!", bad=True) + return + + # This executes a function from ranger.core.acitons, a module with a + # variety of subroutines that can help you construct commands. + # Check out the source, or run "pydoc ranger.core.actions" for a list. + self.fm.edit_file(target_filename) + + # The tab method is called when you press tab, and should return a list of + # suggestions that the user will tab through. + # tabnum is 1 for and -1 for by default + def tab(self, tabnum): + # This is a generic tab-completion function that iterates through the + # content of the current directory. + return self._tab_directory_content() diff --git a/dot_config/ranger/executable_commands_full.py b/dot_config/ranger/executable_commands_full.py new file mode 100644 index 0000000..5defa67 --- /dev/null +++ b/dot_config/ranger/executable_commands_full.py @@ -0,0 +1,1993 @@ +# -*- coding: utf-8 -*- +# This file is part of ranger, the console file manager. +# This configuration file is licensed under the same terms as ranger. +# =================================================================== +# +# NOTE: If you copied this file to /etc/ranger/commands_full.py or +# ~/.config/ranger/commands_full.py, then it will NOT be loaded by ranger, +# and only serve as a reference. +# +# =================================================================== +# This file contains ranger's commands. +# It's all in python; lines beginning with # are comments. +# +# Note that additional commands are automatically generated from the methods +# of the class ranger.core.actions.Actions. +# +# You can customize commands in the files /etc/ranger/commands.py (system-wide) +# and ~/.config/ranger/commands.py (per user). +# They have the same syntax as this file. In fact, you can just copy this +# file to ~/.config/ranger/commands_full.py with +# `ranger --copy-config=commands_full' and make your modifications, don't +# forget to rename it to commands.py. You can also use +# `ranger --copy-config=commands' to copy a short sample commands.py that +# has everything you need to get started. +# But make sure you update your configs when you update ranger. +# +# =================================================================== +# Every class defined here which is a subclass of `Command' will be used as a +# command in ranger. Several methods are defined to interface with ranger: +# execute(): called when the command is executed. +# cancel(): called when closing the console. +# tab(tabnum): called when is pressed. +# quick(): called after each keypress. +# +# tab() argument tabnum is 1 for and -1 for by default +# +# The return values for tab() can be either: +# None: There is no tab completion +# A string: Change the console to this string +# A list/tuple/generator: cycle through every item in it +# +# The return value for quick() can be: +# False: Nothing happens +# True: Execute the command afterwards +# +# The return value for execute() and cancel() doesn't matter. +# +# =================================================================== +# Commands have certain attributes and methods that facilitate parsing of +# the arguments: +# +# self.line: The whole line that was written in the console. +# self.args: A list of all (space-separated) arguments to the command. +# self.quantifier: If this command was mapped to the key "X" and +# the user pressed 6X, self.quantifier will be 6. +# self.arg(n): The n-th argument, or an empty string if it doesn't exist. +# self.rest(n): The n-th argument plus everything that followed. For example, +# if the command was "search foo bar a b c", rest(2) will be "bar a b c" +# self.start(n): Anything before the n-th argument. For example, if the +# command was "search foo bar a b c", start(2) will be "search foo" +# +# =================================================================== +# And this is a little reference for common ranger functions and objects: +# +# self.fm: A reference to the "fm" object which contains most information +# about ranger. +# self.fm.notify(string): Print the given string on the screen. +# self.fm.notify(string, bad=True): Print the given string in RED. +# self.fm.reload_cwd(): Reload the current working directory. +# self.fm.thisdir: The current working directory. (A File object.) +# self.fm.thisfile: The current file. (A File object too.) +# self.fm.thistab.get_selection(): A list of all selected files. +# self.fm.execute_console(string): Execute the string as a ranger command. +# self.fm.open_console(string): Open the console with the given string +# already typed in for you. +# self.fm.move(direction): Moves the cursor in the given direction, which +# can be something like down=3, up=5, right=1, left=1, to=6, ... +# +# File objects (for example self.fm.thisfile) have these useful attributes and +# methods: +# +# tfile.path: The path to the file. +# tfile.basename: The base name only. +# tfile.load_content(): Force a loading of the directories content (which +# obviously works with directories only) +# tfile.is_directory: True/False depending on whether it's a directory. +# +# For advanced commands it is unavoidable to dive a bit into the source code +# of ranger. +# =================================================================== + +from __future__ import (absolute_import, division, print_function) + +from collections import deque +import os +import re + +from ranger.api.commands import Command + + +class alias(Command): + """:alias + + Copies the oldcommand as newcommand. + """ + + context = 'browser' + resolve_macros = False + + def execute(self): + if not self.arg(1) or not self.arg(2): + self.fm.notify('Syntax: alias ', bad=True) + return + + self.fm.commands.alias(self.arg(1), self.rest(2)) + + +class echo(Command): + """:echo + + Display the text in the statusbar. + """ + + def execute(self): + self.fm.notify(self.rest(1)) + + +class cd(Command): + """:cd [-r] + + The cd command changes the directory. + If the path is a file, selects that file. + The command 'cd -' is equivalent to typing ``. + Using the option "-r" will get you to the real path. + """ + + def execute(self): + if self.arg(1) == '-r': + self.shift() + destination = os.path.realpath(self.rest(1)) + if os.path.isfile(destination): + self.fm.select_file(destination) + return + else: + destination = self.rest(1) + + if not destination: + destination = '~' + + if destination == '-': + self.fm.enter_bookmark('`') + else: + self.fm.cd(destination) + + def _tab_args(self): + # dest must be rest because path could contain spaces + if self.arg(1) == '-r': + start = self.start(2) + dest = self.rest(2) + else: + start = self.start(1) + dest = self.rest(1) + + if dest: + head, tail = os.path.split(os.path.expanduser(dest)) + if head: + dest_exp = os.path.join(os.path.normpath(head), tail) + else: + dest_exp = tail + else: + dest_exp = '' + return (start, dest_exp, os.path.join(self.fm.thisdir.path, dest_exp), + dest.endswith(os.path.sep)) + + @staticmethod + def _tab_paths(dest, dest_abs, ends_with_sep): + if not dest: + try: + return next(os.walk(dest_abs))[1], dest_abs + except (OSError, StopIteration): + return [], '' + + if ends_with_sep: + try: + return [os.path.join(dest, path) for path in next(os.walk(dest_abs))[1]], '' + except (OSError, StopIteration): + return [], '' + + return None, None + + def _tab_match(self, path_user, path_file): + if self.fm.settings.cd_tab_case == 'insensitive': + path_user = path_user.lower() + path_file = path_file.lower() + elif self.fm.settings.cd_tab_case == 'smart' and path_user.islower(): + path_file = path_file.lower() + return path_file.startswith(path_user) + + def _tab_normal(self, dest, dest_abs): + dest_dir = os.path.dirname(dest) + dest_base = os.path.basename(dest) + + try: + dirnames = next(os.walk(os.path.dirname(dest_abs)))[1] + except (OSError, StopIteration): + return [], '' + + return [os.path.join(dest_dir, d) for d in dirnames if self._tab_match(dest_base, d)], '' + + def _tab_fuzzy_match(self, basepath, tokens): + """ Find directories matching tokens recursively """ + if not tokens: + tokens = [''] + paths = [basepath] + while True: + token = tokens.pop() + matches = [] + for path in paths: + try: + directories = next(os.walk(path))[1] + except (OSError, StopIteration): + continue + matches += [os.path.join(path, d) for d in directories + if self._tab_match(token, d)] + if not tokens or not matches: + return matches + paths = matches + + return None + + def _tab_fuzzy(self, dest, dest_abs): + tokens = [] + basepath = dest_abs + while True: + basepath_old = basepath + basepath, token = os.path.split(basepath) + if basepath == basepath_old: + break + if os.path.isdir(basepath_old) and not token.startswith('.'): + basepath = basepath_old + break + tokens.append(token) + + paths = self._tab_fuzzy_match(basepath, tokens) + if not os.path.isabs(dest): + paths_rel = self.fm.thisdir.path + paths = [os.path.relpath(os.path.join(basepath, path), paths_rel) + for path in paths] + else: + paths_rel = '' + return paths, paths_rel + + def tab(self, tabnum): + from os.path import sep + + start, dest, dest_abs, ends_with_sep = self._tab_args() + + paths, paths_rel = self._tab_paths(dest, dest_abs, ends_with_sep) + if paths is None: + if self.fm.settings.cd_tab_fuzzy: + paths, paths_rel = self._tab_fuzzy(dest, dest_abs) + else: + paths, paths_rel = self._tab_normal(dest, dest_abs) + + paths.sort() + + if self.fm.settings.cd_bookmarks: + paths[0:0] = [ + os.path.relpath(v.path, paths_rel) if paths_rel else v.path + for v in self.fm.bookmarks.dct.values() for path in paths + if v.path.startswith(os.path.join(paths_rel, path) + sep) + ] + + if not paths: + return None + if len(paths) == 1: + return start + paths[0] + sep + return [start + dirname + sep for dirname in paths] + + +class chain(Command): + """:chain ; ; ... + + Calls multiple commands at once, separated by semicolons. + """ + resolve_macros = False + + def execute(self): + if not self.rest(1).strip(): + self.fm.notify('Syntax: chain ; ; ...', bad=True) + return + for command in [s.strip() for s in self.rest(1).split(";")]: + self.fm.execute_console(command) + + +class shell(Command): + escape_macros_for_shell = True + + def execute(self): + if self.arg(1) and self.arg(1)[0] == '-': + flags = self.arg(1)[1:] + command = self.rest(2) + else: + flags = '' + command = self.rest(1) + + if command: + self.fm.execute_command(command, flags=flags) + + def tab(self, tabnum): + from ranger.ext.get_executables import get_executables + if self.arg(1) and self.arg(1)[0] == '-': + command = self.rest(2) + else: + command = self.rest(1) + start = self.line[0:len(self.line) - len(command)] + + try: + position_of_last_space = command.rindex(" ") + except ValueError: + return (start + program + ' ' for program + in get_executables() if program.startswith(command)) + if position_of_last_space == len(command) - 1: + selection = self.fm.thistab.get_selection() + if len(selection) == 1: + return self.line + selection[0].shell_escaped_basename + ' ' + return self.line + '%s ' + + before_word, start_of_word = self.line.rsplit(' ', 1) + return (before_word + ' ' + file.shell_escaped_basename + for file in self.fm.thisdir.files or [] + if file.shell_escaped_basename.startswith(start_of_word)) + + +class open_with(Command): + + def execute(self): + app, flags, mode = self._get_app_flags_mode(self.rest(1)) + self.fm.execute_file( + files=[f for f in self.fm.thistab.get_selection()], + app=app, + flags=flags, + mode=mode) + + def tab(self, tabnum): + return self._tab_through_executables() + + def _get_app_flags_mode(self, string): # pylint: disable=too-many-branches,too-many-statements + """Extracts the application, flags and mode from a string. + + examples: + "mplayer f 1" => ("mplayer", "f", 1) + "atool 4" => ("atool", "", 4) + "p" => ("", "p", 0) + "" => None + """ + + app = '' + flags = '' + mode = 0 + split = string.split() + + if len(split) == 1: + part = split[0] + if self._is_app(part): + app = part + elif self._is_flags(part): + flags = part + elif self._is_mode(part): + mode = part + + elif len(split) == 2: + part0 = split[0] + part1 = split[1] + + if self._is_app(part0): + app = part0 + if self._is_flags(part1): + flags = part1 + elif self._is_mode(part1): + mode = part1 + elif self._is_flags(part0): + flags = part0 + if self._is_mode(part1): + mode = part1 + elif self._is_mode(part0): + mode = part0 + if self._is_flags(part1): + flags = part1 + + elif len(split) >= 3: + part0 = split[0] + part1 = split[1] + part2 = split[2] + + if self._is_app(part0): + app = part0 + if self._is_flags(part1): + flags = part1 + if self._is_mode(part2): + mode = part2 + elif self._is_mode(part1): + mode = part1 + if self._is_flags(part2): + flags = part2 + elif self._is_flags(part0): + flags = part0 + if self._is_mode(part1): + mode = part1 + elif self._is_mode(part0): + mode = part0 + if self._is_flags(part1): + flags = part1 + + return app, flags, int(mode) + + def _is_app(self, arg): + return not self._is_flags(arg) and not arg.isdigit() + + @staticmethod + def _is_flags(arg): + from ranger.core.runner import ALLOWED_FLAGS + return all(x in ALLOWED_FLAGS for x in arg) + + @staticmethod + def _is_mode(arg): + return all(x in '0123456789' for x in arg) + + +class set_(Command): + """:set