Initial config
This commit is contained in:
		
							parent
							
								
									f93511104e
								
							
						
					
					
						commit
						0d3545a90c
					
				
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					conf.d/fish_alias_work.fish
 | 
				
			||||||
							
								
								
									
										16
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								README.md
									
									
									
									
									
								
							@ -1,3 +1,15 @@
 | 
				
			|||||||
# dotfiles_fish
 | 
					# Fish shell configurations
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Fish shell configurations
 | 
					- Left prompt  
 | 
				
			||||||
 | 
					    - SSH session indicator  
 | 
				
			||||||
 | 
					    - Git repo indicator  
 | 
				
			||||||
 | 
					    - Root user indicator  
 | 
				
			||||||
 | 
					    - Error indicator  
 | 
				
			||||||
 | 
					- Right prompt: pwd, git repo name  
 | 
				
			||||||
 | 
					- Color scheme  
 | 
				
			||||||
 | 
					- Common aliases  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					To install this configuration, just clone this repo to the config dir(`~/.config/fish/`):
 | 
				
			||||||
 | 
					```bash  
 | 
				
			||||||
 | 
					git clone https://git.candifloss.cc/candifloss/dotfiles_fish.git ~/.config/fish
 | 
				
			||||||
 | 
					```  
 | 
				
			||||||
							
								
								
									
										14
									
								
								completions/tab.fish
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								completions/tab.fish
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,14 @@
 | 
				
			|||||||
 | 
					# `tab` autocompletions for fish
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					complete -c tab  -f -a '(tab --_autocomplete_tab)' 
 | 
				
			||||||
 | 
					# hack here with `-o w`, to get fish to insert a space after the `tab -w` completion
 | 
				
			||||||
 | 
					complete -c tab -n "__fish_use_subcommand" -o w -l close -d 'closes the tab with the given name' -x -a '(tab --_autocomplete_close_tab)'
 | 
				
			||||||
 | 
					complete -c tab -n "__fish_use_subcommand" -o z -l disconnect -d 'disconnects any active sessions for the given tab' -x -a '(tab --_autocomplete_close_tab)'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					complete -c tab -l completion -d 'prints raw autocomplete scripts' -x -a 'bash elvish fish powershell zsh'
 | 
				
			||||||
 | 
					complete -c tab -n "__fish_use_subcommand" -s k -l check -d 'checks the current workspace for errors and warnings'
 | 
				
			||||||
 | 
					complete -c tab -n "__fish_use_subcommand" -s l -l list -d 'lists the active tabs'
 | 
				
			||||||
 | 
					complete -c tab -n "__fish_use_subcommand" -s W -l shutdown -d 'terminates the tab daemon and all active pty sessions'
 | 
				
			||||||
 | 
					complete -c tab -n "__fish_use_subcommand" -s h -l help -d 'Prints help information'
 | 
				
			||||||
 | 
					complete -c tab -n "__fish_use_subcommand" -s V -l version -d 'Prints version information'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										6
									
								
								conf.d/fish_alias_common.fish
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								conf.d/fish_alias_common.fish
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					alias c="clear"
 | 
				
			||||||
 | 
					alias inst="sudo apt-get install -y"
 | 
				
			||||||
 | 
					alias systemctl="sudo systemctl"
 | 
				
			||||||
 | 
					alias ls="lsd"
 | 
				
			||||||
 | 
					alias bat="bat --paging=never -p"
 | 
				
			||||||
 | 
					alias updt="sudo apt-get update && sudo apt-get upgrade -y && sudo snap refresh && rustup update"
 | 
				
			||||||
							
								
								
									
										1
									
								
								conf.d/fish_greeting.fish
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								conf.d/fish_greeting.fish
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					set -U fish_greeting ""
 | 
				
			||||||
							
								
								
									
										41
									
								
								conf.d/fish_prompt.fish
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								conf.d/fish_prompt.fish
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,41 @@
 | 
				
			|||||||
 | 
					function fish_prompt
 | 
				
			||||||
 | 
						# Check the last command status and set the error color
 | 
				
			||||||
 | 
						if test $status -eq 0
 | 
				
			||||||
 | 
							set error_color "\033[38;2;0;255;180m"  # rgb(0, 255, 180) for success
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							set error_color "\033[38;2;255;53;94m"  # rgb(255, 53, 94) for error
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						# Get SSH session status
 | 
				
			||||||
 | 
						if test -n "$SSH_CONNECTION"
 | 
				
			||||||
 | 
							set ssh_color "\033[38;2;255;149;0m"  # rgb(255, 149, 0) for SSH
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							set ssh_color "\033[38;2;82;82;82m"   # rgb(82, 82, 82) for non-SSH
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						# Try to get the git branch, avoid error if not in a git repo
 | 
				
			||||||
 | 
						set git_color "\033[38;2;82;82;82m"  # Default git color when not in a git repo
 | 
				
			||||||
 | 
						if test -d .git
 | 
				
			||||||
 | 
							set git_branch (git rev-parse --abbrev-ref HEAD)
 | 
				
			||||||
 | 
							if test -n "$git_branch"
 | 
				
			||||||
 | 
								switch $git_branch
 | 
				
			||||||
 | 
									case 'main' 'master'
 | 
				
			||||||
 | 
										set git_color "\033[38;2;178;98;44m"  # rgb(178, 98, 44) for main/master
 | 
				
			||||||
 | 
									case 'dev'
 | 
				
			||||||
 | 
										set git_color "\033[38;2;54;159;150m"  # rgb(54, 159, 150) for dev
 | 
				
			||||||
 | 
									case '*'
 | 
				
			||||||
 | 
										set git_color "\033[38;2;255;255;255m"  # rgb(255, 255, 255) for other branches
 | 
				
			||||||
 | 
								end
 | 
				
			||||||
 | 
							end
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						# Set the user color
 | 
				
			||||||
 | 
						if test $USER = "root"
 | 
				
			||||||
 | 
							set user_color "\033[38;2;255;53;94m"  # rgb(255, 53, 94) for root
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							set user_color "\033[38;2;0;255;180m"  # rgb(0, 255, 180) for non-root users
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						# Print the custom prompt with the symbol and different colors
 | 
				
			||||||
 | 
						echo -n -e "$ssh_color❯$git_color❯$user_color❯$error_color❯\033[0m "
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
							
								
								
									
										37
									
								
								conf.d/fish_right_prompt.fish
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								conf.d/fish_right_prompt.fish
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,37 @@
 | 
				
			|||||||
 | 
					function fish_right_prompt
 | 
				
			||||||
 | 
					    # Check if we're in a Git repo
 | 
				
			||||||
 | 
					    set git_dir (git rev-parse --show-toplevel 2>/dev/null)
 | 
				
			||||||
 | 
					    if test -n "$git_dir"
 | 
				
			||||||
 | 
					    	# Escape 
 | 
				
			||||||
 | 
					    	set escaped_git_dir (string replace "/" "\\/" $git_dir)
 | 
				
			||||||
 | 
					    	
 | 
				
			||||||
 | 
					        # Get the repo name
 | 
				
			||||||
 | 
					        set repo_name (basename $git_dir)
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        # Relative path in git
 | 
				
			||||||
 | 
					        set relative_path (string replace -r "^$escaped_git_dir/" "" (pwd))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # RGB color codes
 | 
				
			||||||
 | 
					        set repo_color "\033[38;2;55;120;130m"  # RGB for repo name (dark cyan)
 | 
				
			||||||
 | 
					        set separator_color "\033[38;2;178;98;44m"  # RGB for separator (bronze)
 | 
				
			||||||
 | 
					        set path_color "\033[38;2;82;82;82m"  # RGB for path (gray)
 | 
				
			||||||
 | 
					        set reset_color "\033[0m"  # Reset color
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # Ensure the relative path starts with a single slash
 | 
				
			||||||
 | 
					        if not string match -r "^/" $relative_path
 | 
				
			||||||
 | 
					            set relative_path "/$relative_path"
 | 
				
			||||||
 | 
					        end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # Check if we're at the Git root or inside the repo
 | 
				
			||||||
 | 
					        if test "$relative_path" = ""
 | 
				
			||||||
 | 
					            # At the repo root
 | 
				
			||||||
 | 
					            printf "$repo_color$repo_name$reset_color"
 | 
				
			||||||
 | 
					        else
 | 
				
			||||||
 | 
					            # Inside the repo, print the repo name, separator, and path
 | 
				
			||||||
 | 
					            printf "$repo_color$repo_name$separator_color  $path_color$relative_path$reset_color"
 | 
				
			||||||
 | 
					        end
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					        # Not in a Git repo, use the default prompt_pwd function
 | 
				
			||||||
 | 
					        prompt_pwd
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
							
								
								
									
										3
									
								
								config.fish
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								config.fish
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,3 @@
 | 
				
			|||||||
 | 
					if status is-interactive
 | 
				
			||||||
 | 
					    # Commands to run in interactive sessions can go here
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
							
								
								
									
										42
									
								
								fish_variables
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								fish_variables
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,42 @@
 | 
				
			|||||||
 | 
					# This file contains fish universal variable definitions.
 | 
				
			||||||
 | 
					# VERSION: 3.0
 | 
				
			||||||
 | 
					SETUVAR __fish_initialized:3400
 | 
				
			||||||
 | 
					SETUVAR fish_color_autosuggestion:767676
 | 
				
			||||||
 | 
					SETUVAR fish_color_cancel:\x2d\x2dreverse
 | 
				
			||||||
 | 
					SETUVAR fish_color_command:00d75f
 | 
				
			||||||
 | 
					SETUVAR fish_color_comment:3a3a3a
 | 
				
			||||||
 | 
					SETUVAR fish_color_cwd:green
 | 
				
			||||||
 | 
					SETUVAR fish_color_cwd_root:red
 | 
				
			||||||
 | 
					SETUVAR fish_color_end:00d7ff
 | 
				
			||||||
 | 
					SETUVAR fish_color_error:ff5f5f
 | 
				
			||||||
 | 
					SETUVAR fish_color_escape:brcyan
 | 
				
			||||||
 | 
					SETUVAR fish_color_history_current:\x2d\x2dbold
 | 
				
			||||||
 | 
					SETUVAR fish_color_host:normal
 | 
				
			||||||
 | 
					SETUVAR fish_color_host_remote:\x1d
 | 
				
			||||||
 | 
					SETUVAR fish_color_keyword:\x1d
 | 
				
			||||||
 | 
					SETUVAR fish_color_normal:normal
 | 
				
			||||||
 | 
					SETUVAR fish_color_operator:brcyan
 | 
				
			||||||
 | 
					SETUVAR fish_color_option:\x1d
 | 
				
			||||||
 | 
					SETUVAR fish_color_param:d7d7af
 | 
				
			||||||
 | 
					SETUVAR fish_color_quote:d7d7d7
 | 
				
			||||||
 | 
					SETUVAR fish_color_redirection:cyan\x1e\x2d\x2dbold
 | 
				
			||||||
 | 
					SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack
 | 
				
			||||||
 | 
					SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
 | 
				
			||||||
 | 
					SETUVAR fish_color_status:red
 | 
				
			||||||
 | 
					SETUVAR fish_color_user:brgreen
 | 
				
			||||||
 | 
					SETUVAR fish_color_valid_path:\x2d\x2dunderline
 | 
				
			||||||
 | 
					SETUVAR fish_greeting:
 | 
				
			||||||
 | 
					SETUVAR fish_key_bindings:fish_default_key_bindings
 | 
				
			||||||
 | 
					SETUVAR fish_pager_color_background:\x1d
 | 
				
			||||||
 | 
					SETUVAR fish_pager_color_completion:normal
 | 
				
			||||||
 | 
					SETUVAR fish_pager_color_description:yellow\x1e\x2d\x2ditalics
 | 
				
			||||||
 | 
					SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
 | 
				
			||||||
 | 
					SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
 | 
				
			||||||
 | 
					SETUVAR fish_pager_color_secondary_background:\x1d
 | 
				
			||||||
 | 
					SETUVAR fish_pager_color_secondary_completion:\x1d
 | 
				
			||||||
 | 
					SETUVAR fish_pager_color_secondary_description:\x1d
 | 
				
			||||||
 | 
					SETUVAR fish_pager_color_secondary_prefix:\x1d
 | 
				
			||||||
 | 
					SETUVAR fish_pager_color_selected_background:\x2d\x2dreverse
 | 
				
			||||||
 | 
					SETUVAR fish_pager_color_selected_completion:\x1d
 | 
				
			||||||
 | 
					SETUVAR fish_pager_color_selected_description:\x1d
 | 
				
			||||||
 | 
					SETUVAR fish_pager_color_selected_prefix:\x1d
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user