Started working on guest@euporie
This commit is contained in:
parent
0503a81ee8
commit
230a739327
62 changed files with 188 additions and 135 deletions
8
home/features/cli/bat.nix
Normal file
8
home/features/cli/bat.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
# Enabling this produces an uglier theme for some reason.
|
||||
# options.stylix.targets.bat.enable =true;
|
||||
programs.bat = {
|
||||
enable = true;
|
||||
config.theme = "base16-256";
|
||||
};
|
||||
}
|
35
home/features/cli/default.nix
Normal file
35
home/features/cli/default.nix
Normal file
|
@ -0,0 +1,35 @@
|
|||
{ pkgs, ... }: {
|
||||
imports = [
|
||||
./exa.nix
|
||||
./bat.nix
|
||||
./ssh.nix
|
||||
./git.nix
|
||||
./starship.nix
|
||||
./direnv.nix
|
||||
./fish
|
||||
./tmux
|
||||
];
|
||||
|
||||
# Enable bash
|
||||
programs.bash.enable = true;
|
||||
|
||||
# Install clis
|
||||
home.packages = with pkgs; [
|
||||
ranger # Terminal file explorer
|
||||
comma # Intstall and run programs by sticking a , before them
|
||||
bc # Calculator
|
||||
ncdu # TUI disk usage
|
||||
du-dust # Similar to du and ncdu in purpose.
|
||||
ripgrep # Better grep
|
||||
fd # Better find
|
||||
sd # Better sed
|
||||
httpie # Better curl
|
||||
mkpasswd # Hash passwords
|
||||
neofetch # Display system information
|
||||
zip # Zipping files
|
||||
unzip # Unzipping files
|
||||
unrar # For extracting shit from rars
|
||||
tokei # Useless but fun line of code counter (sloc alternative)
|
||||
bottom # System monitor
|
||||
];
|
||||
}
|
11
home/features/cli/direnv.nix
Normal file
11
home/features/cli/direnv.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
programs.direnv.enable = true;
|
||||
programs.direnv.nix-direnv.enable = true;
|
||||
|
||||
home.sessionVariables = {
|
||||
# No more long command warnings
|
||||
DIRENV_WARN_TIMEOUT = "24h";
|
||||
# No more usesless logs
|
||||
DIRENV_LOG_FORMAT = "";
|
||||
};
|
||||
}
|
16
home/features/cli/exa.nix
Normal file
16
home/features/cli/exa.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
{ pkgs, ... }: {
|
||||
home.packages = [ pkgs.exa ];
|
||||
|
||||
# TODO: generalize alias creation to all shells
|
||||
programs.fish.shellAliases =
|
||||
let exa = "${pkgs.exa}/bin/exa";
|
||||
in
|
||||
rec {
|
||||
ls = "${exa} --icons --long";
|
||||
la = "${ls} --all";
|
||||
lt = "${ls} --tree"; # Similar to tree, but also has --long!
|
||||
|
||||
# I am used to using pkgs.tree, so this is nice to have!
|
||||
tree = "${exa} --icons --tree";
|
||||
};
|
||||
}
|
42
home/features/cli/fish/config.fish
Normal file
42
home/features/cli/fish/config.fish
Normal file
|
@ -0,0 +1,42 @@
|
|||
# {{{ Start tmux if not already inside tmux
|
||||
if status is-interactive
|
||||
and not set -q TMUX
|
||||
and not set -q NO_TMUX
|
||||
exec tmux attach -t Welcome || tmux || echo "Something went wrong trying to start tmux"
|
||||
end
|
||||
# }}}
|
||||
# {{{ Sets cursor based on vim mode
|
||||
set fish_cursor_default block # Set the normal and visual mode cursors to a block
|
||||
set fish_cursor_insert line # Set the insert mode cursor to a line
|
||||
set fish_cursor_replace_one underscore # Set the replace mode cursor to an underscore
|
||||
|
||||
# Force fish to skip some checks (I think?)
|
||||
# TODO: research why this is here
|
||||
set fish_vi_force_cursor
|
||||
# }}}
|
||||
# {{{ Disable greeting
|
||||
set fish_greeting
|
||||
# }}}
|
||||
# {{{ Keybinds
|
||||
function fish_user_key_bindings
|
||||
# {{{ Use vim-style keybinds
|
||||
# Use the vim keybinds
|
||||
fish_vi_key_bindings
|
||||
|
||||
bind -e -M insert -k f10 # unbinds f10
|
||||
bind -M insert -m default -k f10 'commandline -f repaint' # Exit insert mode with <f10>
|
||||
# }}}
|
||||
# {{{ C-x to clear screen
|
||||
bind -M default \cx "clear && commandline -f repaint"
|
||||
bind -M insert \cx "clear && commandline -f repaint"
|
||||
# }}}
|
||||
# {{{ C-enter to run command through less
|
||||
bind -M default \e\[13\;2u "commandline -a ' | less' && commandline -f execute"
|
||||
bind -M insert \e\[13\;2u "commandline -a ' | less' && commandline -f execute"
|
||||
# }}}
|
||||
# {{{ C-g to open neogit
|
||||
bind -M default \cg "nvim +Neogit"
|
||||
bind -M insert \cg "nvim +Neogit"
|
||||
# }}}
|
||||
end
|
||||
# }}}
|
33
home/features/cli/fish/default.nix
Normal file
33
home/features/cli/fish/default.nix
Normal file
|
@ -0,0 +1,33 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
programs.fish = {
|
||||
enable = true;
|
||||
|
||||
shellAbbrs = {
|
||||
battery = "acpi";
|
||||
};
|
||||
|
||||
shellAliases = {
|
||||
cat = "bat";
|
||||
df = "df -h";
|
||||
du = "du -h";
|
||||
duh = "du -hd 1"; # short for du here
|
||||
};
|
||||
|
||||
# with pkgs.fishPlugins;
|
||||
plugins = [
|
||||
# Jump to directories by typing "z <directory-name>"
|
||||
{
|
||||
name = "z";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "jethrokuan";
|
||||
repo = "z";
|
||||
rev = "85f863f20f24faf675827fb00f3a4e15c7838d76";
|
||||
sha256 = "1kaa0k9d535jnvy8vnyxd869jgs0ky6yg55ac1mxcxm8n0rh2mgq";
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
interactiveShellInit = builtins.readFile ./config.fish;
|
||||
};
|
||||
}
|
33
home/features/cli/git.nix
Normal file
33
home/features/cli/git.nix
Normal file
|
@ -0,0 +1,33 @@
|
|||
{ pkgs, config, ... }: {
|
||||
programs.git = {
|
||||
enable = true;
|
||||
package = pkgs.gitFull;
|
||||
|
||||
aliases.graph = "log --decorate --oneline --graph";
|
||||
|
||||
userName = "Matei Adriel";
|
||||
userEmail = "rafaeladriel11@gmail.com";
|
||||
|
||||
extraConfig = {
|
||||
github.user = "Mateiadrielrafael";
|
||||
hub.protocol = "ssh";
|
||||
core.editor = "nvim";
|
||||
rebase.autoStash = true;
|
||||
init.defaultBranch = "main";
|
||||
|
||||
# Sign commits using ssh
|
||||
gpg.format = "ssh";
|
||||
user.signingkey = "~/.ssh/id_ed25519.pub";
|
||||
|
||||
# Sign everything by default
|
||||
commit.gpgsign = true;
|
||||
tag.gpgsign = true;
|
||||
};
|
||||
};
|
||||
|
||||
# Github cli
|
||||
programs.gh = {
|
||||
enable = true;
|
||||
settings.git_protocol = "ssh";
|
||||
};
|
||||
}
|
7
home/features/cli/ssh.nix
Normal file
7
home/features/cli/ssh.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{ ... }: {
|
||||
programs.ssh.enable = true;
|
||||
|
||||
# home.persistence = {
|
||||
# "/persist/home/adrielus".directories = [ ".ssh" ];
|
||||
# };
|
||||
}
|
5
home/features/cli/starship.nix
Normal file
5
home/features/cli/starship.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
};
|
||||
}
|
38
home/features/cli/tmux/default.nix
Normal file
38
home/features/cli/tmux/default.nix
Normal file
|
@ -0,0 +1,38 @@
|
|||
{ pkgs, config, ... }:
|
||||
let base16-tmux = config.lib.stylix.colors {
|
||||
templateRepo = pkgs.fetchFromGitHub {
|
||||
owner = "tinted-theming";
|
||||
repo = "base16-tmux";
|
||||
sha256 = "1p6czpd9f0sbibdsph1hdw4ljp6zzjij2159bks16wbfbg3p1hhx";
|
||||
rev = "3312bb2cbb26db7eeb2d2235ae17d4ffaef5e59b";
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
|
||||
clock24 = true; # 24h clock format
|
||||
historyLimit = 10000; # increase amount of saved lines
|
||||
|
||||
plugins = with pkgs.tmuxPlugins; [
|
||||
sessionist # Nicer workflow for switching around between sessions
|
||||
resurrect # Save / restore tmux sessions
|
||||
{
|
||||
plugin = continuum; # Automatically restore tmux sessions
|
||||
extraConfig = ''
|
||||
set -g @continuum-restore 'on'
|
||||
set -g @continuum-boot 'on'
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
extraConfig = ''
|
||||
# Main config
|
||||
source ${./tmux.conf}
|
||||
|
||||
# Theme
|
||||
source ${base16-tmux}
|
||||
'';
|
||||
};
|
||||
}
|
66
home/features/cli/tmux/tmux.conf
Normal file
66
home/features/cli/tmux/tmux.conf
Normal file
|
@ -0,0 +1,66 @@
|
|||
# {{{ Remap prefix to C-a
|
||||
set -g prefix C-a
|
||||
unbind C-b
|
||||
bind C-a send-prefix
|
||||
# }}}
|
||||
# {{{ Hide status bar
|
||||
set -g status off
|
||||
# }}}
|
||||
# {{{ Don't rename windows automatically
|
||||
set-option -g allow-rename off
|
||||
# }}}
|
||||
# {{{ Fix slow esc key
|
||||
set -sg escape-time 10
|
||||
# }}}
|
||||
# {{{ Visual stuff
|
||||
# See https://gist.github.com/andersevenrud/015e61af2fd264371032763d4ed965b6
|
||||
set -g default-terminal "tmux-256color"
|
||||
set -ag terminal-overrides ",$TERM:RGB"
|
||||
# }}}
|
||||
# {{{ Split panes with "-" and "\"
|
||||
bind \\ split-window -h
|
||||
bind - split-window -v
|
||||
unbind '"'
|
||||
unbind %
|
||||
# }}}
|
||||
# {{{ Zoom with M-z
|
||||
bind -n M-z resize-pane -Z
|
||||
# }}}
|
||||
# {{{ Vim-mode
|
||||
set-window-option -g mode-keys vi
|
||||
# }}}
|
||||
# {{{ Vim like keybinds for leaving insert mode
|
||||
unbind [ # unbind the default way to copy text
|
||||
bind -T prefix j copy-mode # allow exiting insert mode with C-a j
|
||||
# }}}
|
||||
# {{{ Vim like keybinds for copying and pasting
|
||||
bind -T copy-mode-vi p paste-buffer
|
||||
bind -T copy-mode-vi V send-keys -X rectangle-toggle # Check if this works
|
||||
bind -T copy-mode-vi v send-keys -X begin-selection
|
||||
bind -T copy-mode-vi y send-keys -X copy-selection
|
||||
# }}}
|
||||
# {{{ Smart pane switching with awareness of Vim splits.
|
||||
# See: https://github.com/christoomey/vim-tmux-navigator
|
||||
# Also see: https://github.com/christoomey/vim-tmux-navigator/issues/264
|
||||
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
|
||||
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|\.?n?vim?x?(-wrapped)?)(diff)?$'"
|
||||
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
|
||||
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
|
||||
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
|
||||
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
|
||||
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
|
||||
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
|
||||
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
|
||||
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
|
||||
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
|
||||
|
||||
bind-key -T copy-mode-vi 'C-h' select-pane -L
|
||||
bind-key -T copy-mode-vi 'C-j' select-pane -D
|
||||
bind-key -T copy-mode-vi 'C-k' select-pane -U
|
||||
bind-key -T copy-mode-vi 'C-l' select-pane -R
|
||||
bind-key -T copy-mode-vi 'C-\' select-pane -l
|
||||
# }}}
|
||||
# {{{ Get titles to work
|
||||
set-option -g set-titles on
|
||||
set-option -g set-titles-string "#T"
|
||||
# }}}
|
Loading…
Add table
Add a link
Reference in a new issue