Merge branch 'main' into server
This commit is contained in:
1
.config/alacritty/.gitignore
vendored
Normal file
1
.config/alacritty/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
schemes.yml
|
||||
@@ -1,3 +1,6 @@
|
||||
import:
|
||||
- ~/.config/alacritty/schemes.yml
|
||||
|
||||
env:
|
||||
TERM: xterm-256color
|
||||
font:
|
||||
@@ -26,36 +29,15 @@ window:
|
||||
scrolling:
|
||||
history: 0
|
||||
|
||||
colors:
|
||||
# Default colors
|
||||
primary:
|
||||
background: '0x323232'
|
||||
foreground: '0xeeeeec'
|
||||
|
||||
# Normal colors
|
||||
normal:
|
||||
black: '0x2e3436'
|
||||
red: '0xcc0000'
|
||||
green: '0x4e9a06'
|
||||
yellow: '0xc4a000'
|
||||
blue: '0x3465a4'
|
||||
magenta: '0x75507b'
|
||||
cyan: '0x06989a'
|
||||
white: '0xd3d7cf'
|
||||
|
||||
# Bright colors
|
||||
bright:
|
||||
black: '0x555753'
|
||||
red: '0xef2929'
|
||||
green: '0x8ae234'
|
||||
yellow: '0xfce94f'
|
||||
blue: '0x729fcf'
|
||||
magenta: '0xad7fa8'
|
||||
cyan: '0x34e2e2'
|
||||
white: '0xeeeeec'
|
||||
|
||||
shell:
|
||||
program: /usr/local/bin/tmux
|
||||
program: zsh
|
||||
args:
|
||||
- "-c"
|
||||
- "$HOME/.tmux/tmux_attach.sh"
|
||||
|
||||
alt_send_esc: false
|
||||
live_config_reload: true
|
||||
|
||||
key_bindings:
|
||||
- { key: F, mods: Control, command: {program: "zsh", args: ["-c","python3 ~/.config/alacritty/color_switcher.py"]} }
|
||||
- { key: T, mods: Command, command: {program: "alacritty", args: ["-e","zsh"]} } # Spawn alacritty without tmux
|
||||
|
||||
66
.config/alacritty/color_switcher.py
Executable file
66
.config/alacritty/color_switcher.py
Executable file
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
|
||||
CONFIG_FILE_NAME = "schemes.yml"
|
||||
CONFIG_FILE_DIR = os.path.expanduser("~/.config/alacritty/")
|
||||
CONFIG_FILE_PATH = os.path.join(CONFIG_FILE_DIR, CONFIG_FILE_NAME)
|
||||
|
||||
COLOR_SCHEME_LINE_SEARCH = "colors: \*(\S+)"
|
||||
COLOR_SCHEME_LINE_TEMPLATE = "colors: *{}\n"
|
||||
|
||||
NVIM_CONFIG_FILE_DIR = os.path.expanduser("~/.config/nvim/")
|
||||
NVIM_CONFIG_FILE_NAME = "scheme.vim"
|
||||
NVIM_CONFIG_FILE_PATH = os.path.join(NVIM_CONFIG_FILE_DIR, NVIM_CONFIG_FILE_NAME)
|
||||
|
||||
NVIM_COLOR_SCHEME_LINE_SEARCH = "set background=(\S+)\ncolorscheme (\S+)"
|
||||
NVIM_COLOR_SCHEME_LINE_TEMPLATE = "set background={}\ncolorscheme {}"
|
||||
|
||||
def change_alacritty_theme():
|
||||
with open(CONFIG_FILE_PATH, "r") as config_file:
|
||||
config_file.seek(0)
|
||||
lines = config_file.readlines()
|
||||
|
||||
colors_line_index = -1
|
||||
for i, line in enumerate(lines):
|
||||
match = re.search(COLOR_SCHEME_LINE_SEARCH, line)
|
||||
if match is not None:
|
||||
current_color_scheme = match.group(1)
|
||||
colors_line_index = i
|
||||
|
||||
|
||||
if current_color_scheme == "dark_mode":
|
||||
new_scheme = "solarized_light"
|
||||
else:
|
||||
new_scheme = "dark_mode"
|
||||
|
||||
lines[colors_line_index] = COLOR_SCHEME_LINE_TEMPLATE.format(
|
||||
new_scheme)
|
||||
|
||||
with open(CONFIG_FILE_PATH, "w") as config_file:
|
||||
for line in lines:
|
||||
config_file.write(line)
|
||||
return new_scheme
|
||||
|
||||
def change_vim_theme(light_mode=False):
|
||||
with open(NVIM_CONFIG_FILE_PATH, "r") as config_file:
|
||||
config_file.seek(0)
|
||||
config = config_file.read()
|
||||
if light_mode:
|
||||
color_line = NVIM_COLOR_SCHEME_LINE_TEMPLATE.format("light", "solarized")
|
||||
else:
|
||||
color_line = NVIM_COLOR_SCHEME_LINE_TEMPLATE.format("dark", "badwolf")
|
||||
res = re.sub(NVIM_COLOR_SCHEME_LINE_SEARCH, color_line, config)
|
||||
with open(NVIM_CONFIG_FILE_PATH, "w") as config_file:
|
||||
config = config_file.write(res)
|
||||
|
||||
|
||||
def main():
|
||||
new_theme = change_alacritty_theme()
|
||||
change_vim_theme(new_theme == "solarized_light")
|
||||
|
||||
|
||||
if __name__=="__main__":
|
||||
main()
|
||||
1506
.config/alacritty/schemes.yml.template
Normal file
1506
.config/alacritty/schemes.yml.template
Normal file
File diff suppressed because it is too large
Load Diff
3
nvim/.gitignore
vendored
3
nvim/.gitignore
vendored
@@ -6,3 +6,6 @@ __pycache__/
|
||||
bundle/*
|
||||
!bundle/Vundle.vim
|
||||
*.swp
|
||||
|
||||
# Prevent changes to propagate to all systems
|
||||
scheme.vim
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
set rtp+=/usr/lib/python3.6/site-packages/powerline/bindings/vim
|
||||
@@ -1 +0,0 @@
|
||||
set rtp+=$HOME/.local/lib/python3.9/site-packages/powerline/bindings/vim
|
||||
@@ -78,7 +78,11 @@ set t_Co=256
|
||||
"set term=screen-256color
|
||||
|
||||
" Color configuration
|
||||
colorscheme badwolf " some color ..
|
||||
try
|
||||
source ~/.config/nvim/scheme.vim
|
||||
catch
|
||||
" Ignore non existing file
|
||||
endtry
|
||||
syntax enable " enable syntax processing
|
||||
|
||||
" Disable annoying bell
|
||||
|
||||
2
nvim/scheme.vim.template
Normal file
2
nvim/scheme.vim.template
Normal file
@@ -0,0 +1,2 @@
|
||||
set background=dark
|
||||
colorscheme badwolf
|
||||
@@ -8,11 +8,11 @@
|
||||
|
||||
sudo pacman --needed -Sy archlinux-keyring --noconfirm
|
||||
sudo pacman --needed -Syu --noconfirm
|
||||
sudo pacman --needed -Sy base-devel xorg xorg-xinit gnome gnome-extra neovim zsh tmux openssh alacritty powerline powerline-fonts python-pip --noconfirm
|
||||
sudo pacman --needed -Sy base-devel xorg xorg-xinit gnome gnome-extra neovim zsh tmux openssh alacritty powerline-fonts python-pip --noconfirm
|
||||
cp $PWD/nvim/scheme.vim.template $PWD/nvim/scheme.vim
|
||||
cp $PWD/.config/alacritty/schemes.yml.template $PWD/.config/alacritty/schemes.yml
|
||||
pip3 install neovim
|
||||
./clone_and_link.sh
|
||||
cp zsh/.powerline_config_arch.example zsh/.powerline_config
|
||||
cp vim/.vimrc_config_powerline_arch.example vim/.vimrc_config_powerline
|
||||
./copy_fonts_arch.sh
|
||||
if [ $SHELL != "/bin/zsh" ]; then
|
||||
chsh -s /usr/bin/zsh;
|
||||
@@ -29,3 +29,4 @@ done
|
||||
for filename in vim/.*_arch.example; do
|
||||
cp $filename ${filename:0:-13}
|
||||
done
|
||||
echo "You should now start tmux (and zsh) and nvim for automatic plugin installation."
|
||||
|
||||
@@ -65,7 +65,6 @@ set -g @yank_action 'copy-pipe'
|
||||
|
||||
if '[ `uname` == Darwin ]' \
|
||||
'source-file ~/.tmux/.mac_config'
|
||||
#source-file ~/.tmux/.tmux_config_powerline
|
||||
|
||||
set-option -g set-titles on
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
source /usr/lib/python3.10/site-packages/powerline/bindings/tmux/powerline.conf
|
||||
@@ -1 +0,0 @@
|
||||
source /usr/share/powerline/bindings/tmux/powerline.conf
|
||||
@@ -1,2 +0,0 @@
|
||||
source $HOME/.local/lib/python3.9/site-packages/powerline/bindings/tmux/powerline.conf
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
source '/usr/local/lib/python3.10/site-packages/powerline/bindings/tmux/powerline.conf'
|
||||
13
tmux/tmux_attach.sh
Executable file
13
tmux/tmux_attach.sh
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# tmux-attach - attach to first unattached session or
|
||||
# create new session if none are found
|
||||
#
|
||||
N=$(tmux ls | grep -v attached | head -1 | cut -d: -f1)
|
||||
|
||||
if [[ ! -z $N ]]
|
||||
then
|
||||
ATTACH_OPTS="attach -t $N"
|
||||
fi
|
||||
|
||||
exec tmux $ATTACH_OPTS
|
||||
@@ -1 +0,0 @@
|
||||
source /usr/lib/python3.10/site-packages/powerline/bindings/zsh/powerline.zsh
|
||||
@@ -1 +0,0 @@
|
||||
source /usr/share/powerline/bindings/zsh/powerline.zsh
|
||||
@@ -1 +0,0 @@
|
||||
source $HOME/.local/lib/python3.9/site-packages/powerline/bindings/zsh/powerline.zsh
|
||||
Reference in New Issue
Block a user