Added so much stuff
This commit is contained in:
parent
1b17dc6cf3
commit
71f7586a61
100 changed files with 4404 additions and 33 deletions
home/adrielus/features/cli
6
home/adrielus/features/cli/bat.nix
Normal file
6
home/adrielus/features/cli/bat.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
programs.bat = {
|
||||
enable = true;
|
||||
config.theme = "base16";
|
||||
};
|
||||
}
|
27
home/adrielus/features/cli/default.nix
Normal file
27
home/adrielus/features/cli/default.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
{ pkgs, ... }: {
|
||||
imports = [ ./bat.nix ./git.nix ./ssh.nix ./fish.nix ./tmux ./starship.nix ];
|
||||
|
||||
# Enable bash
|
||||
programs.bash.enable = true;
|
||||
|
||||
# Enable direnv
|
||||
programs.direnv.enable = true;
|
||||
programs.direnv.nix-direnv.enable = true;
|
||||
|
||||
# Install clis
|
||||
home.packages = with pkgs; [
|
||||
tree # Print directory structure
|
||||
ranger # Terminal file explorer
|
||||
comma # Intstall and run programs by sticking a , before them
|
||||
bc # Calculator
|
||||
ncdu # TUI disk usage
|
||||
exa # Better ls
|
||||
ripgrep # Better grep
|
||||
fd # Better find
|
||||
httpie # Better curl
|
||||
mkpasswd # Hash passwords
|
||||
neofetch # Display system information
|
||||
unzip # For working with .zip files
|
||||
unrar # For extracting shit from rars
|
||||
];
|
||||
}
|
75
home/adrielus/features/cli/fish.nix
Normal file
75
home/adrielus/features/cli/fish.nix
Normal file
|
@ -0,0 +1,75 @@
|
|||
{ config, pkgs, ... }:
|
||||
let
|
||||
base16-fish = pkgs.fetchFromGitHub {
|
||||
owner = "tomyun";
|
||||
repo = "base16-fish";
|
||||
sha256 = "142fmqm324gy3qsv48vijm5k81v6mw85ym9mmhnvyv2q2ndg5rix";
|
||||
rev = "2f6dd973a9075dabccd26f1cded09508180bf5fe";
|
||||
};
|
||||
in
|
||||
{
|
||||
programs.fish = {
|
||||
enable = true;
|
||||
|
||||
shellAbbrs = {
|
||||
ls = "exa -la";
|
||||
cat = "bat";
|
||||
};
|
||||
|
||||
shellAliases = {
|
||||
# Print available battery
|
||||
battery = "acpi";
|
||||
|
||||
# Rebuild nixos
|
||||
rebuild = "sudo -u adrielus nixos-rebuild switch --flake ~/Projects/nixos-config/";
|
||||
};
|
||||
|
||||
plugins = with pkgs.fishPlugins; [
|
||||
# Jump to directories by typing "z <directory-name>"
|
||||
{
|
||||
name = "z";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "jethrokuan";
|
||||
repo = "z";
|
||||
rev = "85f863f20f24faf675827fb00f3a4e15c7838d76";
|
||||
sha256 = "1kaa0k9d535jnvy8vnyxd869jgs0ky6yg55ac1mxcxm8n0rh2mgq";
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
interactiveShellInit =
|
||||
# Start tmux if not already inside tmux
|
||||
''
|
||||
if status is-interactive
|
||||
and not set -q 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)
|
||||
set fish_vi_force_cursor
|
||||
'' +
|
||||
# Use vim-style keybinds
|
||||
''
|
||||
function fish_user_key_bindings
|
||||
# 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>
|
||||
end
|
||||
'' +
|
||||
# Starship hook
|
||||
''
|
||||
starship init fish | source
|
||||
'' +
|
||||
# Theming
|
||||
(builtins.readFile (config.scheme base16-fish))
|
||||
;
|
||||
};
|
||||
}
|
26
home/adrielus/features/cli/git.nix
Normal file
26
home/adrielus/features/cli/git.nix
Normal file
|
@ -0,0 +1,26 @@
|
|||
{ pkgs, ... }: {
|
||||
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;
|
||||
};
|
||||
};
|
||||
|
||||
home.packages = with pkgs; [
|
||||
# Two github clis
|
||||
gh
|
||||
hub
|
||||
];
|
||||
}
|
7
home/adrielus/features/cli/ssh.nix
Normal file
7
home/adrielus/features/cli/ssh.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{ ... }: {
|
||||
programs.ssh.enable = true;
|
||||
|
||||
# home.persistence = {
|
||||
# "/persist/home/adrielus".directories = [ ".ssh" ];
|
||||
# };
|
||||
}
|
5
home/adrielus/features/cli/starship.nix
Normal file
5
home/adrielus/features/cli/starship.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
};
|
||||
}
|
36
home/adrielus/features/cli/tmux/default.nix
Normal file
36
home/adrielus/features/cli/tmux/default.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
{ pkgs, config, ... }:
|
||||
let
|
||||
base16-tmux = 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 = ''
|
||||
source ${./tmux.conf}
|
||||
|
||||
# Theme
|
||||
${builtins.readFile (config.scheme base16-tmux)}
|
||||
'';
|
||||
};
|
||||
}
|
62
home/adrielus/features/cli/tmux/tmux.conf
Normal file
62
home/adrielus/features/cli/tmux/tmux.conf
Normal file
|
@ -0,0 +1,62 @@
|
|||
# {{{ Remap prefix to Control + 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
|
||||
set -sg escape-time 10
|
||||
# }}}
|
||||
# {{{ Visual stuff
|
||||
set -g default-terminal "screen-256color"
|
||||
set -ga terminal-overrides ",xterm-256color:Tc"
|
||||
# }}}
|
||||
# {{{ Split panes with \ and -
|
||||
bind \\ split-window -h
|
||||
bind - split-window -v
|
||||
unbind '"'
|
||||
unbind %
|
||||
# }}}
|
||||
# {{{ Zoom with C-z
|
||||
unbind C-z
|
||||
bind -n C-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
|
||||
# }}}
|
Loading…
Add table
Add a link
Reference in a new issue