feat: zsh, kitty, git & lazygit, tmux
This commit is contained in:
commit
b7f66d74c5
42
.README.md
Normal file
42
.README.md
Normal file
@ -0,0 +1,42 @@
|
||||
# Bare Git Repository
|
||||
|
||||
- https://www.atlassian.com/git/tutorials/dotfiles
|
||||
- StreakyCobra
|
||||
|
||||
## Starting from scratch
|
||||
|
||||
```
|
||||
git init --bare $HOME/.dotfiles
|
||||
alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles --work-tree=$HOME'
|
||||
dotfiles config --local status.showUntrackedFiles no
|
||||
```
|
||||
|
||||
## Install onto a new system
|
||||
|
||||
```
|
||||
alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles --work-tree=$HOME'
|
||||
|
||||
echo ".dotfiles" >> .gitignore
|
||||
git clone --bare <git-repo-url> $HOME/.dotfiles
|
||||
dotfiles checkout
|
||||
dotfiles config --local status.showUntrackedFiles no
|
||||
```
|
||||
|
||||
The step above might fail with a message.
|
||||
This is because your $HOME folder might already have some stock configuration
|
||||
files which would be overwritten by Git.
|
||||
I provide you with a possible rough shortcut to move all the offending files
|
||||
automatically to a backup folder:
|
||||
|
||||
```
|
||||
mkdir -p .dotfiles-backup
|
||||
dotfiles checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | \
|
||||
xargs -I{} mv {} .dotfiles-backup/{}
|
||||
```
|
||||
|
||||
## Other Tools
|
||||
|
||||
```
|
||||
lazygit --git-dir=$HOME/.dotfiles --work-tree=$HOME
|
||||
```
|
||||
|
21
.config/kitty/Paul Millr.conf
Normal file
21
.config/kitty/Paul Millr.conf
Normal file
@ -0,0 +1,21 @@
|
||||
background #000000
|
||||
foreground #f1f1f1
|
||||
cursor #4c4c4c
|
||||
selection_background #414141
|
||||
color0 #2a2a2a
|
||||
color8 #666666
|
||||
color1 #ff0000
|
||||
color9 #ff007f
|
||||
color2 #78ff0e
|
||||
color10 #66ff66
|
||||
color3 #e6be00
|
||||
color11 #f3d64d
|
||||
color4 #396ad6
|
||||
color12 #7099ec
|
||||
color5 #b348bd
|
||||
color13 #da66e5
|
||||
color6 #66ccff
|
||||
color14 #79def1
|
||||
color7 #bababa
|
||||
color15 #ffffff
|
||||
selection_foreground #000000
|
BIN
.config/kitty/kitty-light.png
Normal file
BIN
.config/kitty/kitty-light.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 33 KiB |
198
.config/kitty/kitty.conf
Normal file
198
.config/kitty/kitty.conf
Normal file
@ -0,0 +1,198 @@
|
||||
#: Kitty Settings
|
||||
#
|
||||
# file:///usr/share/doc/kitty/html/conf.html
|
||||
#
|
||||
# Change icon:
|
||||
# sudo ln -sfT ~michel/.config/kitty/kitty-light.png /usr/share/icons/hicolor/256x256/apps/kitty.png
|
||||
|
||||
#: Fonts {{{1
|
||||
|
||||
# kitty +list-fonts
|
||||
# kitty --debug-font-fallback
|
||||
|
||||
# https://www.jetbrains.com/lp/mono/
|
||||
font_family JetBrains Mono Regular
|
||||
italic_font JetBrains Mono Italic
|
||||
bold_font JetBrains Mono Bold
|
||||
bold_italic_font JetBrains Mono Bold Italic
|
||||
|
||||
font_size 11.0
|
||||
disable_ligatures cursor
|
||||
|
||||
# Symbols Nerd Font
|
||||
#
|
||||
# https://www.nerdfonts.com/cheat-sheet
|
||||
# https://github.com/ryanoasis/nerd-fonts/tags -> NerdFontsSymbolsOnly.zip
|
||||
# -> Symbols-2048-em Nerd Font Complete.ttf (without Mono?)
|
||||
# https://raw.githubusercontent.com/ryanoasis/nerd-fonts/master/bin/scripts/test-fonts.sh
|
||||
|
||||
# "Nerd Fonts - Pomicons"
|
||||
symbol_map U+E000-U+E00D Symbols Nerd Font
|
||||
|
||||
# "Nerd Fonts - Powerline"
|
||||
symbol_map U+e0a0-U+e0a2,U+e0b0-U+e0b3 Symbols Nerd Font
|
||||
|
||||
# "Nerd Fonts - Powerline Extra"
|
||||
symbol_map U+e0a3-U+e0a3,U+e0b4-U+e0c8,U+e0cc-U+e0d2,U+e0d4-U+e0d4 Symbols Nerd Font
|
||||
|
||||
# "Nerd Fonts - Symbols original"
|
||||
symbol_map U+e5fa-U+e62b Symbols Nerd Font
|
||||
|
||||
# "Nerd Fonts - Devicons"
|
||||
symbol_map U+e700-U+e7c5 Symbols Nerd Font
|
||||
|
||||
# "Nerd Fonts - Font awesome"
|
||||
symbol_map U+f000-U+f2e0 Symbols Nerd Font
|
||||
|
||||
# "Nerd Fonts - Font awesome extension"
|
||||
symbol_map U+e200-U+e2a9 Symbols Nerd Font
|
||||
|
||||
# "Nerd Fonts - Octicons"
|
||||
symbol_map U+f400-U+f4a8,U+2665-U+2665,U+26A1-U+26A1,U+f27c-U+f27c Symbols Nerd Font
|
||||
|
||||
# "Nerd Fonts - Font Linux"
|
||||
symbol_map U+F300-U+F313 Symbols Nerd Font
|
||||
|
||||
# Nerd Fonts - Font Power Symbols"
|
||||
symbol_map U+23fb-U+23fe,U+2b58-U+2b58 Symbols Nerd Font
|
||||
|
||||
# "Nerd Fonts - Material Design Icons"
|
||||
symbol_map U+f500-U+fd46 Symbols Nerd Font
|
||||
|
||||
# "Nerd Fonts - Weather Icons"
|
||||
symbol_map U+e300-U+e3eb Symbols Nerd Font
|
||||
|
||||
# Misc Code Point Fixes
|
||||
symbol_map U+21B5,U+25B8,U+2605,U+2630,U+2632,U+2714,U+E0A3,U+E615,U+E62B Symbols Nerd Font
|
||||
|
||||
|
||||
#: Cursor customization {{{1
|
||||
|
||||
|
||||
#: Scrollback {{{1
|
||||
|
||||
scrollback_lines 10000
|
||||
|
||||
|
||||
#: Mouse {{{1
|
||||
|
||||
|
||||
#: Performance tuning {{{1
|
||||
|
||||
|
||||
#: Terminal bell {{{1
|
||||
|
||||
enable_audio_bell no
|
||||
visual_bell_duration 0.05
|
||||
visual_bell_color #900
|
||||
|
||||
|
||||
#: Window layout {{{1
|
||||
|
||||
enabled_layouts splits, grid, tall:bias=70;full_size=2, stack
|
||||
|
||||
|
||||
#: Tab bar {{{1
|
||||
|
||||
tab_bar_style fade
|
||||
tab_fade 0.80 0.85 0.90 0.95
|
||||
active_tab_foreground #000
|
||||
active_tab_background #FAA
|
||||
active_tab_font_style bold
|
||||
inactive_tab_background #644
|
||||
inactive_tab_foreground #799
|
||||
inactive_tab_font_style italic
|
||||
|
||||
#: Color scheme {{{1
|
||||
|
||||
include Paul Millr.conf
|
||||
background_opacity 0.90
|
||||
cursor #f41
|
||||
selection_background none
|
||||
selection_foreground none
|
||||
|
||||
dynamic_background_opacity yes
|
||||
# Also use `kitty @ set-background-opacity [options] OPACITY`
|
||||
|
||||
|
||||
#: Advanced {{{1
|
||||
|
||||
|
||||
#: OS specific tweaks {{{1
|
||||
|
||||
#: }}}1
|
||||
|
||||
|
||||
#: Keyboard shortcuts
|
||||
#
|
||||
# file:///usr/share/doc/kitty/html/actions.html
|
||||
# file:///usr/share/doc/kitty/html/conf.html#keyboard-shortcuts
|
||||
# file:///usr/share/doc/kitty/html/launch.html
|
||||
|
||||
kitten_alias hints hints --alphabet="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" --hints-offset=0
|
||||
|
||||
# Clipboard {{{1
|
||||
|
||||
#: Scrolling {{{1
|
||||
|
||||
#: Window management {{{1
|
||||
|
||||
map kitty_mod+enter launch --location=split --cwd=current
|
||||
map kitty_mod+! detach_window new-tab
|
||||
map ctrl+alt+! detach_window ask
|
||||
|
||||
map alt+left neighboring_window left
|
||||
map alt+right neighboring_window right
|
||||
map alt+down neighboring_window down
|
||||
map alt+up neighboring_window up
|
||||
|
||||
map kitty_mod+l>h move_window left
|
||||
map kitty_mod+l>j move_window down
|
||||
map kitty_mod+l>k move_window up
|
||||
map kitty_mod+l>l move_window right
|
||||
|
||||
#: Tab management {{{1
|
||||
|
||||
map kitty_mod+; move_tab_forward
|
||||
map kitty_mod+t new_tab_with_cwd
|
||||
|
||||
#: Layout management {{{1
|
||||
|
||||
map kitty_mod+l>g toggle_layout grid
|
||||
map kitty_mod+l>s toggle_layout splits
|
||||
map kitty_mod+l>v toggle_layout tall
|
||||
map kitty_mod+l>z toggle_layout stack
|
||||
|
||||
# file:///usr/share/doc/kitty/html/layouts.html#the-splits-layout
|
||||
|
||||
map kitty_mod+l>shift+h layout_action move_to_screen_edge left
|
||||
map kitty_mod+l>shift+j layout_action move_to_screen_edge bottom
|
||||
map kitty_mod+l>shift+k layout_action move_to_screen_edge top
|
||||
map kitty_mod+l>shift+l layout_action move_to_screen_edge right
|
||||
|
||||
map kitty_mod+l>/ layout_action rotate
|
||||
|
||||
#: Font sizes {{{1
|
||||
|
||||
#map kitty_mod+backspace change_font_size all 0
|
||||
map kitty_mod+equal change_font_size current +0.5
|
||||
map kitty_mod+minus change_font_size current -0.5
|
||||
|
||||
#: Select and act on visible text {{{1
|
||||
|
||||
# file:///usr/share/doc/kitty/html/marks.html
|
||||
# map ctrl+p scroll_to_mark prev
|
||||
# map ctrl+n scroll_to_mark next
|
||||
map kitty_mod+m>m create_marker
|
||||
map kitty_mod+m>shift+m remove_marker
|
||||
map kitty_mod+m>e toggle_marker iregex 1 \\bERROR\\b 2 \\bWARNING\\b 3 \\bNOTE\\b
|
||||
map kitty_mod+m>u toggle_marker regex 3 https?://\\S+
|
||||
mark1_background #d00
|
||||
mark2_background #c90
|
||||
mark3_background #0d0
|
||||
|
||||
#: Miscellaneous {{{1
|
||||
|
||||
#: }}}1
|
||||
|
||||
#: vim:foldmethod=marker:foldlevel=0
|
50
.config/lazygit/config.yml
Normal file
50
.config/lazygit/config.yml
Normal file
@ -0,0 +1,50 @@
|
||||
# https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md
|
||||
#
|
||||
# https://dandavison.github.io/delta/
|
||||
# https://github.com/dandavison/delta/releases
|
||||
|
||||
customCommands:
|
||||
|
||||
# files
|
||||
- key: "z"
|
||||
command: "cz commit"
|
||||
description: "commit with commitizen"
|
||||
context: "files"
|
||||
loadingText: "opening commitizen commit tool"
|
||||
subprocess: true
|
||||
|
||||
# remotes
|
||||
- key: "<c-p>"
|
||||
command: "git remote prune {{.SelectedRemote.Name}}"
|
||||
context: "remotes"
|
||||
loadingText: "Pruning..."
|
||||
description: "prune deleted remote branches"
|
||||
|
||||
git:
|
||||
autoFetch: true
|
||||
autoRefresh: true
|
||||
log:
|
||||
showWholeGraph: true
|
||||
paging:
|
||||
colorArg: always
|
||||
pager: delta --features="lazygit my-style"
|
||||
|
||||
gui:
|
||||
authorColors:
|
||||
"Michel D'HOOGE": '#5ae615'
|
||||
branchColors:
|
||||
'main': '#1cdddd'
|
||||
scrollHeight: 10
|
||||
scrollPastBottom: false
|
||||
showBottomLine: false
|
||||
showIcons: true
|
||||
sidePanelWidth: .25
|
||||
timeFormat: '02 Jan 15:04'
|
||||
|
||||
notARepository: 'skip'
|
||||
|
||||
refresher:
|
||||
refreshInterval: 10
|
||||
fetchInterval: 3600
|
||||
|
||||
# vi:nospell
|
65
.gitconfig
Normal file
65
.gitconfig
Normal file
@ -0,0 +1,65 @@
|
||||
[alias]
|
||||
co = checkout
|
||||
br = branch
|
||||
st = status
|
||||
tree = log --oneline --graph --decorate --all
|
||||
|
||||
[core]
|
||||
pager = delta
|
||||
|
||||
[delta]
|
||||
features = "my-style"
|
||||
|
||||
[delta "kitty"]
|
||||
navigate = true
|
||||
side-by-side = true
|
||||
line-numbers-minus-style = "black #aa0000"
|
||||
line-numbers-plus-style = "black #00aa00"
|
||||
|
||||
[delta "lazygit"]
|
||||
paging = never
|
||||
|
||||
[delta "my-style"]
|
||||
dark = true
|
||||
line-numbers = true
|
||||
line-numbers-minus-style = red
|
||||
line-numbers-plus-style = green
|
||||
minus-style = "syntax #440000"
|
||||
plus-emph-style = "syntax #007700"
|
||||
plus-style = "syntax #004400"
|
||||
syntax-theme = Coldark-Dark
|
||||
|
||||
[diff]
|
||||
colorMoved = default
|
||||
|
||||
[gui]
|
||||
spellingdictionary = en
|
||||
fontdiff = -family Hack -size 10 -weight normal -slant roman -underline 0 -overstrike 0
|
||||
|
||||
[guitool "Add to .gitignore"]
|
||||
cmd = echo \"$FILENAME\" >> .gitignore & git add .gitignore
|
||||
needsfile = yes
|
||||
noconsole = yes
|
||||
|
||||
[guitool "clang-format"]
|
||||
cmd = clang-format -style=file -i $FILENAME
|
||||
needsfile = yes
|
||||
noconsole = yes
|
||||
|
||||
[guitool "gvim"]
|
||||
cmd = gvim $FILENAME
|
||||
needsfile = yes
|
||||
noconsole = yes
|
||||
|
||||
[init]
|
||||
defaultBranch = main
|
||||
|
||||
[interactive]
|
||||
diffFilter = delta --color-only
|
||||
|
||||
[merge]
|
||||
conflictstyle = diff3
|
||||
|
||||
[pull]
|
||||
ff = only
|
||||
|
150
.tmux.conf
Normal file
150
.tmux.conf
Normal file
@ -0,0 +1,150 @@
|
||||
# => Use C-b R to reload that file
|
||||
#
|
||||
# To override what a plugin does, set config after the call to TPM
|
||||
|
||||
|
||||
#***
|
||||
#** Plugins
|
||||
#*
|
||||
# https://github.com/tmux-plugins/list
|
||||
#
|
||||
|
||||
# TODO
|
||||
# https://github.com/erikw/tmux-powerline/issues/189
|
||||
|
||||
## Copy
|
||||
# - easymotion (normale mode: C-b S / copy mode: s / S S / S j / S k / S n),
|
||||
# - path, filenames, URLs: C-b Q
|
||||
# - URLs in browser: C-b P
|
||||
# - Lines: C-b W
|
||||
set -g @plugin 'CrispyConductor/tmux-copy-toolkit'
|
||||
set -g @copytk-label-chars "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
set -g @copytk-color-labelchar "black:cyan"
|
||||
set -g @copytk-color-highlight "cyan:blue"
|
||||
|
||||
## Sensible Defaults
|
||||
#
|
||||
set -g @plugin 'tmux-plugins/tmux-sensible'
|
||||
|
||||
|
||||
#***
|
||||
#** TPM
|
||||
#*
|
||||
#
|
||||
set -g @plugin 'tmux-plugins/tpm'
|
||||
if "test ! -d ~/.tmux/plugins/tpm" \
|
||||
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
|
||||
run '~/.tmux/plugins/tpm/tpm'
|
||||
|
||||
|
||||
#***
|
||||
#** Options
|
||||
#*
|
||||
#
|
||||
set-option -g mode-keys vi
|
||||
set-option -g mouse on
|
||||
set-option -g repeat-time 800
|
||||
set-option -g status-keys vi
|
||||
|
||||
|
||||
#***
|
||||
#** Root Keys
|
||||
#*
|
||||
#
|
||||
|
||||
# Start copy mode with Shift-PageUp
|
||||
bind-key -T root S-PPage { copy-mode -e; send-keys PPage }
|
||||
|
||||
|
||||
#***
|
||||
#** Prefix Keys
|
||||
#*
|
||||
|
||||
# Re-usable keys:
|
||||
# 'it
|
||||
# $&().
|
||||
|
||||
bind-key ? list-keys -T prefix
|
||||
bind-key M-k { send-keys -R; clear-history } # Clear current pane
|
||||
bind-key M-m command-prompt -p "man page:" { split-window -fh man '%%' }
|
||||
bind-key M-M split-window -fh man tmux
|
||||
|
||||
|
||||
###
|
||||
## Buffers
|
||||
#
|
||||
# - Delete the most recently copied buffer of text.
|
||||
# = Choose which buffer to paste interactively from a list.
|
||||
|
||||
|
||||
###
|
||||
## Panes
|
||||
#
|
||||
# ; Move to the previously active pane [last-pane]
|
||||
# m Mark the current pane [select-pane -m]
|
||||
# M Clear the marked pane [select-pane -M]
|
||||
# o Select the next pane in the current window [select-pane -t :.+]
|
||||
# q Briefly display pane indexes [display-panes]
|
||||
|
||||
bind-key -r C-h select-pane -L
|
||||
bind-key -r C-Left select-pane -L
|
||||
bind-key -r C-j select-pane -D
|
||||
bind-key -r C-Down select-pane -D
|
||||
bind-key -r C-k select-pane -U
|
||||
bind-key -r C-Up select-pane -U
|
||||
bind-key -r C-l select-pane -R
|
||||
bind-key -r C-Right select-pane -R
|
||||
|
||||
bind-key -r H resize-pane -L 5
|
||||
bind-key -r Left resize-pane -L
|
||||
bind-key -r J resize-pane -D 5
|
||||
bind-key -r Down resize-pane -D
|
||||
bind-key -r K resize-pane -U 5
|
||||
bind-key -r Up resize-pane -U
|
||||
bind-key -r L resize-pane -R 5
|
||||
bind-key -r Right resize-pane -R
|
||||
|
||||
bind-key \\ split-window -fh -c "#{pane_current_path}"
|
||||
bind-key _ split-window -fv -c "#{pane_current_path}"
|
||||
bind-key '%' split-window -h -c "#{pane_current_path}"
|
||||
bind-key '"' split-window -v -c "#{pane_current_path}"
|
||||
|
||||
#bind-key j command-prompt -p "join pane from:" "join-pane -h -s '%%'"
|
||||
#bind-key s command-prompt -p "send pane to:" "join-pane -h -t '%%'"
|
||||
#bind-key j "join-pane -s !" will join the last active pane/window to the current window.
|
||||
|
||||
|
||||
###
|
||||
## Windows
|
||||
#
|
||||
# , Rename the current window.
|
||||
# . Prompt for an index to move the current window.
|
||||
# l Move to the previously selected window.
|
||||
|
||||
|
||||
###
|
||||
## Layouts: default shortcuts adapted to Azerty keyboards
|
||||
#
|
||||
bind-key -N "M-1" "M-&" select-layout even-horizontal
|
||||
bind-key -N "M-3" 'M-"' select-layout main-horizontal
|
||||
bind-key -N "M-4" "M-'" select-layout main-vertical
|
||||
bind-key -N "M-5" "M-(" select-layout tiled
|
||||
|
||||
|
||||
###
|
||||
## Sessions
|
||||
#
|
||||
# D Choose a client to detach.
|
||||
# L Switch the attached client back to the last session.
|
||||
# r Force redraw of the attached client.
|
||||
# f Prompt to search for text in open windows.
|
||||
|
||||
|
||||
#***
|
||||
#** Copy-mode Keys
|
||||
#*
|
||||
|
||||
# TODO Better Buffers select
|
||||
bind-key -T copy-mode-vi Space send-keys -X page-down
|
||||
bind-key -T copy-mode-vi v send-keys -X begin-selection
|
||||
bind-key -T copy-mode-vi S-NPage send-keys -X page-down
|
68
.zimrc
Normal file
68
.zimrc
Normal file
@ -0,0 +1,68 @@
|
||||
###
|
||||
### Zim Modules
|
||||
###
|
||||
|
||||
### Behaviour
|
||||
|
||||
# Additional completion definitions for Zsh.
|
||||
zmodule zsh-users/zsh-completions
|
||||
|
||||
# Enables and configures smart and extensive tab completion.
|
||||
# completion must be sourced after zsh-users/zsh-completions
|
||||
zmodule completion
|
||||
|
||||
# Figures out where to get the best help, and gets it.
|
||||
zmodule run-help
|
||||
|
||||
|
||||
### Productivity
|
||||
|
||||
# Utility aliases and functions. Adds colour to ls, grep and less.
|
||||
zmodule utility
|
||||
|
||||
# Sets up asdf, with auto install and optimized usage of the direnv plugin
|
||||
# https://github.com/zimfw/asdf
|
||||
#
|
||||
# Run `zimfw clean-dumpfile; compinit` to force loading the completion
|
||||
zmodule asdf
|
||||
|
||||
# ls directories first (applies to all aliases below)
|
||||
# ll with long format and git status (applies to all aliases below)
|
||||
# l all files
|
||||
# lr recursively as a tree
|
||||
# lx sorted by extension
|
||||
# lk sorted by largest file size last
|
||||
# lt sorted by newest modification time last
|
||||
# lc sorted by newest status change (ctime) last
|
||||
zmodule exa
|
||||
|
||||
# fzf
|
||||
# → Using a modified version (in .zshrc)
|
||||
|
||||
|
||||
###
|
||||
### Other Modules
|
||||
###
|
||||
|
||||
# Enhanced CD
|
||||
# Requires: fzf, fzy, ...
|
||||
zmodule b4b4r07/enhancd
|
||||
|
||||
|
||||
###
|
||||
### Prompt & Command Line Helpers
|
||||
###
|
||||
|
||||
# ZVM — Zsh Vi Mode
|
||||
zmodule jeffreytse/zsh-vi-mode
|
||||
|
||||
# Fast Syntax Highlighting
|
||||
#
|
||||
# `fast-theme --list` to list available themes -> "free"
|
||||
zmodule zdharma-continuum/fast-syntax-highlighting
|
||||
|
||||
# A heavily reduced, ASCII-only version of the Spaceship and Starship prompts.
|
||||
zmodule asciiship
|
||||
|
||||
# Exposes git status information (used by asciiship)
|
||||
zmodule git-info
|
2
.zprofile
Normal file
2
.zprofile
Normal file
@ -0,0 +1,2 @@
|
||||
export NC_STORAGE="$HOME/NC-Michel/Linux/VDell"
|
||||
export ALT_HISTORY_FILE="$HOME/NC-Michel/Linux/michdell/history"
|
310
.zshrc
Normal file
310
.zshrc
Normal file
@ -0,0 +1,310 @@
|
||||
#!/bin/zsh
|
||||
|
||||
###
|
||||
### Zsh Configuration
|
||||
###
|
||||
|
||||
# Customize spelling correction prompt.
|
||||
SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? '
|
||||
|
||||
# Remove path separator from WORDCHARS.
|
||||
WORDCHARS=${WORDCHARS//[\/]}
|
||||
|
||||
|
||||
###
|
||||
### Modules
|
||||
###
|
||||
|
||||
### ASDF
|
||||
#
|
||||
# The direnv plugin is not up-to-date with new `asdf direnv setup` command.
|
||||
#
|
||||
source "${XDG_CONFIG_HOME:-$HOME/.config}/asdf-direnv/zshrc"
|
||||
|
||||
### b4b4r07/enhancd
|
||||
#
|
||||
# See https://github.com/b4b4r07/enhancd
|
||||
#
|
||||
ENHANCD_DIR=$HOME/.zim
|
||||
ENHANCD_DOT_ARG='.'
|
||||
|
||||
### fzf
|
||||
#
|
||||
# Adapted from https://github.com/zimfw/fzf
|
||||
#
|
||||
export FZF_DEFAULT_OPTS='--height 40% --layout=reverse'
|
||||
|
||||
if (( ${+commands[fd]} )); then
|
||||
export FZF_DEFAULT_COMMAND='command fd --color=always --hidden --no-ignore-vcs --exclude=.git --type=file --strip-cwd-prefix'
|
||||
export FZF_ALT_C_COMMAND='command fd --color=always --hidden --no-ignore-vcs --exclude=.git --type=directory --strip-cwd-prefix'
|
||||
|
||||
# Trigger for completion: "**"
|
||||
# Commands using _dir: FZF_COMPLETION_DIR_COMMANDS
|
||||
_fzf_compgen_path() {
|
||||
command fd --color=always --hidden --no-ignore-vcs --exclude=.git --type=file . "${1}"
|
||||
}
|
||||
_fzf_compgen_dir() {
|
||||
command fd --color=always --hidden --no-ignore-vcs --exclude=.git --type=directory . "${1}"
|
||||
}
|
||||
export FZF_DEFAULT_OPTS="--ansi ${FZF_DEFAULT_OPTS}"
|
||||
elif (( ${+commands[rg]} )); then
|
||||
export FZF_DEFAULT_COMMAND="command rg -uu -g '!.git' --files"
|
||||
_fzf_compgen_path() {
|
||||
command rg -uu -g '!.git' --files "${1}"
|
||||
}
|
||||
fi
|
||||
if (( ${+commands[bat]} )); then
|
||||
export FZF_CTRL_T_OPTS="\
|
||||
--preview='command bat --color=always --line-range :100 --style=plain {}'\
|
||||
--preview-window=border-left\
|
||||
${FZF_CTRL_T_OPTS}"
|
||||
fi
|
||||
|
||||
if (( ${+FZF_DEFAULT_COMMAND} )) export FZF_CTRL_T_COMMAND=${FZF_DEFAULT_COMMAND}
|
||||
|
||||
# fzf: Debian Specific
|
||||
#
|
||||
FZF_CTRL_R_OPTS="--no-sort --exact"
|
||||
|
||||
# Scripts sourced by zvm_after_init()
|
||||
#
|
||||
# - source /usr/share/doc/fzf/examples/key-bindings.zsh
|
||||
# https://github.com/junegunn/fzf#key-bindings-for-command-line
|
||||
#
|
||||
# - source /usr/share/doc/fzf/examples/completion.zsh
|
||||
# https://github.com/junegunn/fzf#fuzzy-completion-for-bash-and-zsh
|
||||
|
||||
# fzf: Alternate history (Ctrl-Win-R)
|
||||
#
|
||||
if [[ -f $ALT_HISTORY_FILE ]]; then
|
||||
fzf-alt-history-widget() {
|
||||
local selected num
|
||||
setopt localoptions noglobsubst noposixbuiltins pipefail no_aliases 2> /dev/null
|
||||
selected=( $(cat ${ALT_HISTORY_FILE} |
|
||||
FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} $FZF_DEFAULT_OPTS --tiebreak=index --bind=ctrl-r:toggle-sort,ctrl-z:ignore $FZF_CTRL_R_OPTS --query=${(qqq)LBUFFER} +m" $(__fzfcmd)) )
|
||||
local ret=$?
|
||||
BUFFER=$selected
|
||||
zle reset-prompt
|
||||
return $ret
|
||||
}
|
||||
zle -N fzf-alt-history-widget
|
||||
bindkey -M vicmd '^[[114;13u' fzf-alt-history-widget
|
||||
bindkey -M viins '^[[114;13u' fzf-alt-history-widget
|
||||
fi
|
||||
|
||||
### ZVM
|
||||
#
|
||||
# https://github.com/jeffreytse/zsh-vi-mode
|
||||
|
||||
# ZVM_INIT_MODE=sourcing
|
||||
ZVM_LINE_INIT_MODE=$ZVM_MODE_INSERT
|
||||
|
||||
# bindkey for other modules
|
||||
function zvm_after_init {
|
||||
# fzf
|
||||
source /usr/share/doc/fzf/examples/key-bindings.zsh
|
||||
source /usr/share/doc/fzf/examples/completion.zsh
|
||||
|
||||
# Automatic expansion of global aliases
|
||||
bindkey " " globalias
|
||||
bindkey "^ " magic-space # control-space to bypass completion
|
||||
bindkey -M isearch " " magic-space # normal space during searches
|
||||
}
|
||||
|
||||
|
||||
###
|
||||
### Zim Framework
|
||||
###
|
||||
|
||||
# Use degit instead of git as the default tool to install and update modules.
|
||||
zstyle ':zim:zmodule' use 'degit'
|
||||
|
||||
|
||||
ZIM_HOME=${ZDOTDIR:-${HOME}}/.zim
|
||||
if [[ ! -e ${ZIM_HOME}/zimfw.zsh ]]; then
|
||||
# Download zimfw script if missing.
|
||||
if (( ${+commands[curl]} )); then
|
||||
curl -fsSL --create-dirs -o ${ZIM_HOME}/zimfw.zsh https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh
|
||||
else
|
||||
mkdir -p ${ZIM_HOME} && wget -nv -O ${ZIM_HOME}/zimfw.zsh https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh
|
||||
fi
|
||||
fi
|
||||
if [[ ! ${ZIM_HOME}/init.zsh -nt ${ZDOTDIR:-${HOME}}/.zimrc ]]; then
|
||||
# Install missing modules, and update ${ZIM_HOME}/init.zsh if missing or outdated.
|
||||
source ${ZIM_HOME}/zimfw.zsh init -q
|
||||
fi
|
||||
source ${ZIM_HOME}/init.zsh
|
||||
|
||||
|
||||
###
|
||||
### Aliases
|
||||
###
|
||||
#
|
||||
# See https://www.thorsten-hans.com/5-types-of-zsh-aliases
|
||||
|
||||
alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles --work-tree=$HOME'
|
||||
alias hg="kitty +kitten hyperlinked_grep"
|
||||
alias ls='exa --icons --no-permissions --no-user'
|
||||
alias make='colormake-short'
|
||||
|
||||
# Debian Specific:
|
||||
# sudo dpkg-divert --divert /usr/bin/fd --rename /usr/bin/fdfind
|
||||
|
||||
alias cp='cp --interactive'
|
||||
alias mv='mv --interactive'
|
||||
alias rm='rm -I'
|
||||
|
||||
autoload -U zmv
|
||||
alias mmv='noglob zmv -W'
|
||||
|
||||
lg()
|
||||
{
|
||||
export LAZYGIT_NEW_DIR_FILE=~/.lazygit/newdir
|
||||
lazygit "$@"
|
||||
if [ -f $LAZYGIT_NEW_DIR_FILE ]; then
|
||||
cd "$(cat $LAZYGIT_NEW_DIR_FILE)"
|
||||
rm -f $LAZYGIT_NEW_DIR_FILE > /dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
###
|
||||
### Aliases -- Global & automatic expansion
|
||||
###
|
||||
|
||||
alias -g D='$(date +%Y-%m-%d_%H-%M-%S)'
|
||||
alias -g E='2> /dev/null'
|
||||
alias -g G='|& grep -i'
|
||||
alias -g H='| head'
|
||||
alias -g HL='--help |& less -r'
|
||||
alias -g L='| less'
|
||||
alias -g N='&> /dev/null'
|
||||
alias -g P='| peco'
|
||||
alias -g S='| sort'
|
||||
alias -g T='| tail'
|
||||
|
||||
# Expand aliases inline - see http://blog.patshead.com/2012/11/automatically-expaning-zsh-global-aliases---simplified.html
|
||||
globalias() {
|
||||
if [[ $LBUFFER =~ ' [A-Z0-9]+$' ]]; then
|
||||
zle _expand_alias
|
||||
# If you want the content of the alias to be also expanded:
|
||||
# zle expand-word
|
||||
# (otherwise, <BS><Tab> do the job...)
|
||||
fi
|
||||
zle self-insert
|
||||
}
|
||||
zle -N globalias
|
||||
|
||||
|
||||
###
|
||||
### Colors
|
||||
###
|
||||
|
||||
if [[ -r /etc/grc.zsh ]]; then
|
||||
# ! Incompatible with P10K Transient
|
||||
source /etc/grc.zsh
|
||||
|
||||
# I want the default behaviour for:
|
||||
unset -f journalctl
|
||||
unset -f ls
|
||||
fi
|
||||
|
||||
|
||||
###
|
||||
### Exports
|
||||
###
|
||||
|
||||
export BROWSER=firefox
|
||||
export EDITOR=vim
|
||||
|
||||
# -i Searches ignore case
|
||||
# -F Automatically exit if the entire file can be displayed
|
||||
# -R ANSI "color" escape sequences are output in "raw" form
|
||||
# -S Chop long lines
|
||||
# -X Disables sending the termcap initialization and deinitialization
|
||||
# -M Long prompt
|
||||
# -K Quit on ^C
|
||||
export LESS=-iFRS
|
||||
export SYSTEMD_LESS='iFRSXMK'
|
||||
|
||||
|
||||
###
|
||||
### History
|
||||
###
|
||||
|
||||
setopt hist_ignore_all_dups
|
||||
setopt hist_ignore_space
|
||||
setopt hist_no_functions
|
||||
setopt hist_reduce_blanks
|
||||
setopt hist_save_no_dups
|
||||
setopt hist_verify
|
||||
setopt inc_append_history
|
||||
|
||||
HISTFILE=${ZDOTDIR:-${HOME}}/.zhistory
|
||||
HISTSIZE=4000
|
||||
SAVEHIST=3000
|
||||
HISTORY_IGNORE="(?|??|???|cd [a-zA-Z]*|* --help|#*|builtin *|run-help *)"
|
||||
|
||||
|
||||
###
|
||||
### Key Binding
|
||||
###
|
||||
|
||||
# `bindkey | grep -v self-insert` to print existing bindings
|
||||
# `showkey -a` to print keys
|
||||
|
||||
# Undo (useful to cancel completion -- borrowed from emacs keymap)
|
||||
bindkey "^_" undo
|
||||
|
||||
|
||||
###
|
||||
### Zsh Options
|
||||
###
|
||||
|
||||
## Input/Output
|
||||
|
||||
setopt correct
|
||||
setopt interactive_comments
|
||||
|
||||
# Disallow `>` to overwrite existing files. Use `>|` or `>!` instead.
|
||||
setopt no_clobber
|
||||
|
||||
|
||||
## Job control
|
||||
|
||||
# Prevent background jobs being given a lower priority.
|
||||
setopt no_bg_nice
|
||||
|
||||
# Prevent status report of jobs on shell exit.
|
||||
setopt no_check_jobs
|
||||
|
||||
# Prevent SIGHUP to jobs on shell exit.
|
||||
setopt no_hup
|
||||
|
||||
|
||||
###
|
||||
### Path
|
||||
###
|
||||
|
||||
path=($path $HOME/.local/bin)
|
||||
path=($path $HOME/bin)
|
||||
path=($path $HOME/go/bin)
|
||||
|
||||
path=($path $HOME/dev_local/bin)
|
||||
#export LD_LIBRARY_PATH=$HOME/dev_local/lib
|
||||
|
||||
fpath=($fpath /usr/share/zsh/site-functions)
|
||||
|
||||
# Remove duplicates
|
||||
typeset -U path fpath
|
||||
|
||||
|
||||
###
|
||||
### Completion Late Definitions
|
||||
###
|
||||
|
||||
compdef colormake=make
|
||||
compdef colormake-short=make
|
||||
|
||||
# Hide "parameters" (i.e. environment variables) when looking for a "command"
|
||||
zstyle ':completion:*:-command-:*' tag-order '!parameters'
|
Loading…
x
Reference in New Issue
Block a user