initial commit

This commit is contained in:
Timofey Gelazoniya 2025-03-25 17:10:03 +03:00
commit 60ee317bbd
No known key found for this signature in database
32 changed files with 1427 additions and 0 deletions

BIN
.meta/screenshots/wall.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 526 KiB

429
LICENSE Normal file
View File

@ -0,0 +1,429 @@
Attribution-NonCommercial-ShareAlike 4.0 International
=======================================================================
Creative Commons Corporation ("Creative Commons") is not a law firm and
does not provide legal services or legal advice. Distribution of
Creative Commons public licenses does not create a lawyer-client or
other relationship. Creative Commons makes its licenses and related
information available on an "as-is" basis. Creative Commons gives no
warranties regarding its licenses, any material licensed under their
terms and conditions, or any related information. Creative Commons
disclaims all liability for damages resulting from their use to the
fullest extent possible.
Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms and
conditions that creators and other rights holders may use to share
original works of authorship and other material subject to copyright
and certain other rights specified in the public license below. The
following considerations are for informational purposes only, are not
exhaustive, and do not form part of our licenses.
Considerations for licensors: Our public licenses are
intended for use by those authorized to give the public
permission to use material in ways otherwise restricted by
copyright and certain other rights. Our licenses are
irrevocable. Licensors should read and understand the terms
and conditions of the license they choose before applying it.
Licensors should also secure all rights necessary before
applying our licenses so that the public can reuse the
material as expected. Licensors should clearly mark any
material not subject to the license. This includes other CC-
licensed material, or material used under an exception or
limitation to copyright. More considerations for licensors:
wiki.creativecommons.org/Considerations_for_licensors
Considerations for the public: By using one of our public
licenses, a licensor grants the public permission to use the
licensed material under specified terms and conditions. If
the licensor's permission is not necessary for any reason--for
example, because of any applicable exception or limitation to
copyright--then that use is not regulated by the license. Our
licenses grant only permissions under copyright and certain
other rights that a licensor has authority to grant. Use of
the licensed material may still be restricted for other
reasons, including because others have copyright or other
rights in the material. A licensor may make special requests,
such as asking that all changes be marked or described.
Although not required by our licenses, you are encouraged to
respect those requests where reasonable. More considerations
for the public:
wiki.creativecommons.org/Considerations_for_licensees
=======================================================================
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
Public License
By exercising the Licensed Rights (defined below), You accept and agree
to be bound by the terms and conditions of this Creative Commons
Attribution-NonCommercial-ShareAlike 4.0 International Public License
("Public License"). To the extent this Public License may be
interpreted as a contract, You are granted the Licensed Rights in
consideration of Your acceptance of these terms and conditions, and the
Licensor grants You such rights in consideration of benefits the
Licensor receives from making the Licensed Material available under
these terms and conditions.
Section 1 -- Definitions.
a. Adapted Material means material subject to Copyright and Similar
Rights that is derived from or based upon the Licensed Material
and in which the Licensed Material is translated, altered,
arranged, transformed, or otherwise modified in a manner requiring
permission under the Copyright and Similar Rights held by the
Licensor. For purposes of this Public License, where the Licensed
Material is a musical work, performance, or sound recording,
Adapted Material is always produced where the Licensed Material is
synched in timed relation with a moving image.
b. Adapter's License means the license You apply to Your Copyright
and Similar Rights in Your contributions to Adapted Material in
accordance with the terms and conditions of this Public License.
c. BY-NC-SA Compatible License means a license listed at
creativecommons.org/compatiblelicenses, approved by Creative
Commons as essentially the equivalent of this Public License.
d. Copyright and Similar Rights means copyright and/or similar rights
closely related to copyright including, without limitation,
performance, broadcast, sound recording, and Sui Generis Database
Rights, without regard to how the rights are labeled or
categorized. For purposes of this Public License, the rights
specified in Section 2(b)(1)-(2) are not Copyright and Similar
Rights.
e. Effective Technological Measures means those measures that, in the
absence of proper authority, may not be circumvented under laws
fulfilling obligations under Article 11 of the WIPO Copyright
Treaty adopted on December 20, 1996, and/or similar international
agreements.
f. Exceptions and Limitations means fair use, fair dealing, and/or
any other exception or limitation to Copyright and Similar Rights
that applies to Your use of the Licensed Material.
g. License Elements means the license attributes listed in the name
of a Creative Commons Public License. The License Elements of this
Public License are Attribution, NonCommercial, and ShareAlike.
h. Licensed Material means the artistic or literary work, database,
or other material to which the Licensor applied this Public
License.
i. Licensed Rights means the rights granted to You subject to the
terms and conditions of this Public License, which are limited to
all Copyright and Similar Rights that apply to Your use of the
Licensed Material and that the Licensor has authority to license.
j. Licensor means the individual(s) or entity(ies) granting rights
under this Public License.
k. NonCommercial means not primarily intended for or directed towards
commercial advantage or monetary compensation. For purposes of
this Public License, the exchange of the Licensed Material for
other material subject to Copyright and Similar Rights by digital
file-sharing or similar means is NonCommercial provided there is
no payment of monetary compensation in connection with the
exchange.
l. Share means to provide material to the public by any means or
process that requires permission under the Licensed Rights, such
as reproduction, public display, public performance, distribution,
dissemination, communication, or importation, and to make material
available to the public including in ways that members of the
public may access the material from a place and at a time
individually chosen by them.
m. Sui Generis Database Rights means rights other than copyright
resulting from Directive 96/9/EC of the European Parliament and of
the Council of 11 March 1996 on the legal protection of databases,
as amended and/or succeeded, as well as other essentially
equivalent rights anywhere in the world.
n. You means the individual or entity exercising the Licensed Rights
under this Public License. Your has a corresponding meaning.
Section 2 -- Scope.
a. License grant.
1. Subject to the terms and conditions of this Public License,
the Licensor hereby grants You a worldwide, royalty-free,
non-sublicensable, non-exclusive, irrevocable license to
exercise the Licensed Rights in the Licensed Material to:
a. reproduce and Share the Licensed Material, in whole or
in part, for NonCommercial purposes only; and
b. produce, reproduce, and Share Adapted Material for
NonCommercial purposes only.
2. Exceptions and Limitations. For the avoidance of doubt, where
Exceptions and Limitations apply to Your use, this Public
License does not apply, and You do not need to comply with
its terms and conditions.
3. Term. The term of this Public License is specified in Section
6(a).
4. Media and formats; technical modifications allowed. The
Licensor authorizes You to exercise the Licensed Rights in
all media and formats whether now known or hereafter created,
and to make technical modifications necessary to do so. The
Licensor waives and/or agrees not to assert any right or
authority to forbid You from making technical modifications
necessary to exercise the Licensed Rights, including
technical modifications necessary to circumvent Effective
Technological Measures. For purposes of this Public License,
simply making modifications authorized by this Section 2(a)
(4) never produces Adapted Material.
5. Downstream recipients.
a. Offer from the Licensor -- Licensed Material. Every
recipient of the Licensed Material automatically
receives an offer from the Licensor to exercise the
Licensed Rights under the terms and conditions of this
Public License.
b. Additional offer from the Licensor -- Adapted Material.
Every recipient of Adapted Material from You
automatically receives an offer from the Licensor to
exercise the Licensed Rights in the Adapted Material
under the conditions of the Adapter's License You apply.
c. No downstream restrictions. You may not offer or impose
any additional or different terms or conditions on, or
apply any Effective Technological Measures to, the
Licensed Material if doing so restricts exercise of the
Licensed Rights by any recipient of the Licensed
Material.
6. No endorsement. Nothing in this Public License constitutes or
may be construed as permission to assert or imply that You
are, or that Your use of the Licensed Material is, connected
with, or sponsored, endorsed, or granted official status by,
the Licensor or others designated to receive attribution as
provided in Section 3(a)(1)(A)(i).
b. Other rights.
1. Moral rights, such as the right of integrity, are not
licensed under this Public License, nor are publicity,
privacy, and/or other similar personality rights; however, to
the extent possible, the Licensor waives and/or agrees not to
assert any such rights held by the Licensor to the limited
extent necessary to allow You to exercise the Licensed
Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this
Public License.
3. To the extent possible, the Licensor waives any right to
collect royalties from You for the exercise of the Licensed
Rights, whether directly or through a collecting society
under any voluntary or waivable statutory or compulsory
licensing scheme. In all other cases the Licensor expressly
reserves any right to collect such royalties, including when
the Licensed Material is used other than for NonCommercial
purposes.
Section 3 -- License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the
following conditions.
a. Attribution.
1. If You Share the Licensed Material (including in modified
form), You must:
a. retain the following if it is supplied by the Licensor
with the Licensed Material:
i. identification of the creator(s) of the Licensed
Material and any others designated to receive
attribution, in any reasonable manner requested by
the Licensor (including by pseudonym if
designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of
warranties;
v. a URI or hyperlink to the Licensed Material to the
extent reasonably practicable;
b. indicate if You modified the Licensed Material and
retain an indication of any previous modifications; and
c. indicate the Licensed Material is licensed under this
Public License, and include the text of, or the URI or
hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any
reasonable manner based on the medium, means, and context in
which You Share the Licensed Material. For example, it may be
reasonable to satisfy the conditions by providing a URI or
hyperlink to a resource that includes the required
information.
3. If requested by the Licensor, You must remove any of the
information required by Section 3(a)(1)(A) to the extent
reasonably practicable.
b. ShareAlike.
In addition to the conditions in Section 3(a), if You Share
Adapted Material You produce, the following conditions also apply.
1. The Adapter's License You apply must be a Creative Commons
license with the same License Elements, this version or
later, or a BY-NC-SA Compatible License.
2. You must include the text of, or the URI or hyperlink to, the
Adapter's License You apply. You may satisfy this condition
in any reasonable manner based on the medium, means, and
context in which You Share Adapted Material.
3. You may not offer or impose any additional or different terms
or conditions on, or apply any Effective Technological
Measures to, Adapted Material that restrict exercise of the
rights granted under the Adapter's License You apply.
Section 4 -- Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that
apply to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
to extract, reuse, reproduce, and Share all or a substantial
portion of the contents of the database for NonCommercial purposes
only;
b. if You include all or a substantial portion of the database
contents in a database in which You have Sui Generis Database
Rights, then the database in which You have Sui Generis Database
Rights (but not its individual contents) is Adapted Material,
including for purposes of Section 3(b); and
c. You must comply with the conditions in Section 3(a) if You Share
all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not
replace Your obligations under this Public License where the Licensed
Rights include other Copyright and Similar Rights.
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
c. The disclaimer of warranties and limitation of liability provided
above shall be interpreted in a manner that, to the extent
possible, most closely approximates an absolute disclaimer and
waiver of all liability.
Section 6 -- Term and Termination.
a. This Public License applies for the term of the Copyright and
Similar Rights licensed here. However, if You fail to comply with
this Public License, then Your rights under this Public License
terminate automatically.
b. Where Your right to use the Licensed Material has terminated under
Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided
it is cured within 30 days of Your discovery of the
violation; or
2. upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any
right the Licensor may have to seek remedies for Your violations
of this Public License.
c. For the avoidance of doubt, the Licensor may also offer the
Licensed Material under separate terms or conditions or stop
distributing the Licensed Material at any time; however, doing so
will not terminate this Public License.
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
License.
Section 7 -- Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different
terms or conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the
Licensed Material not stated herein are separate from and
independent of the terms and conditions of this Public License.
Section 8 -- Interpretation.
a. For the avoidance of doubt, this Public License does not, and
shall not be interpreted to, reduce, limit, restrict, or impose
conditions on any use of the Licensed Material that could lawfully
be made without permission under this Public License.
b. To the extent possible, if any provision of this Public License is
deemed unenforceable, it shall be automatically reformed to the
minimum extent necessary to make it enforceable. If the provision
cannot be reformed, it shall be severed from this Public License
without affecting the enforceability of the remaining terms and
conditions.
c. No term or condition of this Public License will be waived and no
failure to comply consented to unless expressly agreed to by the
Licensor.
d. Nothing in this Public License constitutes or may be interpreted
as a limitation upon, or waiver of, any privileges and immunities
that apply to the Licensor or You, including from the legal
processes of any jurisdiction or authority.
=======================================================================
Creative Commons is not a party to its public
licenses. Notwithstanding, Creative Commons may elect to apply one of
its public licenses to material it publishes and in those instances
will be considered the “Licensor.” The text of the Creative Commons
public licenses is dedicated to the public domain under the CC0 Public
Domain Dedication. Except for the limited purpose of indicating that
material is shared under a Creative Commons public license or as
otherwise permitted by the Creative Commons policies published at
creativecommons.org/policies, Creative Commons does not authorize the
use of the trademark "Creative Commons" or any other trademark or logo
of Creative Commons without its prior written consent including,
without limitation, in connection with any unauthorized modifications
to any of its public licenses or any other arrangements,
understandings, or agreements concerning use of licensed material. For
the avoidance of doubt, this paragraph does not form part of the
public licenses.
Creative Commons may be contacted at creativecommons.org.

193
README.md Normal file
View File

@ -0,0 +1,193 @@
# WSL2 Arch Linux Development Environment
My Arch Linux development environment optimized for WSL2, designed for daily workflow. This setup combines essential tools and configurations to create a powerful yet minimalist development workspace, making it perfect for both casual coding sessions and intensive development work.
###### Mirror on my [<img src="https://git.zeldon.ru/assets/img/logo.svg" align="center" width="20" height="20"/> Git](https://git.zeldon.ru/zeldon/dotfiles-wsl2)
## Features
<img src="./.meta/screenshots/wall.png" alt="Rice Showcase" align="right" width="600px">
### Core Components
- **OS:** [Arch Linux](https://archlinux.org) on WSL2
- **Terminal:** [WezTerm](https://github.com/wezterm/wezterm)
- **Shell:** [Fish](https://github.com/fish-shell/fish-shell)
- **Multiplexer:** [Tmux](https://github.com/tmux/tmux)
- **Prompt:** [Starship](https://github.com/starship/starship)
### Additional Tools
- **Package Manager:** [paru](https://github.com/Morganamilo/paru)
- **Editor:** [Neovim](https://github.com/neovim/neovim)
- **System Info:** [fastfetch](https://github.com/fastfetch-cli/fastfetch)
- **File Listing:** [exa](https://github.com/ogham/exa)
- **System Monitor:** [htop](https://github.com/htop-dev/htop)
## Installation
### Software Requirements
- Windows 10 version 2004 (build 19041) or higher / Windows 11
- Windows Subsystem for Linux (WSL2) component enabled
- Virtual Machine Platform feature enabled
- Windows Terminal (optional but recommended for initial setup)
- Git for Windows
> Note: WSL2 is configured to use up to 16GB of RAM in this setup (can be adjusted in [.wslconfig](./windows/.wslconfig))
### 1. Windows Host Setup
```powershell
# Install WezTerm (or download directly: https://wezterm.org/install/windows.html)
winget install wezterm
# Clone repository
git clone https://github.com/xzeldon/dotfiles-wsl2
cd dotfiles-wsl2
# Copy Windows configs
Copy-Item -Path ".\windows\*" -Destination $HOME -Force -Recurse
```
### 2. Arch Linux WSL Setup
1. Download the [latest Arch Linux WSL image](https://gitlab.archlinux.org/archlinux/archlinux-wsl/-/releases/permalink/latest) (you need `.wsl` file)
2. Import to WSL2:
```powershell
wsl --import NAME INSTALL_PATH IMAGE_PATH
```
Where:
- `NAME`: Your preferred WSL distribution name (e.g., "Arch")
- `INSTALL_PATH`: Where to store the WSL2 virtual disk (e.g., "D:\wsl\Arch")
- `IMAGE_PATH`: Path to the downloaded Arch Linux image (e.g., "D:\Downloads\archlinux-latest.wsl")
Example:
```powershell
wsl --import Arch D:\wsl\Arch "D:\Downloads\archlinux-latest.wsl"
```
### 3. System Configuration
<details>
<summary><b>Initial Setup</b></summary>
```bash
# Run first-time setup
/usr/lib/wsl/first-setup.sh
# Update system
pacman -Syu
# Install dependencies
pacman -S sudo git vim neovim wget binutils less debugedit fakeroot \
fastfetch starship exa fish tmux htop python
```
</details>
<details>
<summary><b>User Configuration</b></summary>
```bash
# Set root user password
passwd
# Configure locale
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
locale-gen
# Create user
useradd -m user
# Set user password
passwd user
# Configure sudo
echo "user ALL=(ALL) ALL" >> /etc/sudoers.d/user
# Configure WSL default user
# 1. Copy WSL configuration file from host to guest
# (From Windows PowerShell, assuming you're in the repo directory and Arch is a WSL distribution name, from 2.2)
cp .\wsl\etc\wsl.conf \\wsl$\Arch\etc\wsl.conf
# 2. Restart WSL for changes to take effect
# (Run this in PowerShell on Windows)
wsl --shutdown
```
</details>
<details>
<summary><b>Development Tools</b></summary>
```bash
# Install AUR helper
git clone https://aur.archlinux.org/paru-bin.git
cd paru-bin
makepkg -si
# Install agent for ssh bridge (see: https://wiki.archlinux.org/title/Install_Arch_Linux_on_WSL#Bridge_the_ssh-agent_service_from_Windows)
paru -S wsl2-ssh-agent
```
### Copy Configuration Files
You need to copy all configuration files from the repository to your WSL environment:
1. From Windows PowerShell:
```powershell
# Assuming you're in the repo directory and Arch is a WSL distribution name, from 2.2
cp -r .\wsl\* \\wsl$\Arch\home\user\
```
</details>
### 4. Final Setup
```bash
# Install Tmux Plugin Manager
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
# Start tmux and install plugins
tmux attach # Then press Ctrl+Space, Shift+I
```
## Configuration
### File Structure
```
├── windows/ # Windows-side configs
│ ├── .wezterm.lua # WezTerm configuration
│ └── .wslconfig # WSL global settings
└── wsl/ # Linux-side configs
├── .config/
│ ├── fish/ # Fish shell configuration
│ ├── tmux/ # Tmux configuration
│ └── starship.toml # Prompt configuration
└── etc/
└── wsl.conf # WSL distribution settings
```
### Key Bindings
| Binding | Action |
| ------------------ | ----------------------- |
| `Ctrl + Space` | Tmux prefix |
| `Prefix + I` | Install Tmux plugins |
| `Ctrl + Shift + Q` | Close WezTerm window |
| `Ctrl + Shift + M` | Minimize WezTerm window |
## License
[![CC BY-NC-SA 4.0][cc-by-nc-sa-image]][cc-by-nc-sa]
[cc-by-nc-sa]: http://creativecommons.org/licenses/by-nc-sa/4.0/
[cc-by-nc-sa-image]: https://licensebuttons.net/l/by-nc-sa/4.0/88x31.png

51
windows/.wezterm.lua Normal file
View File

@ -0,0 +1,51 @@
local wezterm = require 'wezterm'
-- Center window on startup
wezterm.on("gui-startup", function(cmd)
local screen = wezterm.gui.screens().active
local ratio = 0.8
local width, height = screen.width * ratio, screen.height * ratio
local _, _, window = wezterm.mux.spawn_window {
position = {
x = (screen.width - width) / 2,
y = (screen.height - height) / 2,
origin = 'ActiveScreen'
}
}
window:gui_window():set_inner_size(width, height)
end)
return {
-- General settings
automatically_reload_config = true,
check_for_updates = false,
canonicalize_pasted_newlines = "LineFeed",
mux_enable_ssh_agent = false,
-- Appearance
color_scheme = "Monokai (base16)",
font = wezterm.font("JetBrainsMono Nerd Font Mono", { weight = "DemiBold" }),
font_size = 14,
window_background_opacity = 0.77,
win32_system_backdrop = "Acrylic",
window_decorations = "INTEGRATED_BUTTONS|RESIZE",
-- Tab behavior
hide_tab_bar_if_only_one_tab = true,
show_tab_index_in_tab_bar = false,
-- Window behavior
window_close_confirmation = "NeverPrompt",
-- Startup program
default_domain = "WSL:arch",
-- Remap keys
keys = {
{
key = "Q",
mods = "CTRL",
action = wezterm.action.CloseCurrentTab { confirm = false },
},
}
}

4
windows/.wslconfig Normal file
View File

@ -0,0 +1,4 @@
[wsl2]
memory=16GB
networkingMode=mirrored
guiApplications = true

14
wsl/.bashrc Normal file
View File

@ -0,0 +1,14 @@
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
alias ls='ls --color=auto'
alias grep='grep --color=auto'
PS1='[\u@\h \W]\$ '
if [[ "$TERM_PROGRAM" == "WezTerm" ]]; then
exec tmux attach || tmux
fi

View File

@ -0,0 +1,20 @@
{
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
"modules": [
"title",
"separator",
"os",
"host",
"kernel",
"uptime",
"packages",
"shell",
"terminal",
"cpu",
"gpu",
"memory",
"swap",
"break",
"colors"
]
}

View File

@ -0,0 +1,7 @@
complete --command fisher --exclusive --long help --description "Print help"
complete --command fisher --exclusive --long version --description "Print version"
complete --command fisher --exclusive --condition __fish_use_subcommand --arguments install --description "Install plugins"
complete --command fisher --exclusive --condition __fish_use_subcommand --arguments update --description "Update installed plugins"
complete --command fisher --exclusive --condition __fish_use_subcommand --arguments remove --description "Remove installed plugins"
complete --command fisher --exclusive --condition __fish_use_subcommand --arguments list --description "List installed plugins matching regex"
complete --command fisher --exclusive --condition "__fish_seen_subcommand_from update remove" --arguments "(fisher list)"

View File

@ -0,0 +1,10 @@
# Remove legacy hooks to prevent errors when upgrading.
# This can be removed when we cleanup other universal abbr code.
functions -e _git_install _git_update _git_uninstall
# fisher initialization, protected as omf also tries to run it.
set -q fisher_path; or set -l fisher_path $__fish_config_dir
if test -f $fisher_path/functions/__git.init.fish
source $fisher_path/functions/__git.init.fish
__git.init
end

View File

@ -0,0 +1,26 @@
# Locale
export LC_ALL="en_US.UTF-8"
export LANG="en_US.UTF-8"
# Editor
export EDITOR="nvim"
alias subl='"/mnt/c/Program Files/Sublime Text/subl.exe"'
alias cls="clear"
alias p="sudo pacman"
alias vim="nvim"
if type -q exa
alias ll="exa -l -g --icons"
alias lla="ll -a"
alias lt="ll --tree --level=2 -a"
end
if status is-interactive
# Commands to run in interactive sessions can go here
end
# Configure ssh-agent for WSL, see: https://github.com/mame/wsl2-ssh-agent
set -x SSH_AUTH_SOCK /home/user/.ssh/wsl2-ssh-agent.sock
starship init fish | source

View File

@ -0,0 +1,2 @@
jorgebucaran/fisher
jhillyerd/plugin-git

View File

@ -0,0 +1,35 @@
# This file contains fish universal variable definitions.
# VERSION: 3.0
SETUVAR __fish_initialized:3800
SETUVAR _fisher_jhillyerd_2F_plugin_2D_git_files:\x7e/\x2econfig/fish/functions/__git\x2ebranch_has_wip\x2efish\x1e\x7e/\x2econfig/fish/functions/__git\x2ecurrent_branch\x2efish\x1e\x7e/\x2econfig/fish/functions/__git\x2edefault_branch\x2efish\x1e\x7e/\x2econfig/fish/functions/__git\x2edestroy\x2efish\x1e\x7e/\x2econfig/fish/functions/__git\x2einit\x2efish\x1e\x7e/\x2econfig/fish/functions/gbage\x2efish\x1e\x7e/\x2econfig/fish/functions/gbda\x2efish\x1e\x7e/\x2econfig/fish/functions/gdv\x2efish\x1e\x7e/\x2econfig/fish/functions/gignored\x2efish\x1e\x7e/\x2econfig/fish/functions/glp\x2efish\x1e\x7e/\x2econfig/fish/functions/grename\x2efish\x1e\x7e/\x2econfig/fish/functions/grt\x2efish\x1e\x7e/\x2econfig/fish/functions/gtest\x2efish\x1e\x7e/\x2econfig/fish/functions/gtl\x2efish\x1e\x7e/\x2econfig/fish/functions/gunwip\x2efish\x1e\x7e/\x2econfig/fish/functions/gwip\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/git\x2efish
SETUVAR _fisher_jorgebucaran_2F_fisher_files:\x7e/\x2econfig/fish/functions/fisher\x2efish\x1e\x7e/\x2econfig/fish/completions/fisher\x2efish
SETUVAR _fisher_plugins:jorgebucaran/fisher\x1ejhillyerd/plugin\x2dgit
SETUVAR _fisher_upgraded_to_4_4:\x1d
SETUVAR fish_color_autosuggestion:brblack
SETUVAR fish_color_cancel:\x2dr
SETUVAR fish_color_command:normal
SETUVAR fish_color_comment:red
SETUVAR fish_color_cwd:green
SETUVAR fish_color_cwd_root:red
SETUVAR fish_color_end:green
SETUVAR fish_color_error:brred
SETUVAR fish_color_escape:brcyan
SETUVAR fish_color_history_current:\x2d\x2dbold
SETUVAR fish_color_host:normal
SETUVAR fish_color_host_remote:yellow
SETUVAR fish_color_normal:normal
SETUVAR fish_color_operator:brcyan
SETUVAR fish_color_param:cyan
SETUVAR fish_color_quote:yellow
SETUVAR fish_color_redirection:cyan\x1e\x2d\x2dbold
SETUVAR fish_color_search_match:white\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_key_bindings:fish_default_key_bindings
SETUVAR fish_pager_color_completion:normal
SETUVAR fish_pager_color_description:yellow\x1e\x2di
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_selected_background:\x2dr

View File

@ -0,0 +1,3 @@
function __git.branch_has_wip -d "Returns 0 if branch has --wip--, otherwise 1"
git log -n 1 2>/dev/null | grep -qc "\-\-wip\-\-"
end

View File

@ -0,0 +1,6 @@
function __git.current_branch -d "Output git's current branch name"
begin
git symbolic-ref HEAD; or \
git rev-parse --short HEAD; or return
end 2>/dev/null | sed -e 's|^refs/heads/||'
end

View File

@ -0,0 +1,11 @@
function __git.default_branch -d "Use init.defaultBranch if it's set and exists, otherwise use main if it exists. Falls back to master"
command git rev-parse --git-dir &>/dev/null; or return
if set -l default_branch (command git config --get init.defaultBranch)
and command git show-ref -q --verify refs/heads/{$default_branch}
echo $default_branch
else if command git show-ref -q --verify refs/heads/main
echo main
else
echo master
end
end

View File

@ -0,0 +1,7 @@
function __git.destroy
for ab in $__git_plugin_abbreviations
abbr -e $ab
end
set -Ue __git_plugin_abbreviations
set -Ue __git_plugin_initialized
end

View File

@ -0,0 +1,201 @@
function __git.init
function __git.create_abbr -d "Create Git plugin abbreviation"
set -l name $argv[1]
set -l body $argv[2..-1]
# TODO: global scope abbr will be default in fish 3.6.0
abbr -a -g $name $body
end
# Provide a smooth transition from universal to global abbreviations by
# deleting the old univeral ones. Can be removed after fish 3.6 is in
# wide-spread use, i.e. 2024. __git.destroy should also be removed
# at the same time.
if set -q __git_plugin_initialized
__git.destroy
end
# git abbreviations
__git.create_abbr g git
__git.create_abbr ga git add
__git.create_abbr gaa git add --all
__git.create_abbr gau git add --update
__git.create_abbr gapa git add --patch
__git.create_abbr gap git apply
__git.create_abbr gb git branch -vv
__git.create_abbr gba git branch -a -v
__git.create_abbr gban git branch -a -v --no-merged
__git.create_abbr gbd git branch -d
__git.create_abbr gbD git branch -D
__git.create_abbr ggsup git branch --set-upstream-to=origin/\(__git.current_branch\)
__git.create_abbr gbl git blame -b -w
__git.create_abbr gbs git bisect
__git.create_abbr gbsb git bisect bad
__git.create_abbr gbsg git bisect good
__git.create_abbr gbsr git bisect reset
__git.create_abbr gbss git bisect start
__git.create_abbr gc git commit -v
__git.create_abbr gc! git commit -v --amend
__git.create_abbr gcn! git commit -v --no-edit --amend
__git.create_abbr gca git commit -v -a
__git.create_abbr gca! git commit -v -a --amend
__git.create_abbr gcan! git commit -v -a --no-edit --amend
__git.create_abbr gcv git commit -v --no-verify
__git.create_abbr gcav git commit -a -v --no-verify
__git.create_abbr gcav! git commit -a -v --no-verify --amend
__git.create_abbr gcm git commit -m
__git.create_abbr gcam git commit -a -m
__git.create_abbr gcs git commit -S
__git.create_abbr gscam git commit -S -a -m
__git.create_abbr gcfx git commit --fixup
__git.create_abbr gcf git config --list
__git.create_abbr gcl git clone
__git.create_abbr gclean git clean -di
__git.create_abbr gclean! git clean -dfx
__git.create_abbr gclean!! "git reset --hard; and git clean -dfx"
__git.create_abbr gcount git shortlog -sn
__git.create_abbr gcp git cherry-pick
__git.create_abbr gcpa git cherry-pick --abort
__git.create_abbr gcpc git cherry-pick --continue
__git.create_abbr gd git diff
__git.create_abbr gdca git diff --cached
__git.create_abbr gds git diff --stat
__git.create_abbr gdsc git diff --stat --cached
__git.create_abbr gdt git diff-tree --no-commit-id --name-only -r
__git.create_abbr gdw git diff --word-diff
__git.create_abbr gdwc git diff --word-diff --cached
__git.create_abbr gdto git difftool
__git.create_abbr gdg git diff --no-ext-diff
__git.create_abbr gignore git update-index --assume-unchanged
__git.create_abbr gf git fetch
__git.create_abbr gfa git fetch --all --prune
__git.create_abbr gfm "git fetch origin (__git.default_branch) --prune; and git merge FETCH_HEAD"
__git.create_abbr gfo git fetch origin
__git.create_abbr gl git pull
__git.create_abbr ggl git pull origin \(__git.current_branch\)
__git.create_abbr gll git pull origin
__git.create_abbr glr git pull --rebase
__git.create_abbr glg git log --stat
__git.create_abbr glgg git log --graph
__git.create_abbr glgga git log --graph --decorate --all
__git.create_abbr glo git log --oneline --decorate --color
__git.create_abbr glog git log --oneline --decorate --color --graph
__git.create_abbr gloga git log --oneline --decorate --color --graph --all
__git.create_abbr glom git log --oneline --decorate --color \(__git.default_branch\)..
__git.create_abbr glod git log --oneline --decorate --color develop..
__git.create_abbr gloo "git log --pretty=format:'%C(yellow)%h %Cred%ad %Cblue%an%Cgreen%d %Creset%s' --date=short"
__git.create_abbr gm git merge
__git.create_abbr gmt git mergetool --no-prompt
__git.create_abbr gmom git merge origin/\(__git.default_branch\)
__git.create_abbr gp git push
__git.create_abbr gp! git push --force-with-lease
__git.create_abbr gpo git push origin
__git.create_abbr gpo! git push --force-with-lease origin
__git.create_abbr gpv git push --no-verify
__git.create_abbr gpv! git push --no-verify --force-with-lease
__git.create_abbr ggp git push origin \(__git.current_branch\)
__git.create_abbr ggp! git push origin \(__git.current_branch\) --force-with-lease
__git.create_abbr gpu git push origin \(__git.current_branch\) --set-upstream
__git.create_abbr gpoat "git push origin --all; and git push origin --tags"
__git.create_abbr ggpnp "git pull origin (__git.current_branch); and git push origin (__git.current_branch)"
__git.create_abbr gr git remote -vv
__git.create_abbr gra git remote add
__git.create_abbr grb git rebase
__git.create_abbr grba git rebase --abort
__git.create_abbr grbc git rebase --continue
__git.create_abbr grbi git rebase --interactive
__git.create_abbr grbm git rebase \(__git.default_branch\)
__git.create_abbr grbmi git rebase \(__git.default_branch\) --interactive
__git.create_abbr grbmia git rebase \(__git.default_branch\) --interactive --autosquash
__git.create_abbr grbom "git fetch origin (__git.default_branch); and git rebase FETCH_HEAD"
__git.create_abbr grbomi "git fetch origin (__git.default_branch); and git rebase FETCH_HEAD --interactive"
__git.create_abbr grbomia "git fetch origin (__git.default_branch); and git rebase FETCH_HEAD --interactive --autosquash"
__git.create_abbr grbd git rebase develop
__git.create_abbr grbdi git rebase develop --interactive
__git.create_abbr grbdia git rebase develop --interactive --autosquash
__git.create_abbr grbs git rebase --skip
__git.create_abbr ggu git pull --rebase origin \(__git.current_branch\)
__git.create_abbr grev git revert
__git.create_abbr grh git reset
__git.create_abbr grhh git reset --hard
__git.create_abbr grhpa git reset --patch
__git.create_abbr grm git rm
__git.create_abbr grmc git rm --cached
__git.create_abbr grmv git remote rename
__git.create_abbr grpo git remote prune origin
__git.create_abbr grrm git remote remove
__git.create_abbr grs git restore
__git.create_abbr grset git remote set-url
__git.create_abbr grss git restore --source
__git.create_abbr grst git restore --staged
__git.create_abbr grup git remote update
__git.create_abbr grv git remote -v
__git.create_abbr gsh git show
__git.create_abbr gsd git svn dcommit
__git.create_abbr gsr git svn rebase
__git.create_abbr gsb git status -sb
__git.create_abbr gss git status -s
__git.create_abbr gst git status
__git.create_abbr gsta git stash
__git.create_abbr gstd git stash drop
__git.create_abbr gstl git stash list
__git.create_abbr gstp git stash pop
__git.create_abbr gsts git stash show --text
__git.create_abbr gsu git submodule update
__git.create_abbr gsur git submodule update --recursive
__git.create_abbr gsuri git submodule update --recursive --init
__git.create_abbr gts git tag -s
__git.create_abbr gtv git tag | sort -V
__git.create_abbr gsw git switch
__git.create_abbr gswc git switch --create
__git.create_abbr gunignore git update-index --no-assume-unchanged
__git.create_abbr gup git pull --rebase
__git.create_abbr gupv git pull --rebase -v
__git.create_abbr gupa git pull --rebase --autostash
__git.create_abbr gupav git pull --rebase --autostash -v
__git.create_abbr gwch git whatchanged -p --abbrev-commit --pretty=medium
# git checkout abbreviations
__git.create_abbr gco git checkout
__git.create_abbr gcb git checkout -b
__git.create_abbr gcod git checkout develop
__git.create_abbr gcom git checkout \(__git.default_branch\)
# git flow abbreviations
__git.create_abbr gfb git flow bugfix
__git.create_abbr gff git flow feature
__git.create_abbr gfr git flow release
__git.create_abbr gfh git flow hotfix
__git.create_abbr gfs git flow support
__git.create_abbr gfbs git flow bugfix start
__git.create_abbr gffs git flow feature start
__git.create_abbr gfrs git flow release start
__git.create_abbr gfhs git flow hotfix start
__git.create_abbr gfss git flow support start
__git.create_abbr gfbt git flow bugfix track
__git.create_abbr gfft git flow feature track
__git.create_abbr gfrt git flow release track
__git.create_abbr gfht git flow hotfix track
__git.create_abbr gfst git flow support track
__git.create_abbr gfp git flow publish
# git worktree abbreviations
__git.create_abbr gwt git worktree
__git.create_abbr gwta git worktree add
__git.create_abbr gwtls git worktree list
__git.create_abbr gwtlo git worktree lock
__git.create_abbr gwtmv git worktree move
__git.create_abbr gwtpr git worktree prune
__git.create_abbr gwtrm git worktree remove
__git.create_abbr gwtulo git worktree unlock
# GitLab push options
__git.create_abbr gmr git push origin \(__git.current_branch\) --set-upstream -o merge_request.create
__git.create_abbr gmwps git push origin \(__git.current_branch\) --set-upstream -o merge_request.create -o merge_request.merge_when_pipeline_succeeds
# Cleanup declared functions
functions -e __git.create_abbr
end

View File

@ -0,0 +1,240 @@
function fisher --argument-names cmd --description "A plugin manager for Fish"
set --query fisher_path || set --local fisher_path $__fish_config_dir
set --local fisher_version 4.4.5
set --local fish_plugins $__fish_config_dir/fish_plugins
switch "$cmd"
case -v --version
echo "fisher, version $fisher_version"
case "" -h --help
echo "Usage: fisher install <plugins...> Install plugins"
echo " fisher remove <plugins...> Remove installed plugins"
echo " fisher update <plugins...> Update installed plugins"
echo " fisher update Update all installed plugins"
echo " fisher list [<regex>] List installed plugins matching regex"
echo "Options:"
echo " -v, --version Print version"
echo " -h, --help Print this help message"
echo "Variables:"
echo " \$fisher_path Plugin installation path. Default: $__fish_config_dir" | string replace --regex -- $HOME \~
case ls list
string match --entire --regex -- "$argv[2]" $_fisher_plugins
case install update remove
isatty || read --local --null --array stdin && set --append argv $stdin
set --local install_plugins
set --local update_plugins
set --local remove_plugins
set --local arg_plugins $argv[2..-1]
set --local old_plugins $_fisher_plugins
set --local new_plugins
test -e $fish_plugins && set --local file_plugins (string match --regex -- '^[^\s]+$' <$fish_plugins | string replace -- \~ ~)
if ! set --query argv[2]
if test "$cmd" != update
echo "fisher: Not enough arguments for command: \"$cmd\"" >&2 && return 1
else if ! set --query file_plugins
echo "fisher: \"$fish_plugins\" file not found: \"$cmd\"" >&2 && return 1
end
set arg_plugins $file_plugins
end
for plugin in $arg_plugins
set plugin (test -e "$plugin" && realpath $plugin || string lower -- $plugin)
contains -- "$plugin" $new_plugins || set --append new_plugins $plugin
end
if set --query argv[2]
for plugin in $new_plugins
if contains -- "$plugin" $old_plugins
test "$cmd" = remove &&
set --append remove_plugins $plugin ||
set --append update_plugins $plugin
else if test "$cmd" = install
set --append install_plugins $plugin
else
echo "fisher: Plugin not installed: \"$plugin\"" >&2 && return 1
end
end
else
for plugin in $new_plugins
contains -- "$plugin" $old_plugins &&
set --append update_plugins $plugin ||
set --append install_plugins $plugin
end
for plugin in $old_plugins
contains -- "$plugin" $new_plugins || set --append remove_plugins $plugin
end
end
set --local pid_list
set --local source_plugins
set --local fetch_plugins $update_plugins $install_plugins
set --local fish_path (status fish-path)
echo (set_color --bold)fisher $cmd version $fisher_version(set_color normal)
for plugin in $fetch_plugins
set --local source (command mktemp -d)
set --append source_plugins $source
command mkdir -p $source/{completions,conf.d,themes,functions}
$fish_path --command "
if test -e $plugin
command cp -Rf $plugin/* $source
else
set temp (command mktemp -d)
set repo (string split -- \@ $plugin) || set repo[2] HEAD
if set path (string replace --regex -- '^(https://)?gitlab.com/' '' \$repo[1])
set name (string split -- / \$path)[-1]
set url https://gitlab.com/\$path/-/archive/\$repo[2]/\$name-\$repo[2].tar.gz
else
set url https://api.github.com/repos/\$repo[1]/tarball/\$repo[2]
end
echo Fetching (set_color --underline)\$url(set_color normal)
if command curl -q --silent -L \$url | command tar -xzC \$temp -f - 2>/dev/null
command cp -Rf \$temp/*/* $source
else
echo fisher: Invalid plugin name or host unavailable: \\\"$plugin\\\" >&2
command rm -rf $source
end
command rm -rf \$temp
end
set files $source/* && string match --quiet --regex -- .+\.fish\\\$ \$files
" &
set --append pid_list (jobs --last --pid)
end
wait $pid_list 2>/dev/null
for plugin in $fetch_plugins
if set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)] && test ! -e $source
if set --local index (contains --index -- "$plugin" $install_plugins)
set --erase install_plugins[$index]
else
set --erase update_plugins[(contains --index -- "$plugin" $update_plugins)]
end
end
end
for plugin in $update_plugins $remove_plugins
if set --local index (contains --index -- "$plugin" $_fisher_plugins)
set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files
if contains -- "$plugin" $remove_plugins
for name in (string replace --filter --regex -- '.+/conf\.d/([^/]+)\.fish$' '$1' $$plugin_files_var)
emit {$name}_uninstall
end
printf "%s\n" Removing\ (set_color red --bold)$plugin(set_color normal) " "$$plugin_files_var | string replace -- \~ ~
set --erase _fisher_plugins[$index]
end
command rm -rf (string replace -- \~ ~ $$plugin_files_var)
functions --erase (string replace --filter --regex -- '.+/functions/([^/]+)\.fish$' '$1' $$plugin_files_var)
for name in (string replace --filter --regex -- '.+/completions/([^/]+)\.fish$' '$1' $$plugin_files_var)
complete --erase --command $name
end
set --erase $plugin_files_var
end
end
if set --query update_plugins[1] || set --query install_plugins[1]
command mkdir -p $fisher_path/{functions,themes,conf.d,completions}
end
for plugin in $update_plugins $install_plugins
set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)]
set --local files $source/{functions,themes,conf.d,completions}/*
if set --local index (contains --index -- $plugin $install_plugins)
set --local user_files $fisher_path/{functions,themes,conf.d,completions}/*
set --local conflict_files
for file in (string replace -- $source/ $fisher_path/ $files)
contains -- $file $user_files && set --append conflict_files $file
end
if set --query conflict_files[1] && set --erase install_plugins[$index]
echo -s "fisher: Cannot install \"$plugin\": please remove or move conflicting files first:" \n" "$conflict_files >&2
continue
end
end
for file in (string replace -- $source/ "" $files)
command cp -RLf $source/$file $fisher_path/$file
end
set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files
set --query files[1] && set --universal $plugin_files_var (string replace -- $source $fisher_path $files | string replace -- ~ \~)
contains -- $plugin $_fisher_plugins || set --universal --append _fisher_plugins $plugin
contains -- $plugin $install_plugins && set --local event install || set --local event update
printf "%s\n" Installing\ (set_color --bold)$plugin(set_color normal) " "$$plugin_files_var | string replace -- \~ ~
for file in (string match --regex -- '.+/[^/]+\.fish$' $$plugin_files_var | string replace -- \~ ~)
source $file
if set --local name (string replace --regex -- '.+conf\.d/([^/]+)\.fish$' '$1' $file)
emit {$name}_$event
end
end
end
command rm -rf $source_plugins
if set --query _fisher_plugins[1]
set --local commit_plugins
for plugin in $file_plugins
contains -- (string lower -- $plugin) (string lower -- $_fisher_plugins) && set --append commit_plugins $plugin
end
for plugin in $_fisher_plugins
contains -- (string lower -- $plugin) (string lower -- $commit_plugins) || set --append commit_plugins $plugin
end
string replace --regex -- $HOME \~ $commit_plugins >$fish_plugins
else
set --erase _fisher_plugins
command rm -f $fish_plugins
end
set --local total (count $install_plugins) (count $update_plugins) (count $remove_plugins)
test "$total" != "0 0 0" && echo (string join ", " (
test $total[1] = 0 || echo "Installed $total[1]") (
test $total[2] = 0 || echo "Updated $total[2]") (
test $total[3] = 0 || echo "Removed $total[3]")
) plugin/s
case \*
echo "fisher: Unknown command: \"$cmd\"" >&2 && return 1
end
end
if ! set --query _fisher_upgraded_to_4_4
set --universal _fisher_upgraded_to_4_4
if functions --query _fisher_list
set --query XDG_DATA_HOME[1] || set --local XDG_DATA_HOME ~/.local/share
command rm -rf $XDG_DATA_HOME/fisher
functions --erase _fisher_{list,plugin_parse}
fisher update >/dev/null 2>/dev/null
else
for var in (set --names | string match --entire --regex '^_fisher_.+_files$')
set $var (string replace -- ~ \~ $$var)
end
functions --erase _fisher_fish_postexec
end
end

View File

@ -0,0 +1,5 @@
function gbage -d "List local branches and display their age"
git for-each-ref --sort=committerdate refs/heads/ \
--format="%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))"
end

View File

@ -0,0 +1,15 @@
function gbda -d "Delete all branches merged in current HEAD, including squashed"
git branch --merged | \
# *: current branch, +: current branch on worktree.
command grep -vE '^\*|^\+|^\s*(master|main|develop)\s*$' | \
command xargs -r -n 1 git branch -d
set -l default_branch (__git.default_branch)
git for-each-ref refs/heads/ "--format=%(refname:short)" | \
while read branch
set -l merge_base (git merge-base $default_branch $branch)
if string match -q -- '-*' (git cherry $default_branch (git commit-tree (git rev-parse $branch\^{tree}) -p $merge_base -m _))
git branch -D $branch
end
end
end

View File

@ -0,0 +1,3 @@
function gdv -w "git diff -w" -d "Pipe `git diff` to `view` command"
git diff -w $argv | view -
end

View File

@ -0,0 +1,3 @@
function gignored -w 'grep "^[[:lower:]]"' -d "list temporarily ignored files"
git ls-files -v | grep "^[[:lower:]]" $argv
end

View File

@ -0,0 +1,5 @@
function glp -d "git log at requested pretty level" -a format
set -q format[1]; and git log --pretty=$format
end
complete -c glp -x -a "(complete -C 'git log --pretty=' | sed 's/^--pretty=//')"

View File

@ -0,0 +1,11 @@
function grename -d "Rename 'old' branch to 'new', including in origin remote" -a old new
if test (count $argv) -ne 2
echo "Usage: "(status -u)" old_branch new_branch"
return 1
end
git branch -m $old $new
git push origin :$old
and git push --set-upstream origin $new
end
complete -c grename -x -a "(complete -C 'git branch ')"

View File

@ -0,0 +1,3 @@
function grt -d "cd into the top of the current repository or submodule"
cd (git rev-parse --show-toplevel; or echo ".")
end

View File

@ -0,0 +1,21 @@
# gtest: test a command against git staged changes.
#
# example usage:
# gtest make test
function gtest -d "test command on staged changes only"
# Stash working dir, keeping index changes.
git stash push -q --keep-index --include-untracked; or return
# Run test command against index changes only.
command $argv
set cmdstatus $status
# Return working dir and index to original state.
# Note: reset + restore is required to prevent merge conflicts
# when popping the stash.
git reset -q
git restore .
git stash pop -q --index; or return $status
return $cmdstatus
end

View File

@ -0,0 +1,3 @@
function gtl -d "List tags matching prefix" -a prefix
git tag --sort=-v:refname -n -l $prefix\*
end

View File

@ -0,0 +1,7 @@
# Work In Progress (wip)
# These features allow to pause a branch development and switch to another one
# When you want to go back to work, just unwip it
#
function gunwip -d "git uncommit the work-in-progress branch"
git log -n 1 | grep -q -c "\--wip--"; and git reset HEAD~1
end

View File

@ -0,0 +1,7 @@
# Work In Progress (wip)
# These features allow to pause a branch development and switch to another one
# When you want to go back to work, just unwip it
#
function gwip -d "git commit a work-in-progress branch"
git add -A; git rm (git ls-files --deleted) 2> /dev/null; git commit -m "--wip--" --no-verify
end

View File

@ -0,0 +1,8 @@
# Get editor completions based on the config schema
"$schema" = 'https://starship.rs/config-schema.json'
add_newline = false
# Replace the '' symbol in the prompt with '➜'
[character] # The name of the module we are configuring is 'character'
success_symbol = '[➜](bold green)' # The 'success_symbol' segment is being set to '➜' with the color 'bold green'

View File

@ -0,0 +1,71 @@
# Use fish as default
set -g default-shell /usr/sbin/fish
# Enable 256-color and true-color (24-bit) support in tmux
set -g default-terminal "screen-256color" # Set terminal type for 256-color support
set -ga terminal-overrides ",*256col*:Tc" # Override to enable true-color for compatible terminals
# General
set -g set-clipboard on # Use system clipboard
set -g detach-on-destroy off # Don't exit from tmux when closing a session
set -g escape-time 0 # Remove delay for exiting insert mode with ESC in Neovim
set -g history-limit 1000000 # Increase history size (from 2,000)
set -g mouse on # Enable mouse support
set -g status-interval 3 # Update the status bar every 3 seconds (default: 15 seconds)
set -g allow-passthrough on # Allow programs in the pane to bypass tmux (e.g. for image preview)
# Set prefix key
unbind C-b # Unbind the default prefix key
set -g prefix C-Space # Set new prefix key to Ctrl+Space
# Refresh tmux config with r
unbind r
bind r source-file ~/.config/tmux/tmux.conf
# New panes in current path
bind c new-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind '"' split-window -v -c "#{pane_current_path}"
# Set first window to index 1 (not 0) to map more to the keyboard layout
set-option -g renumber-windows on
set -g base-index 1
setw -g pane-base-index 1
# tpm plugin manager
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'hendrikmi/tmux-cpu-mem-monitor' # CPU and memory info
# Some tweaks to the status bar
set -g status-right ""
set -g window-status-current-style "underscore"
# Status bar
set-option -g status on
set-option -g status-interval 1
set-option -g status-justify centre
set-option -g status-keys vi
set-option -g status-position bottom
set-option -g status-style fg=colour136,bg=colour235
set-option -g status-left-length 35
set-option -g status-left-style default
set-option -g status-left "#[fg=green]#H #[fg=green,bright]#(uname -r | sed 's/-microsoft-standard//')#[default]"
set-option -g status-right-length 140
set-option -g status-right-style default
set-option -g status-right "#[fg=green]CPU: #{cpu -i 3} MEM: #{mem} DISK: #{disk --path /mnt/k -f}#[default] "
set-option -ag status-right "#[fg=blue]%d.%m.%Y"
set-window-option -g window-status-style fg=colour244
set-window-option -g window-status-style bg=default
set-window-option -g window-status-current-style fg=colour166
set-window-option -g window-status-current-style bg=default
# Create a single default session - because a session is created here, tmux
# should be started with "tmux attach" rather than "tmux new"
new -d -s1 -nfish 'fish'
set -t1:1 monitor-activity on
set -t1:1 aggressive-resize on
neww -d
neww -d
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'

6
wsl/etc/wsl.conf Normal file
View File

@ -0,0 +1,6 @@
[boot]
systemd=true
[user]
default=user
[wsl2]
guiApplications = true