Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d8b2435e28 |
2
.github/FUNDING.yml
vendored
Normal file
2
.github/FUNDING.yml
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
custom: ['https://qiwi.com/n/THREA793', 'https://www.blockchain.com/btc/address/bc1qgh2fyzqgyxgpstsmqwxyev2luzx7hwc4ezq03u', 'https://www.blockchain.com/eth/address/0x01931cf08BbbA74629c232DbEDB390798cDD121f']
|
||||
30
.gitignore
vendored
30
.gitignore
vendored
@ -3,15 +3,11 @@ home/user/.config/zsh/plugins/*
|
||||
home/user/.config/nvim/plugin
|
||||
home/user/.config/nvim/spell
|
||||
|
||||
home/user/.config/bash/bashrc.d/*
|
||||
!home/user/.config/bash/bashrc.d/.gitkeep
|
||||
home/user/.config/zsh/zshrc.d/*
|
||||
!home/user/.config/zsh/zshrc.d/00_zhashd.sh
|
||||
!home/user/.config/zsh/zshrc.d/.gitkeep
|
||||
|
||||
home/user/.zshenv.d/*
|
||||
!home/user/.zshenv.d/.gitkeep
|
||||
|
||||
home/user/.config/zsh/.zcalc_history
|
||||
|
||||
.zcompdump
|
||||
*.zwc
|
||||
|
||||
home/user/.ssh/*
|
||||
@ -27,23 +23,3 @@ lazy-lock.json
|
||||
|
||||
home/user/.config/ranger/plugins
|
||||
home/user/.termux/shell
|
||||
|
||||
home/user/.config/tmux/plugins
|
||||
home/user/.config/tmux/local.conf
|
||||
|
||||
home/user/.tmux/*
|
||||
!home/user/.tmux/dotfiles
|
||||
!home/user/.tmux/sandbox
|
||||
!home/user/.tmux/ssh
|
||||
!home/user/.tmux/example-background-job
|
||||
!home/user/.tmux/system-update
|
||||
!home/user/.tmux/music
|
||||
!home/user/.tmux/landing
|
||||
|
||||
home/user/.config/git/local
|
||||
|
||||
home/user/.config/sway/config.d/*
|
||||
!home/user/.config/sway/config.d/.gitkeep
|
||||
|
||||
home/user/.config/sway/variables.d/*
|
||||
!home/user/.config/sway/variables.d/.gitkeep
|
||||
|
||||
26
README.md
26
README.md
@ -20,13 +20,14 @@
|
||||
## Project description
|
||||
|
||||
Config files for:
|
||||
* bash
|
||||
* zsh
|
||||
* alacritty
|
||||
* tmux
|
||||
* ssh
|
||||
* git
|
||||
* ranger
|
||||
* sway
|
||||
* i3
|
||||
* vim
|
||||
* nvim
|
||||
|
||||
@ -36,18 +37,17 @@ Config files for:
|
||||
<img src=".assets/prompt.png" alt="Prompt">
|
||||
</p>
|
||||
|
||||
You can add your files to the `~/.config/zsh/zshrc.d` directory for zsh so
|
||||
that they automatically run in ascending order when you open a terminal.\
|
||||
You can add your files to the `~/.config/bash/bashrc.d` directory for bash or `~/.config/zsh/zshrc.d` directory for zsh so that they automatically run in ascending order when you open a terminal.\
|
||||
Example:\
|
||||
`~/.config/zsh/zshrc.d/01_hello.sh`
|
||||
```sh
|
||||
`~/.config/bash/bashrc.d/01_hello.sh`
|
||||
```bash
|
||||
echo "Hello $USER!"
|
||||
```
|
||||
|
||||
<a id="chapter-1"></a>
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
```bash
|
||||
git clone https://github.com/TheK4n/dotfiles
|
||||
cd dotfiles
|
||||
./install zsh nvim ...
|
||||
@ -62,7 +62,19 @@ Per-user dotfiles "package" manager
|
||||
2. Uninstalling installed files
|
||||
3. Check installation integrity
|
||||
4. Transaction based installation
|
||||
5. Does not overwrite your configs
|
||||
5. Do not overwrite your configs
|
||||
|
||||
### Dependencies
|
||||
* bash
|
||||
* coreutils
|
||||
* diffutils
|
||||
* grep
|
||||
|
||||
|
||||
### Optional dependencies
|
||||
* git
|
||||
* wget
|
||||
* unzip
|
||||
|
||||
|
||||
<h1 align="center"><a href="#top">▲</a></h1>
|
||||
30
TARGETS.sh
30
TARGETS.sh
@ -1,30 +0,0 @@
|
||||
readonly TARGETS="\
|
||||
colors:.config/terminal-colors.d
|
||||
less:.lesskey .infokey
|
||||
tmux:.config/tmux .tmux .config/systemd/user/tmux.service %copypasta
|
||||
t:
|
||||
note:
|
||||
psw:
|
||||
zsh:.config/zsh .zshenv .zshenv.d .inputrc %copypasta %colors
|
||||
alacritty:.config/alacritty
|
||||
nvim:.config/nvim .editorconfig .editrc .local/bin/vim_askpass_helper
|
||||
ssh:
|
||||
git:.config/git .local/bin/ga
|
||||
ranger:.config/ranger
|
||||
gpg:
|
||||
sway:.config/sway .config/i3blocks .config/mako .config/mimeapps.list .config/rofi .local/bin/screenshot .config/swaylock .Xresources .local/bin/slm .local/bin/slm_rofi .local/bin/firefox_media %copypasta %pomodoro
|
||||
pomodoro:
|
||||
bat:.config/bat
|
||||
font:
|
||||
termux:.termux
|
||||
arch:
|
||||
psql:.psqlrc
|
||||
docker:.docker/cli-plugins
|
||||
ipython:.ipython/profile_default/ipython_config.py
|
||||
gdb:.config/gdb
|
||||
sandbox:
|
||||
chromium:.local/bin/pchromium .local/share/applications/pchromium.desktop
|
||||
scripts:.local/bin/httpstatus .local/bin/apco .local/bin/bb .local/bin/emoji .local/bin/mksh .local/bin/nato .local/bin/pastas .local/bin/timer .local/bin/tryna .local/bin/trynafail .local/bin/bak .local/bin/cleanup-directory .local/bin/cleanup-directory-log .local/bin/cleanup-downloads .local/bin/gobuild .local/bin/json .local/bin/open .local/bin/py .local/bin/sha .local/bin/showtips .local/bin/weather .local/bin/radio .local/bin/rmt .local/bin/scratch .local/bin/wake .local/bin/myip .local/bin/genpass .local/bin/gensalt .local/bin/django-create-project .local/bin/mirror-site .local/bin/split-file .local/bin/extract .local/bin/destroy .local/bin/serveit .local/bin/highlight-logs %copypasta
|
||||
music:.local/bin/mpv-service.sh .config/systemd/user/mpv.service .local/bin/player
|
||||
copypasta:.local/bin/copy .local/bin/pasta
|
||||
all:%less %t %note %tmux %zsh %nvim %git"
|
||||
6
etc/X11/xorg.conf.d/20-nvidia.conf
Normal file
6
etc/X11/xorg.conf.d/20-nvidia.conf
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
Section "Device"
|
||||
Identifier "Default nvidia Device"
|
||||
Driver "nvidia"
|
||||
Option "ForceFullCompositionPipeline" "true"
|
||||
EndSection
|
||||
@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
beep -f 4000 -l 150 -D 150 -n -f 4000 -l 150
|
||||
5
etc/skel/.bash_profile
Normal file
5
etc/skel/.bash_profile
Normal file
@ -0,0 +1,5 @@
|
||||
#
|
||||
# ~/.bash_profile
|
||||
#
|
||||
|
||||
[[ -f ~/.bashrc ]] && . ~/.bashrc
|
||||
82
etc/skel/.bashrc
Normal file
82
etc/skel/.bashrc
Normal file
@ -0,0 +1,82 @@
|
||||
|
||||
if [ -x "$(which dircolors)" ]; then
|
||||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||
|
||||
alias dir='dir --color=auto'
|
||||
alias vdir='vdir --color=auto'
|
||||
alias grep='grep --color=auto'
|
||||
alias fgrep='fgrep --color=auto'
|
||||
|
||||
alias ls='ls --color=auto'
|
||||
fi
|
||||
|
||||
alias l.='ls -AF --ignore="*"'
|
||||
alias ll='ls -lhF'
|
||||
alias la='ls -AF'
|
||||
|
||||
alias lt='du -sh * | sort -h'
|
||||
|
||||
alias rm='rm -ir'
|
||||
alias mkdir='mkdir -pv'
|
||||
|
||||
alias cd..='cd ..'
|
||||
alias ..='cd ..'
|
||||
alias ...='cd ../..'
|
||||
alias .3='cd ../../..'
|
||||
|
||||
alias path='echo -e ${PATH//:/\\n}'
|
||||
|
||||
# shorts
|
||||
alias c='clear'
|
||||
alias q='exit'
|
||||
alias h='history | less'
|
||||
alias j='jobs -l'
|
||||
alias hg='history|grep'
|
||||
|
||||
# utils
|
||||
alias sha='shasum -a 256'
|
||||
alias getpass="openssl rand -base64 12"
|
||||
alias diff='colordiff'
|
||||
alias mount='mount | column -t'
|
||||
alias upgrade_all='sudo apt update && sudo apt upgrade'
|
||||
alias tar-it='tar -czf "../${PWD##*/}.tar.gz" .'
|
||||
|
||||
|
||||
# time
|
||||
alias now='date +"%T"'
|
||||
alias nowdate='date +"%d-%m-%Y"'
|
||||
|
||||
# vim
|
||||
alias vi=vim
|
||||
alias svi="sudo -E vim"
|
||||
alias vis='vim "+set si"'
|
||||
alias edit=vim
|
||||
|
||||
# net
|
||||
alias ports='netstat -tulanp'
|
||||
alias wget='wget -c'
|
||||
alias ping='ping -c 5'
|
||||
alias myip='curl ipinfo.io/ip'
|
||||
|
||||
# starts web server
|
||||
alias www='python3 -m http.server 8000'
|
||||
|
||||
# hard
|
||||
alias reboot='sudo /sbin/reboot'
|
||||
alias poweroff='sudo /sbin/poweroff'
|
||||
alias halt='sudo /sbin/halt'
|
||||
alias shutdown='sudo /sbin/shutdown'
|
||||
|
||||
alias meminfo='free -mlth'
|
||||
alias psmem='ps auxf | sort -nr -k 4 | less -R'
|
||||
alias wake="echo $'\a'" # command; wake &
|
||||
|
||||
alias music='mplayer -shuffle ~/Music/*'
|
||||
|
||||
|
||||
# initializes first ./*/*/activate
|
||||
alias ve='python3 -m virtualenv venv && . venv/bin/activate'
|
||||
alias vd='deactivate'
|
||||
|
||||
|
||||
PS1="\n┌──(\u@\H)-[\w]\n└─\$ "
|
||||
55
etc/skel/.vimrc
Normal file
55
etc/skel/.vimrc
Normal file
@ -0,0 +1,55 @@
|
||||
set number "номер строки
|
||||
set ruler
|
||||
set laststatus=2
|
||||
set encoding=utf-8 "Ставит кодировку UTF-8
|
||||
set nocompatible "Отключает обратную совместимость с Vi
|
||||
syntax on "Включает подсветку синтаксиса
|
||||
|
||||
set expandtab
|
||||
set smarttab
|
||||
set tabstop=4
|
||||
set softtabstop=4
|
||||
set shiftwidth=4
|
||||
set autoindent
|
||||
set smartindent
|
||||
set nowrap
|
||||
|
||||
set noerrorbells
|
||||
set novisualbell
|
||||
set showcmd
|
||||
set showtabline=2
|
||||
|
||||
set ignorecase
|
||||
set smartcase
|
||||
set hlsearch
|
||||
set incsearch
|
||||
|
||||
set mousehide
|
||||
set mouse=a
|
||||
|
||||
set colorcolumn=120
|
||||
set scrolloff=7
|
||||
|
||||
set virtualedit=onemore " allow for cursor beyond last character
|
||||
|
||||
" f4 toggle hlsearch
|
||||
nnoremap <F4> :set invhlsearch<CR>
|
||||
|
||||
" navigation on russian
|
||||
nmap о j
|
||||
nmap л k
|
||||
nmap р h
|
||||
nmap д l
|
||||
nmap ш i
|
||||
nmap ф a
|
||||
nmap в d
|
||||
|
||||
|
||||
set ffs=unix,dos,mac
|
||||
set encoding=utf8
|
||||
|
||||
" tabs
|
||||
nnoremap <C-Left> :tabprevious<CR>
|
||||
nnoremap <C-Right> :tabnext<CR>
|
||||
nnoremap <C-h> :tabprevious<CR>
|
||||
nnoremap <C-l> :tabnext<CR>
|
||||
2
etc/skel/Public/.permissions
Normal file
2
etc/skel/Public/.permissions
Normal file
@ -0,0 +1,2 @@
|
||||
chmod 751 /home/user
|
||||
chmod 1777 /home/user/Public
|
||||
@ -1,3 +0,0 @@
|
||||
chmod 751 "${HOME}"
|
||||
mkdir "${HOME}/public"
|
||||
chmod 1777 "${HOME}/public"
|
||||
@ -1,4 +0,0 @@
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=
|
||||
ExecStart=-/sbin/agetty --noreset --noclear --autologin thek4n - ${TERM}
|
||||
@ -0,0 +1,3 @@
|
||||
[Service]
|
||||
ExecStart=
|
||||
ExecStart=-/sbin/agetty -o '-p -- %%USER%%' --noclear --skip-login - $TERM
|
||||
@ -1,3 +0,0 @@
|
||||
[Service]
|
||||
ExecStart=
|
||||
ExecStart=-/sbin/agetty -o '-p -- %%USER%%' --noclear --skip-login - $TERM
|
||||
1
etc/systemd/system/getty@tty2.service.d/skip-username.conf
Symbolic link
1
etc/systemd/system/getty@tty2.service.d/skip-username.conf
Symbolic link
@ -0,0 +1 @@
|
||||
../getty@tty1.service.d/skip-username.conf
|
||||
@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
echo
|
||||
figlet -ct -f banner "welcome mr.kan"
|
||||
echo
|
||||
@ -1,10 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "wg0 status: $(systemctl is-active wg-quick@wg0.service)"
|
||||
|
||||
if ! systemctl is-active wg-quick@wg0.service 1>/dev/null; then
|
||||
#shellcheck disable=SC2016
|
||||
echo 'Executing this command may fix wireguard: "sudo apt update && sudo apt install linux-headers-$(uname -r) && sudo reboot"'
|
||||
fi
|
||||
|
||||
echo
|
||||
7
home/user/.bashrc
Normal file
7
home/user/.bashrc
Normal file
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# .bashrc by TheK4n
|
||||
# https://github.com/TheK4n/dotfiles
|
||||
|
||||
if [ -f "$HOME/.config/bash/sourcer" ]; then
|
||||
source $HOME/.config/bash/sourcer
|
||||
fi
|
||||
@ -1,3 +1,4 @@
|
||||
live_config_reload = true
|
||||
|
||||
[env]
|
||||
TERM = "xterm-256color"
|
||||
@ -14,25 +15,17 @@ action = "SpawnNewInstance"
|
||||
key = "Return"
|
||||
mods = "Control|Shift"
|
||||
|
||||
[[keyboard.bindings]]
|
||||
action = "None"
|
||||
key = "Space"
|
||||
mods = "Control|Shift"
|
||||
|
||||
[mouse]
|
||||
hide_when_typing = true
|
||||
|
||||
[scrolling]
|
||||
history = 3000
|
||||
history = 100000
|
||||
multiplier = 3
|
||||
|
||||
[window]
|
||||
dynamic_title = true
|
||||
opacity = 0.92
|
||||
opacity = 0.83
|
||||
|
||||
[window.dimensions]
|
||||
columns = 150
|
||||
lines = 42
|
||||
|
||||
[general]
|
||||
live_config_reload = true
|
||||
|
||||
119
home/user/.config/bash/aliases
Normal file
119
home/user/.config/bash/aliases
Normal file
@ -0,0 +1,119 @@
|
||||
_d() { true ; }
|
||||
_f() { true ; }
|
||||
|
||||
# colors
|
||||
if [ -x "$(command -v dircolors)" ]; then
|
||||
export LS_OPTIONS="--color=auto"
|
||||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||
|
||||
alias grep='grep $LS_OPTIONS'
|
||||
alias fgrep='fgrep $LS_OPTIONS'
|
||||
alias ls='ls -v $LS_OPTIONS'
|
||||
fi
|
||||
|
||||
alias l.='ls -AFv --ignore="*"'
|
||||
alias ll='ls -lhFv'
|
||||
alias la='ls -AFv'
|
||||
alias lla='ls -lhFAv'
|
||||
alias ll.='ls -lhFAv --ignore="*"'
|
||||
alias lsl='_d() { ls -lhFA --color=always "${1:-.}" | $PAGER ; }; _d'
|
||||
|
||||
|
||||
alias _='sudo'
|
||||
alias root='sudo -i TMOUT=450'
|
||||
|
||||
alias rm='rm -Ivr --one-file-system'
|
||||
alias mkdir='mkdir -pv'
|
||||
|
||||
alias cd..='cd ..'
|
||||
alias ..='cd ..'
|
||||
alias ...='cd ../..'
|
||||
alias ....='cd ../../..'
|
||||
alias .3='cd ../../..'
|
||||
alias cl='_d() { cd "${1:-$HOME}" && ls; }; _d'
|
||||
|
||||
alias wp='cd $WORKING_PROJECT'
|
||||
|
||||
alias path='echo -e ${PATH//:/\\n}'
|
||||
|
||||
# shorts
|
||||
alias c='clear'
|
||||
alias q='exit 0'
|
||||
alias h='history 0'
|
||||
alias j='jobs -l'
|
||||
|
||||
# utils
|
||||
alias sha='(shasum -a 256 | head -c 64)'
|
||||
alias genpass="openssl rand -base64 12"
|
||||
alias gensalt="dd if=/dev/urandom count=16 2>/dev/null | sha256sum | head -c 64"
|
||||
alias diff='colordiff'
|
||||
alias tar-it='tar -czf "../${PWD##*/}.tar.gz" .'
|
||||
|
||||
|
||||
# time
|
||||
alias now='date +"%T"'
|
||||
alias nowdate='date +"%d-%m-%Y"'
|
||||
alias cal='cal -m'
|
||||
|
||||
# vim
|
||||
alias svi="sudo -E nvim"
|
||||
|
||||
# net
|
||||
alias ports='ss -tlnp'
|
||||
alias wget='wget -c'
|
||||
alias myip='curl ipinfo.io/ip'
|
||||
alias sprunge='curl -F "sprunge=<-" http://sprunge.us 2>/dev/null' # CLI pastebin
|
||||
alias weather='(curl -4 wttr.in/$(cat) 2>/dev/null | head -n -1) <<<'
|
||||
|
||||
# starts web server
|
||||
alias www='python3 -m http.server 8080'
|
||||
|
||||
# hardware
|
||||
alias reboot='sudo /sbin/reboot'
|
||||
alias poweroff='sudo /sbin/poweroff'
|
||||
alias suspend='sudo systemctl suspend'
|
||||
alias halt='sudo /sbin/halt'
|
||||
alias shutdown='sudo /sbin/shutdown now'
|
||||
|
||||
alias meminfo='free -mlth'
|
||||
|
||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||
alias wake='((speaker-test -t sine -f 400 &>/dev/null)& local pid=$! ;sleep 0.2s; kill -9 $pid) &>/dev/null'
|
||||
elif [[ "$OSTYPE" == "linux-android"* ]]; then
|
||||
alias wake='termux-notification --sound --vibrate 500,1000,200'
|
||||
fi
|
||||
|
||||
# python
|
||||
alias pipir='python3 -m pip install -r requirements.txt'
|
||||
alias pipar='python3 -m pip freeze > requirements.txt'
|
||||
alias vd='deactivate'
|
||||
|
||||
# git
|
||||
alias watch-diff='watch --color "git diff --color=always"'
|
||||
|
||||
|
||||
# docker
|
||||
alias dcu='docker-compose up -d'
|
||||
alias dcd='docker-compose down'
|
||||
alias drmc='docker container prune'
|
||||
alias drmi='docker image prune'
|
||||
|
||||
|
||||
# clipboard
|
||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||
if [[ -n "$DISPLAY" ]]; then
|
||||
alias copy='xclip -selection clipboard -i'
|
||||
alias paste='xclip -selection clipboard -o'
|
||||
else
|
||||
alias copy='read -rd "EOF" TTYCLIPBOARD'
|
||||
alias paste='echo "$TTYCLIPBOARD"'
|
||||
fi
|
||||
elif [[ "$OSTYPE" == "linux-android"* ]]; then
|
||||
alias copy='termux-clipboard-set'
|
||||
alias paste='termux-clipboard-get'
|
||||
elif [[ "$OSTYPE" == "darwin" ]]; then
|
||||
alias copy='pbcopy'
|
||||
alias paste='pbpaste'
|
||||
fi
|
||||
|
||||
alias black='convert canvas:none PNG:- | feh -YF -'
|
||||
12
home/user/.config/bash/completion
Normal file
12
home/user/.config/bash/completion
Normal file
@ -0,0 +1,12 @@
|
||||
_workon() {
|
||||
local cur prev envs
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
envs=$(ls /opt/pythonenv/)
|
||||
|
||||
COMPREPLY=( $(compgen -W "${envs}" -- ${cur}) )
|
||||
}
|
||||
|
||||
complete -F _workon workon
|
||||
|
||||
35
home/user/.config/bash/export
Normal file
35
home/user/.config/bash/export
Normal file
@ -0,0 +1,35 @@
|
||||
|
||||
umask 022
|
||||
|
||||
export EDITOR="nvim"
|
||||
export VISUAL="nvim"
|
||||
|
||||
export PAGER="less"
|
||||
export LESS="-nCMiSR -# 1 -+X -+F"
|
||||
|
||||
export CDPATH=:~:~/code
|
||||
|
||||
export HISTSIZE=10000
|
||||
export HISTFILESIZE=10000
|
||||
export HISTCONTROL=ignoreboth:erasedups
|
||||
export HISTTIMEFORMAT="%F %T "
|
||||
export HISTIGNORE="&:l[lsa\.]:[bf]g:exit:q:clear:c:history:h"
|
||||
|
||||
export BROWSERCLI=w3m
|
||||
test -z "$BROWSER" && export BROWSER=firefox
|
||||
|
||||
|
||||
if [ -d "$HOME/.local/bin" ] ; then
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
fi
|
||||
|
||||
if [ -d "$HOME/.npm-global/bin" ] ; then
|
||||
export PATH="$HOME/.npm-global/bin:$PATH"
|
||||
fi
|
||||
|
||||
for TMPDIR in "$TMPDIR" "$TMP" /tmp /var/tmp
|
||||
do
|
||||
test -d "$TMPDIR" && break
|
||||
done
|
||||
|
||||
export TMPDIR
|
||||
224
home/user/.config/bash/functions
Normal file
224
home/user/.config/bash/functions
Normal file
@ -0,0 +1,224 @@
|
||||
_sod() {
|
||||
if [ -d "$1" ] && [ -n "$(ls "$1")" ]; then
|
||||
for FILENAME in $(ls "$1" | sort -n)
|
||||
do
|
||||
source "$1/$FILENAME"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
lt() {
|
||||
du -h "${1:-.}" 2>/dev/null | sort -h | tac
|
||||
}
|
||||
|
||||
destroy() {
|
||||
test -n "$1" || return 1
|
||||
test -e "$1" || return 1
|
||||
|
||||
echo -n "Sure want to destroy file '$1' with size $(du -hs "$1" | awk '{printf $1}') [y/N] "
|
||||
read -r response
|
||||
[[ $response == [yY] ]] && shred -zun 25 "$1"
|
||||
}
|
||||
|
||||
workon() {
|
||||
source /opt/pythonenv/"${1:-$(basename $PWD)}"/bin/activate
|
||||
}
|
||||
|
||||
py() {
|
||||
if [[ -z "$@" && -x "$(command -v ipython 2>/dev/null)" ]]; then
|
||||
ipython -i -c "q = exit"
|
||||
else
|
||||
python3 $@
|
||||
fi
|
||||
}
|
||||
|
||||
ve() {
|
||||
python3 -m virtualenv "${1:-venv}" && . "${1:-venv}/bin/activate"
|
||||
}
|
||||
|
||||
va() {
|
||||
local activate_venv
|
||||
|
||||
if [ -f "./venv/bin/activate" ]; then
|
||||
source "./venv/bin/activate"
|
||||
return 0
|
||||
fi
|
||||
|
||||
activate_venv="$(find -P . -maxdepth 3 -type f -wholename '*/bin/activate' | sort | head -n 1)"
|
||||
|
||||
if [ -n "$activate_venv" ]; then
|
||||
source "$activate_venv"
|
||||
return 0
|
||||
else
|
||||
echo "va: error: virtual environment not found, use python3 -m virtualenv venv" >&2
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
extract() {
|
||||
if [ -z "$1" ]; then # if string non-zero
|
||||
# display usage if no parameters given
|
||||
echo "extract: error: usage: extract <path/file_name>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz>"
|
||||
return 2
|
||||
fi
|
||||
|
||||
if ! [ -f "$1" ]; then # if file not exist
|
||||
echo "extract: error: '$1' file does not exist" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
local NAME
|
||||
NAME=${1%%.*} # removes extension from filename
|
||||
|
||||
|
||||
if [ -e "$NAME" ]; then
|
||||
echo "extract: error: '$NAME' exists" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
mkdir "$NAME" && cd "$NAME" || return 1
|
||||
|
||||
case $1 in
|
||||
*.tar.bz2) tar xjf ../"$1" ;;
|
||||
*.tar.gz) tar xzf ../"$1" ;;
|
||||
*.tar.xz) tar xJf ../"$1" ;;
|
||||
*.lzma) unlzma ../"$1" ;;
|
||||
*.bz2) bunzip2 ../"$1" ;;
|
||||
*.rar) unrar x -ad ../"$1" ;;
|
||||
*.gz) gunzip ../"$1" ;;
|
||||
*.tar) tar xf ../"$1" ;;
|
||||
*.tbz2) tar xjf ../"$1" ;;
|
||||
*.tgz) tar xzf ../"$1" ;;
|
||||
*.zip) unzip ../"$1" ;;
|
||||
*.Z) uncompress ../"$1" ;;
|
||||
*.7z) 7z x ../"$1" ;;
|
||||
*.xz) unxz ../"$1" ;;
|
||||
*.exe) cabextract ../"$1" ;;
|
||||
*) echo "extract: error: '$1' - unknown archive method" >&2 ;;
|
||||
esac
|
||||
cd ..
|
||||
}
|
||||
|
||||
|
||||
mcd() {
|
||||
if [ -z "$1" ]; then
|
||||
cd "$(mktemp -d)"
|
||||
else
|
||||
mkdir -p "$1" && cd "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# toggle wireguard vpn with interface /etc/wireguard/wg0.conf
|
||||
# to allow sudo user toggle vpn without password:
|
||||
## sudo groupadd wireguard
|
||||
## sudo usermod -aG wireguard $USER
|
||||
vpn() {
|
||||
local STATUS SERVICE CONFIG CONFIGFILE
|
||||
CONFIG="${1:-wg0}"
|
||||
|
||||
CONFIGFILE="/etc/wireguard/$CONFIG.conf"
|
||||
|
||||
test -e "$CONFIGFILE" || (echo "Config '$CONFIGFILE' not exists" >&2; return 1) && (
|
||||
|
||||
SERVICE="wg-quick@$CONFIG.service"
|
||||
|
||||
systemctl --quiet is-active "$SERVICE" && \
|
||||
(sudo systemctl stop "$SERVICE" && echo DOWN) || \
|
||||
(sudo systemctl start "$SERVICE" && ip -br a | grep "$CONFIG" | awk '{print $1":\t"$3}')
|
||||
)
|
||||
}
|
||||
|
||||
toggle-ssh-proxy() {
|
||||
SSH_PROXY_CONTROL_FILE="$XDG_RUNTIME_DIR/ssh_$1_proxy.control"
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Proxy ssh server hostname not specified" 1>&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -e "$SSH_PROXY_CONTROL_FILE" ]; then
|
||||
unset {http,https,ftp,rsync,no}_proxy
|
||||
ssh -S "$SSH_PROXY_CONTROL_FILE" -O exit "$1"
|
||||
unset SSH_PROXY_PID
|
||||
echo "Disabled"
|
||||
else
|
||||
ssh -nCTN -S "$SSH_PROXY_CONTROL_FILE" -D 1080 "$1"
|
||||
export {http,https,ftp,rsync}_proxy="socks5://127.0.0.1:1080" && \
|
||||
export no_proxy="localhost,127.0.0.1/8,localaddress,.localdomain.com,192.168.0.0/16,10.0.0.0/8,172.16.0.0/12"
|
||||
echo "Enabled"
|
||||
fi
|
||||
}
|
||||
|
||||
open() {
|
||||
test -e $1 || return 1
|
||||
nohup xdg-open $1 1>/dev/null 2>&1 &
|
||||
}
|
||||
|
||||
split-file() {
|
||||
test -e "$1" || return 1
|
||||
local _size="${2:-1G}"
|
||||
|
||||
if [ -d "$1" ]; then
|
||||
(mkdir "$1.tar.gz.splitted" && cd "$1.tar.gz.splitted" && tar -cz "../$1" | split -d -b "$_size")
|
||||
else
|
||||
(mkdir "$1.splitted" && cd "$1.splitted" && split -d -b "$_size" "../$1")
|
||||
fi
|
||||
}
|
||||
|
||||
json() {
|
||||
if [ -t 0 ]; then # argument
|
||||
python -m json.tool <<< "$*"
|
||||
else # pipe
|
||||
python -m json.tool
|
||||
fi
|
||||
}
|
||||
|
||||
_get_full_file_extension() {
|
||||
local filename
|
||||
filename=$(basename "$1")
|
||||
if [ "${filename:0:1}" = "." ]; then
|
||||
filename="${filename:1}"
|
||||
fi
|
||||
echo ${filename#*.}
|
||||
}
|
||||
|
||||
rmt() {
|
||||
local TRASH
|
||||
TRASH=~/.trash
|
||||
|
||||
local filename
|
||||
for filename in $*
|
||||
do
|
||||
local filename_out_path="${TRASH}$(realpath "$filename")"
|
||||
mkdir -p "$(dirname "$filename_out_path")"
|
||||
mv "$filename" "${filename_out_path}_$(date +%s)"
|
||||
done
|
||||
}
|
||||
|
||||
showtips() {
|
||||
TIPS_DIR="$HOME/.tips"
|
||||
|
||||
if [ ! -d "$TIPS_DIR" ]; then
|
||||
mkdir "$TIPS_DIR" 2>/dev/null
|
||||
git init "$TIPS_DIR"
|
||||
fi
|
||||
|
||||
cat "$TIPS_DIR"/* 2>/dev/null
|
||||
return 0
|
||||
}
|
||||
|
||||
most-often-commands() {
|
||||
history 0 | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn
|
||||
}
|
||||
|
||||
# calculator
|
||||
= () {
|
||||
echo "$*" | bc -l
|
||||
}
|
||||
|
||||
# Disable tmux on remote machine
|
||||
ssht() {
|
||||
ssh -t "$1" 'TMUX=NO $SHELL -l'
|
||||
}
|
||||
94
home/user/.config/bash/prompt
Normal file
94
home/user/.config/bash/prompt
Normal file
@ -0,0 +1,94 @@
|
||||
|
||||
parse_git_branch() {
|
||||
|
||||
if ! [ -x "$(command -v git)" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
local branch status
|
||||
|
||||
# current branch
|
||||
branch="$(git branch --show-current 2> /dev/null)"
|
||||
|
||||
# current status
|
||||
# M = modified
|
||||
# A = added
|
||||
# D = deleted
|
||||
# R = renamed
|
||||
# C = copied
|
||||
# U = updated but unmerged
|
||||
|
||||
status="$(git status -s 2>/dev/null | cut -c 1 | sort -u | tr -d " \n?")"
|
||||
|
||||
if [ -n "$status" ]; then
|
||||
status="-[$status]"
|
||||
fi
|
||||
|
||||
if [[ -n "$branch" ]]; then
|
||||
echo "($branch)$status"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
virtualenv_info() {
|
||||
|
||||
# Get Virtual Env
|
||||
if [[ -n "$VIRTUAL_ENV" ]]; then
|
||||
# Strip out the path and just leave the env name
|
||||
echo "($(basename "$VIRTUAL_ENV"))"
|
||||
fi
|
||||
}
|
||||
|
||||
rightprompt()
|
||||
{
|
||||
if [[ $1 -ne 0 ]]; then
|
||||
printf "%*s" $COLUMNS "$1 ⨯"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
export PROMPT_COMMAND=__prompt_command
|
||||
|
||||
__prompt_command() {
|
||||
|
||||
local EXIT=${PIPESTATUS[-1]}
|
||||
|
||||
close_color='\[\e[m\]'
|
||||
red_color='\[\033[1;31m\]'
|
||||
|
||||
prompt_color='\[\033[;32m\]'
|
||||
info_color='\[\033[1;34m\]'
|
||||
prompt_symbol='@'
|
||||
end_symbol='$'
|
||||
|
||||
|
||||
if [ "$EUID" -eq 0 ]; then # Change prompt colors and symbols for root user
|
||||
prompt_color='\[\033[;94m\]'
|
||||
info_color='\[\033[1;31m\]'
|
||||
end_symbol='#'
|
||||
fi
|
||||
|
||||
|
||||
if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
|
||||
prompt_symbol='📡'
|
||||
fi
|
||||
|
||||
|
||||
export VIRTUAL_ENV_DISABLE_PROMPT=1
|
||||
|
||||
|
||||
local VENV_ BRANCH_ TERMINAL_NAME
|
||||
VENV_="\$(virtualenv_info)"
|
||||
BRANCH_="\$(parse_git_branch)"
|
||||
|
||||
TERMINAL_NAME=${0%%/*}
|
||||
TERMINAL_NAME="\[\e]2;${TERMINAL_NAME^^}\a\]"
|
||||
|
||||
if [ "$EXIT" != 0 ]; then
|
||||
PS1="$TERMINAL_NAME\n$prompt_color┌─${VENV_}─($close_color$info_color\u$prompt_symbol\H$close_color$prompt_color)-[$close_color\w$prompt_color]$close_color $red_color${BRANCH_}$close_color\n\[$(tput sc; rightprompt $EXIT; tput rc)\]$prompt_color└─$close_color$info_color$end_symbol$close_color "
|
||||
else
|
||||
PS1="$TERMINAL_NAME\n$prompt_color┌─${VENV_}─($close_color$info_color\u$prompt_symbol\H$close_color$prompt_color)-[$close_color\w$prompt_color]$close_color $red_color${BRANCH_}$close_color\n$prompt_color└─$close_color$info_color$end_symbol$close_color "
|
||||
fi
|
||||
|
||||
PS2="> "
|
||||
}
|
||||
12
home/user/.config/bash/shopt
Normal file
12
home/user/.config/bash/shopt
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
## Misc
|
||||
shopt -s histappend ## Appends hist on exit
|
||||
shopt -s cmdhist ## Save multi-line hist as one line
|
||||
shopt -s checkwinsize ## Update col/lines after commands
|
||||
|
||||
### Completion
|
||||
shopt -s cdspell ## Fixes minor spelling errors in cd paths
|
||||
shopt -s no_empty_cmd_completion ## Stops empty line tab comp
|
||||
shopt -s dirspell 2>/dev/null ## Tab comp can fix dir name typos
|
||||
|
||||
bind '"\e."':yank-last-arg
|
||||
19
home/user/.config/bash/sourcer
Normal file
19
home/user/.config/bash/sourcer
Normal file
@ -0,0 +1,19 @@
|
||||
_so() {
|
||||
[ -r "$1" ] && [ -f "$1" ] && source "$1"
|
||||
}
|
||||
|
||||
if [[ $0 == *bash ]]; then
|
||||
_so "$HOME/.config/bash/export"
|
||||
_so "$HOME/.config/bash/shopt"
|
||||
fi
|
||||
|
||||
if [[ $- == *i* ]]; then
|
||||
_so "$HOME/.config/bash/prompt"
|
||||
_so "$HOME/.config/bash/aliases"
|
||||
_so "$HOME/.config/bash/functions"
|
||||
_so "$HOME/.config/bash/completion"
|
||||
_so "$HOME/.config/bash/hosts/$HOSTNAME"
|
||||
fi
|
||||
|
||||
|
||||
_sod "$HOME/.config/bash/bashrc.d"
|
||||
@ -1,754 +0,0 @@
|
||||
# set to 1 to enable 64bits target by default (32bit is the default)
|
||||
set $64BITS = 1
|
||||
|
||||
set confirm off
|
||||
set verbose off
|
||||
set prompt \033[31mgdb$ \033[0m
|
||||
|
||||
set output-radix 0x10
|
||||
set input-radix 0x10
|
||||
|
||||
# These make gdb never pause in its output
|
||||
set height 0
|
||||
set width 0
|
||||
|
||||
|
||||
|
||||
# _____________breakpoint aliases_____________
|
||||
define bpl
|
||||
info breakpoints
|
||||
end
|
||||
document bpl
|
||||
List all breakpoints.
|
||||
end
|
||||
|
||||
define bp
|
||||
if $argc != 1
|
||||
help bp
|
||||
else
|
||||
break $arg0
|
||||
end
|
||||
end
|
||||
document bp
|
||||
Set breakpoint.
|
||||
Usage: bp LOCATION
|
||||
LOCATION may be a line number, function name, or "*" and an address.
|
||||
|
||||
To break on a symbol you must enclose symbol name inside "".
|
||||
Example:
|
||||
bp "[NSControl stringValue]"
|
||||
Or else you can use directly the break command (break [NSControl stringValue])
|
||||
end
|
||||
|
||||
|
||||
define bpc
|
||||
if $argc != 1
|
||||
help bpc
|
||||
else
|
||||
clear $arg0
|
||||
end
|
||||
end
|
||||
document bpc
|
||||
Clear breakpoint.
|
||||
Usage: bpc LOCATION
|
||||
LOCATION may be a line number, function name, or "*" and an address.
|
||||
end
|
||||
|
||||
|
||||
define bpe
|
||||
if $argc != 1
|
||||
help bpe
|
||||
else
|
||||
enable $arg0
|
||||
end
|
||||
end
|
||||
document bpe
|
||||
Enable breakpoint with number NUM.
|
||||
Usage: bpe NUM
|
||||
end
|
||||
|
||||
|
||||
define bpd
|
||||
if $argc != 1
|
||||
help bpd
|
||||
else
|
||||
disable $arg0
|
||||
end
|
||||
end
|
||||
document bpd
|
||||
Disable breakpoint with number NUM.
|
||||
Usage: bpd NUM
|
||||
end
|
||||
|
||||
|
||||
define bpt
|
||||
if $argc != 1
|
||||
help bpt
|
||||
else
|
||||
tbreak $arg0
|
||||
end
|
||||
end
|
||||
document bpt
|
||||
Set a temporary breakpoint.
|
||||
Will be deleted when hit!
|
||||
Usage: bpt LOCATION
|
||||
LOCATION may be a line number, function name, or "*" and an address.
|
||||
end
|
||||
|
||||
|
||||
define bpm
|
||||
if $argc != 1
|
||||
help bpm
|
||||
else
|
||||
awatch $arg0
|
||||
end
|
||||
end
|
||||
document bpm
|
||||
Set a read/write breakpoint on EXPRESSION, e.g. *address.
|
||||
Usage: bpm EXPRESSION
|
||||
end
|
||||
|
||||
|
||||
define bhb
|
||||
if $argc != 1
|
||||
help bhb
|
||||
else
|
||||
hb $arg0
|
||||
end
|
||||
end
|
||||
document bhb
|
||||
Set hardware assisted breakpoint.
|
||||
Usage: bhb LOCATION
|
||||
LOCATION may be a line number, function name, or "*" and an address.
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
# ______________process information____________
|
||||
define argv
|
||||
show args
|
||||
end
|
||||
document argv
|
||||
Print program arguments.
|
||||
end
|
||||
|
||||
|
||||
define stack
|
||||
if $argc == 0
|
||||
info stack
|
||||
end
|
||||
if $argc == 1
|
||||
info stack $arg0
|
||||
end
|
||||
if $argc > 1
|
||||
help stack
|
||||
end
|
||||
end
|
||||
document stack
|
||||
Print backtrace of the call stack, or innermost COUNT frames.
|
||||
Usage: stack <COUNT>
|
||||
end
|
||||
|
||||
|
||||
define frame
|
||||
info frame
|
||||
info args
|
||||
info locals
|
||||
end
|
||||
document frame
|
||||
Print stack frame.
|
||||
end
|
||||
|
||||
|
||||
define flags
|
||||
# OF (overflow) flag
|
||||
if (($eflags >> 0xB) & 1)
|
||||
printf "O "
|
||||
set $_of_flag = 1
|
||||
else
|
||||
printf "o "
|
||||
set $_of_flag = 0
|
||||
end
|
||||
if (($eflags >> 0xA) & 1)
|
||||
printf "D "
|
||||
else
|
||||
printf "d "
|
||||
end
|
||||
if (($eflags >> 9) & 1)
|
||||
printf "I "
|
||||
else
|
||||
printf "i "
|
||||
end
|
||||
if (($eflags >> 8) & 1)
|
||||
printf "T "
|
||||
else
|
||||
printf "t "
|
||||
end
|
||||
# SF (sign) flag
|
||||
if (($eflags >> 7) & 1)
|
||||
printf "S "
|
||||
set $_sf_flag = 1
|
||||
else
|
||||
printf "s "
|
||||
set $_sf_flag = 0
|
||||
end
|
||||
# ZF (zero) flag
|
||||
if (($eflags >> 6) & 1)
|
||||
printf "Z "
|
||||
set $_zf_flag = 1
|
||||
else
|
||||
printf "z "
|
||||
set $_zf_flag = 0
|
||||
end
|
||||
if (($eflags >> 4) & 1)
|
||||
printf "A "
|
||||
else
|
||||
printf "a "
|
||||
end
|
||||
# PF (parity) flag
|
||||
if (($eflags >> 2) & 1)
|
||||
printf "P "
|
||||
set $_pf_flag = 1
|
||||
else
|
||||
printf "p "
|
||||
set $_pf_flag = 0
|
||||
end
|
||||
# CF (carry) flag
|
||||
if ($eflags & 1)
|
||||
printf "C "
|
||||
set $_cf_flag = 1
|
||||
else
|
||||
printf "c "
|
||||
set $_cf_flag = 0
|
||||
end
|
||||
printf "\n"
|
||||
end
|
||||
document flags
|
||||
Print flags register.
|
||||
end
|
||||
|
||||
|
||||
define eflags
|
||||
printf " OF <%d> DF <%d> IF <%d> TF <%d>",\
|
||||
(($eflags >> 0xB) & 1), (($eflags >> 0xA) & 1), \
|
||||
(($eflags >> 9) & 1), (($eflags >> 8) & 1)
|
||||
printf " SF <%d> ZF <%d> AF <%d> PF <%d> CF <%d>\n",\
|
||||
(($eflags >> 7) & 1), (($eflags >> 6) & 1),\
|
||||
(($eflags >> 4) & 1), (($eflags >> 2) & 1), ($eflags & 1)
|
||||
printf " ID <%d> VIP <%d> VIF <%d> AC <%d>",\
|
||||
(($eflags >> 0x15) & 1), (($eflags >> 0x14) & 1), \
|
||||
(($eflags >> 0x13) & 1), (($eflags >> 0x12) & 1)
|
||||
printf " VM <%d> RF <%d> NT <%d> IOPL <%d>\n",\
|
||||
(($eflags >> 0x11) & 1), (($eflags >> 0x10) & 1),\
|
||||
(($eflags >> 0xE) & 1), (($eflags >> 0xC) & 3)
|
||||
end
|
||||
document eflags
|
||||
Print eflags register.
|
||||
end
|
||||
|
||||
|
||||
define reg
|
||||
if ($64BITS == 1)
|
||||
# 64bits stuff
|
||||
printf " "
|
||||
echo \033[32m
|
||||
printf "RAX:"
|
||||
echo \033[0m
|
||||
printf " 0x%016lX ", $rax
|
||||
echo \033[32m
|
||||
printf "RBX:"
|
||||
echo \033[0m
|
||||
printf " 0x%016lX ", $rbx
|
||||
echo \033[32m
|
||||
printf "RCX:"
|
||||
echo \033[0m
|
||||
printf " 0x%016lX ", $rcx
|
||||
echo \033[32m
|
||||
printf "RDX:"
|
||||
echo \033[0m
|
||||
printf " 0x%016lX ", $rdx
|
||||
echo \033[1m\033[4m\033[31m
|
||||
flags
|
||||
echo \033[0m
|
||||
printf " "
|
||||
echo \033[32m
|
||||
printf "RSI:"
|
||||
echo \033[0m
|
||||
printf " 0x%016lX ", $rsi
|
||||
echo \033[32m
|
||||
printf "RDI:"
|
||||
echo \033[0m
|
||||
printf " 0x%016lX ", $rdi
|
||||
echo \033[32m
|
||||
printf "RBP:"
|
||||
echo \033[0m
|
||||
printf " 0x%016lX ", $rbp
|
||||
echo \033[32m
|
||||
printf "RSP:"
|
||||
echo \033[0m
|
||||
printf " 0x%016lX ", $rsp
|
||||
echo \033[32m
|
||||
printf "RIP:"
|
||||
echo \033[0m
|
||||
printf " 0x%016lX\n ", $rip
|
||||
echo \033[32m
|
||||
printf "R8 :"
|
||||
echo \033[0m
|
||||
printf " 0x%016lX ", $r8
|
||||
echo \033[32m
|
||||
printf "R9 :"
|
||||
echo \033[0m
|
||||
printf " 0x%016lX ", $r9
|
||||
echo \033[32m
|
||||
printf "R10:"
|
||||
echo \033[0m
|
||||
printf " 0x%016lX ", $r10
|
||||
echo \033[32m
|
||||
printf "R11:"
|
||||
echo \033[0m
|
||||
printf " 0x%016lX ", $r11
|
||||
echo \033[32m
|
||||
printf "R12:"
|
||||
echo \033[0m
|
||||
printf " 0x%016lX\n ", $r12
|
||||
echo \033[32m
|
||||
printf "R13:"
|
||||
echo \033[0m
|
||||
printf " 0x%016lX ", $r13
|
||||
echo \033[32m
|
||||
printf "R14:"
|
||||
echo \033[0m
|
||||
printf " 0x%016lX ", $r14
|
||||
echo \033[32m
|
||||
printf "R15:"
|
||||
echo \033[0m
|
||||
printf " 0x%016lX\n ", $r15
|
||||
echo \033[32m
|
||||
printf "CS:"
|
||||
echo \033[0m
|
||||
printf " %04X ", $cs
|
||||
echo \033[32m
|
||||
printf "DS:"
|
||||
echo \033[0m
|
||||
printf " %04X ", $ds
|
||||
echo \033[32m
|
||||
printf "ES:"
|
||||
echo \033[0m
|
||||
printf " %04X ", $es
|
||||
echo \033[32m
|
||||
printf "FS:"
|
||||
echo \033[0m
|
||||
printf " %04X ", $fs
|
||||
echo \033[32m
|
||||
printf "GS:"
|
||||
echo \033[0m
|
||||
printf " %04X ", $gs
|
||||
echo \033[32m
|
||||
printf "SS:"
|
||||
echo \033[0m
|
||||
printf " %04X", $ss
|
||||
echo \033[0m
|
||||
# 32bits stuff
|
||||
else
|
||||
printf " "
|
||||
echo \033[32m
|
||||
printf "EAX:"
|
||||
echo \033[0m
|
||||
printf " 0x%08X ", $eax
|
||||
echo \033[32m
|
||||
printf "EBX:"
|
||||
echo \033[0m
|
||||
printf " 0x%08X ", $ebx
|
||||
echo \033[32m
|
||||
printf "ECX:"
|
||||
echo \033[0m
|
||||
printf " 0x%08X ", $ecx
|
||||
echo \033[32m
|
||||
printf "EDX:"
|
||||
echo \033[0m
|
||||
printf " 0x%08X ", $edx
|
||||
echo \033[1m\033[4m\033[31m
|
||||
flags
|
||||
echo \033[0m
|
||||
printf " "
|
||||
echo \033[32m
|
||||
printf "ESI:"
|
||||
echo \033[0m
|
||||
printf " 0x%08X ", $esi
|
||||
echo \033[32m
|
||||
printf "EDI:"
|
||||
echo \033[0m
|
||||
printf " 0x%08X ", $edi
|
||||
echo \033[32m
|
||||
printf "EBP:"
|
||||
echo \033[0m
|
||||
printf " 0x%08X ", $ebp
|
||||
echo \033[32m
|
||||
printf "ESP:"
|
||||
echo \033[0m
|
||||
printf " 0x%08X ", $esp
|
||||
echo \033[32m
|
||||
printf "EIP:"
|
||||
echo \033[0m
|
||||
printf " 0x%08X\n ", $eip
|
||||
echo \033[32m
|
||||
printf "CS:"
|
||||
echo \033[0m
|
||||
printf " %04X ", $cs
|
||||
echo \033[32m
|
||||
printf "DS:"
|
||||
echo \033[0m
|
||||
printf " %04X ", $ds
|
||||
echo \033[32m
|
||||
printf "ES:"
|
||||
echo \033[0m
|
||||
printf " %04X ", $es
|
||||
echo \033[32m
|
||||
printf "FS:"
|
||||
echo \033[0m
|
||||
printf " %04X ", $fs
|
||||
echo \033[32m
|
||||
printf "GS:"
|
||||
echo \033[0m
|
||||
printf " %04X ", $gs
|
||||
echo \033[32m
|
||||
printf "SS:"
|
||||
echo \033[0m
|
||||
printf " %04X", $ss
|
||||
echo \033[0m
|
||||
end
|
||||
# call smallregisters
|
||||
smallregisters
|
||||
# display conditional jump routine
|
||||
if ($64BITS == 1)
|
||||
printf "\t\t\t\t"
|
||||
end
|
||||
dumpjump
|
||||
printf "\n"
|
||||
end
|
||||
document reg
|
||||
Print CPU registers.
|
||||
end
|
||||
|
||||
define smallregisters
|
||||
if ($64BITS == 1)
|
||||
#64bits stuff
|
||||
# from rax
|
||||
set $eax = $rax & 0xffffffff
|
||||
set $ax = $rax & 0xffff
|
||||
set $al = $ax & 0xff
|
||||
set $ah = $ax >> 8
|
||||
# from rbx
|
||||
set $bx = $rbx & 0xffff
|
||||
set $bl = $bx & 0xff
|
||||
set $bh = $bx >> 8
|
||||
# from rcx
|
||||
set $ecx = $rcx & 0xffffffff
|
||||
set $cx = $rcx & 0xffff
|
||||
set $cl = $cx & 0xff
|
||||
set $ch = $cx >> 8
|
||||
# from rdx
|
||||
set $edx = $rdx & 0xffffffff
|
||||
set $dx = $rdx & 0xffff
|
||||
set $dl = $dx & 0xff
|
||||
set $dh = $dx >> 8
|
||||
# from rsi
|
||||
set $esi = $rsi & 0xffffffff
|
||||
set $si = $rsi & 0xffff
|
||||
# from rdi
|
||||
set $edi = $rdi & 0xffffffff
|
||||
set $di = $rdi & 0xffff
|
||||
#32 bits stuff
|
||||
else
|
||||
# from eax
|
||||
set $ax = $eax & 0xffff
|
||||
set $al = $ax & 0xff
|
||||
set $ah = $ax >> 8
|
||||
# from ebx
|
||||
set $bx = $ebx & 0xffff
|
||||
set $bl = $bx & 0xff
|
||||
set $bh = $bx >> 8
|
||||
# from ecx
|
||||
set $cx = $ecx & 0xffff
|
||||
set $cl = $cx & 0xff
|
||||
set $ch = $cx >> 8
|
||||
# from edx
|
||||
set $dx = $edx & 0xffff
|
||||
set $dl = $dx & 0xff
|
||||
set $dh = $dx >> 8
|
||||
# from esi
|
||||
set $si = $esi & 0xffff
|
||||
# from edi
|
||||
set $di = $edi & 0xffff
|
||||
end
|
||||
|
||||
end
|
||||
document smallregisters
|
||||
Create the 16 and 8 bit cpu registers (gdb doesn't have them by default)
|
||||
And 32bits if we are dealing with 64bits binaries
|
||||
end
|
||||
|
||||
define func
|
||||
if $argc == 0
|
||||
info functions
|
||||
end
|
||||
if $argc == 1
|
||||
info functions $arg0
|
||||
end
|
||||
if $argc > 1
|
||||
help func
|
||||
end
|
||||
end
|
||||
document func
|
||||
Print all function names in target, or those matching REGEXP.
|
||||
Usage: func <REGEXP>
|
||||
end
|
||||
|
||||
|
||||
define var
|
||||
if $argc == 0
|
||||
info variables
|
||||
end
|
||||
if $argc == 1
|
||||
info variables $arg0
|
||||
end
|
||||
if $argc > 1
|
||||
help var
|
||||
end
|
||||
end
|
||||
document var
|
||||
Print all global and static variable names (symbols), or those matching REGEXP.
|
||||
Usage: var <REGEXP>
|
||||
end
|
||||
|
||||
|
||||
define lib
|
||||
info sharedlibrary
|
||||
end
|
||||
document lib
|
||||
Print shared libraries linked to target.
|
||||
end
|
||||
|
||||
|
||||
define sig
|
||||
if $argc == 0
|
||||
info signals
|
||||
end
|
||||
if $argc == 1
|
||||
info signals $arg0
|
||||
end
|
||||
if $argc > 1
|
||||
help sig
|
||||
end
|
||||
end
|
||||
document sig
|
||||
Print what debugger does when program gets various signals.
|
||||
Specify a SIGNAL as argument to print info on that signal only.
|
||||
Usage: sig <SIGNAL>
|
||||
end
|
||||
|
||||
|
||||
define threads
|
||||
info threads
|
||||
end
|
||||
document threads
|
||||
Print threads in target.
|
||||
end
|
||||
|
||||
|
||||
define dis
|
||||
if $argc == 0
|
||||
disassemble
|
||||
end
|
||||
if $argc == 1
|
||||
disassemble $arg0
|
||||
end
|
||||
if $argc == 2
|
||||
disassemble $arg0 $arg1
|
||||
end
|
||||
if $argc > 2
|
||||
help dis
|
||||
end
|
||||
end
|
||||
document dis
|
||||
Disassemble a specified section of memory.
|
||||
Default is to disassemble the function surrounding the PC (program counter)
|
||||
of selected frame. With one argument, ADDR1, the function surrounding this
|
||||
address is dumped. Two arguments are taken as a range of memory to dump.
|
||||
Usage: dis <ADDR1> <ADDR2>
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
# __________hex/ascii dump an address_________
|
||||
define ascii_char
|
||||
if $argc != 1
|
||||
help ascii_char
|
||||
else
|
||||
# thanks elaine :)
|
||||
set $_c = *(unsigned char *)($arg0)
|
||||
if ($_c < 0x20 || $_c > 0x7E)
|
||||
printf "."
|
||||
else
|
||||
printf "%c", $_c
|
||||
end
|
||||
end
|
||||
end
|
||||
document ascii_char
|
||||
Print ASCII value of byte at address ADDR.
|
||||
Print "." if the value is unprintable.
|
||||
Usage: ascii_char ADDR
|
||||
end
|
||||
|
||||
|
||||
define hex_quad
|
||||
if $argc != 1
|
||||
help hex_quad
|
||||
else
|
||||
printf "%02X %02X %02X %02X %02X %02X %02X %02X", \
|
||||
*(unsigned char*)($arg0), *(unsigned char*)($arg0 + 1), \
|
||||
*(unsigned char*)($arg0 + 2), *(unsigned char*)($arg0 + 3), \
|
||||
*(unsigned char*)($arg0 + 4), *(unsigned char*)($arg0 + 5), \
|
||||
*(unsigned char*)($arg0 + 6), *(unsigned char*)($arg0 + 7)
|
||||
end
|
||||
end
|
||||
document hex_quad
|
||||
Print eight hexadecimal bytes starting at address ADDR.
|
||||
Usage: hex_quad ADDR
|
||||
end
|
||||
|
||||
define hexdump
|
||||
if $argc != 1
|
||||
help hexdump
|
||||
else
|
||||
echo \033[1m
|
||||
if ($64BITS == 1)
|
||||
printf "0x%016lX : ", $arg0
|
||||
else
|
||||
printf "0x%08X : ", $arg0
|
||||
end
|
||||
echo \033[0m
|
||||
hex_quad $arg0
|
||||
echo \033[1m
|
||||
printf " - "
|
||||
echo \033[0m
|
||||
hex_quad $arg0+8
|
||||
printf " "
|
||||
echo \033[1m
|
||||
ascii_char $arg0+0x0
|
||||
ascii_char $arg0+0x1
|
||||
ascii_char $arg0+0x2
|
||||
ascii_char $arg0+0x3
|
||||
ascii_char $arg0+0x4
|
||||
ascii_char $arg0+0x5
|
||||
ascii_char $arg0+0x6
|
||||
ascii_char $arg0+0x7
|
||||
ascii_char $arg0+0x8
|
||||
ascii_char $arg0+0x9
|
||||
ascii_char $arg0+0xA
|
||||
ascii_char $arg0+0xB
|
||||
ascii_char $arg0+0xC
|
||||
ascii_char $arg0+0xD
|
||||
ascii_char $arg0+0xE
|
||||
ascii_char $arg0+0xF
|
||||
echo \033[0m
|
||||
printf "\n"
|
||||
end
|
||||
end
|
||||
document hexdump
|
||||
Display a 16-byte hex/ASCII dump of memory at address ADDR.
|
||||
Usage: hexdump ADDR
|
||||
end
|
||||
|
||||
|
||||
# _______________data window__________________
|
||||
define ddump
|
||||
if $argc != 1
|
||||
help ddump
|
||||
else
|
||||
echo \033[34m
|
||||
if ($64BITS == 1)
|
||||
printf "[0x%04X:0x%016lX]", $ds, $data_addr
|
||||
else
|
||||
printf "[0x%04X:0x%08X]", $ds, $data_addr
|
||||
end
|
||||
echo \033[34m
|
||||
printf "------------------------"
|
||||
printf "-------------------------------"
|
||||
if ($64BITS == 1)
|
||||
printf "-------------------------------------"
|
||||
end
|
||||
|
||||
echo \033[1;34m
|
||||
printf "[data]\n"
|
||||
echo \033[0m
|
||||
set $_count = 0
|
||||
while ($_count < $arg0)
|
||||
set $_i = ($_count * 0x10)
|
||||
hexdump $data_addr+$_i
|
||||
set $_count++
|
||||
end
|
||||
end
|
||||
end
|
||||
document ddump
|
||||
Display NUM lines of hexdump for address in $data_addr global variable.
|
||||
Usage: ddump NUM
|
||||
end
|
||||
|
||||
|
||||
define dd
|
||||
if $argc != 1
|
||||
help dd
|
||||
else
|
||||
if ((($arg0 >> 0x18) == 0x40) || (($arg0 >> 0x18) == 0x08) || (($arg0 >> 0x18) == 0xBF))
|
||||
set $data_addr = $arg0
|
||||
ddump 0x10
|
||||
else
|
||||
printf "Invalid address: %08X\n", $arg0
|
||||
end
|
||||
end
|
||||
end
|
||||
document dd
|
||||
Display 16 lines of a hex dump of address starting at ADDR.
|
||||
Usage: dd ADDR
|
||||
end
|
||||
|
||||
|
||||
define datawin
|
||||
if ($64BITS == 1)
|
||||
if ((($rsi >> 0x18) == 0x40) || (($rsi >> 0x18) == 0x08) || (($rsi >> 0x18) == 0xBF))
|
||||
set $data_addr = $rsi
|
||||
else
|
||||
if ((($rdi >> 0x18) == 0x40) || (($rdi >> 0x18) == 0x08) || (($rdi >> 0x18) == 0xBF))
|
||||
set $data_addr = $rdi
|
||||
else
|
||||
if ((($rax >> 0x18) == 0x40) || (($rax >> 0x18) == 0x08) || (($rax >> 0x18) == 0xBF))
|
||||
set $data_addr = $rax
|
||||
else
|
||||
set $data_addr = $rsp
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
if ((($esi >> 0x18) == 0x40) || (($esi >> 0x18) == 0x08) || (($esi >> 0x18) == 0xBF))
|
||||
set $data_addr = $esi
|
||||
else
|
||||
if ((($edi >> 0x18) == 0x40) || (($edi >> 0x18) == 0x08) || (($edi >> 0x18) == 0xBF))
|
||||
set $data_addr = $edi
|
||||
else
|
||||
if ((($eax >> 0x18) == 0x40) || (($eax >> 0x18) == 0x08) || (($eax >> 0x18) == 0xBF))
|
||||
set $data_addr = $eax
|
||||
else
|
||||
set $data_addr = $esp
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
ddump $CONTEXTSIZE_DATA
|
||||
end
|
||||
document datawin
|
||||
Display valid address from one register in data window.
|
||||
Registers to choose are: esi, edi, eax, or esp.
|
||||
end
|
||||
@ -1,63 +0,0 @@
|
||||
# vim: ft=gitconfig
|
||||
|
||||
|
||||
[alias]
|
||||
a = "!ga"
|
||||
u = "!git diff --name-only --cached | fzf -1 -0 -m --bind load:last --preview 'git diff --staged --color=always {1}' | xargs -r git restore --staged"
|
||||
msg = log -1 --pretty=%B
|
||||
d = diff
|
||||
di = diff
|
||||
ds = diff --staged
|
||||
dno = diff --name-only
|
||||
dw = diff --word-diff=color
|
||||
dws = diff --word-diff=color --staged
|
||||
sw = switch
|
||||
swl = switch -
|
||||
swb = switch -c
|
||||
swc = switch -c
|
||||
co = checkout
|
||||
col = checkout @{-1}
|
||||
cob = checkout -b
|
||||
ci = commit
|
||||
cia = commit --all
|
||||
amend = commit --amend --no-edit
|
||||
amenda = commit --all --amend --no-edit
|
||||
fuck = commit --amend
|
||||
uncommit = reset --soft HEAD~1
|
||||
untrack = rm --cache --
|
||||
cim = "!_m() { git commit -m \"$*\"; }; _m"
|
||||
cima = "!_m() { git commit -am \"$*\"; }; _m"
|
||||
ps = "!git push origin $(git rev-parse --abbrev-ref HEAD)"
|
||||
pst = "!git push origin --tags"
|
||||
pl = "!git pull origin $(git rev-parse --abbrev-ref HEAD)"
|
||||
pr = "pull --rebase"
|
||||
s = status
|
||||
st = status
|
||||
br = branch
|
||||
bm = branch --merged
|
||||
bn = branch --no-merged
|
||||
hist = log --pretty=format:'%Cgreen%h %Creset%cd %Cblue[%cn](%G?) %Creset%s%C(yellow)%d%C(reset)' --graph --date=relative --decorate --color=always
|
||||
history = hist --all
|
||||
hs = hist -n 10
|
||||
hsa = hist -n 10 --all
|
||||
last = log -1 HEAD
|
||||
lastd = diff HEAD^ HEAD
|
||||
today = hist --since=midnight
|
||||
df = "!_m() { git log --pretty=format:'%h %cd [%cn] %s%d' --date=relative | fzf --bind \"enter:execute(git diff --color=always $@ {1}^ {1} | ${PAGER})\" --preview-window=65% --preview=\"git diff --color=always $@ {1}^ {1}\"; }; _m"
|
||||
type = cat-file -t
|
||||
dump = cat-file -p
|
||||
unstage = "reset HEAD --"
|
||||
count = "rev-list --count --all"
|
||||
tags = "for-each-ref --sort=-creatordate --format '%(refname:strip=2)' refs/tags"
|
||||
initci = "commit --allow-empty -m 'Initial commit'"
|
||||
|
||||
# edit conflicted file on merge
|
||||
edit-unmerged = "!$EDITOR $(git ls-files --unmerged | cut -f2 | sort -u)"
|
||||
|
||||
# add conflicted file on merge
|
||||
add-unmerged = "!git add $(git ls-files --unmerged | cut -f2 | sort -u)"
|
||||
remove-remote-tag = "!f() { git tag -d $1 && git push origin :refs/tags/$1 }; f"
|
||||
aliases = "!git config -l | grep '^alias\\.' | cut -d. -f2-"
|
||||
|
||||
# git clone git://localhost/
|
||||
serve = daemon --verbose --export-all --base-path=.git --reuseaddr --strict-paths .git/
|
||||
@ -2,24 +2,23 @@
|
||||
excludesfile = ~/.config/git/ignore
|
||||
editor = "$EDITOR"
|
||||
pager = "$PAGER -+C -F"
|
||||
fileMode = true
|
||||
fileMode = false
|
||||
hooksPath = ~/.config/git/hooks
|
||||
whitespace = fix,trailing-space,cr-at-eol
|
||||
autocrlf = input
|
||||
quotepath = false
|
||||
|
||||
[i18n]
|
||||
commitEncoding = utf-8
|
||||
logOutputEncoding = utf-8
|
||||
|
||||
[init]
|
||||
defaultBranch = main
|
||||
defaultBranch = master
|
||||
|
||||
[push]
|
||||
default = current
|
||||
|
||||
[pull]
|
||||
rebase = false
|
||||
ff = only
|
||||
|
||||
[color]
|
||||
status = auto
|
||||
@ -38,25 +37,64 @@
|
||||
[apply]
|
||||
whitespace = fix
|
||||
|
||||
[rerere]
|
||||
enabled = true
|
||||
|
||||
[diff]
|
||||
mnemonicPrefix = true
|
||||
suppressBlankEmpty = true
|
||||
rename = copy
|
||||
submodule = short
|
||||
algorithm = histogram
|
||||
colormoved = default
|
||||
colormovedws = allow-indentation-change
|
||||
|
||||
[include]
|
||||
path = ~/.config/git/url-aliases
|
||||
path = ~/.config/git/aliases
|
||||
path = ~/.config/git/local
|
||||
[alias]
|
||||
a = "!git ls-files --exclude-standard -m --others -t | fzf -m --bind ctrl-a:toggle-all | cut -d' ' -f2 | xargs git add"
|
||||
d = diff
|
||||
ds = diff --staged
|
||||
dno = diff --name-only
|
||||
co = checkout
|
||||
ci = commit
|
||||
ps = "!git push origin $(git rev-parse --abbrev-ref HEAD)"
|
||||
pl = "!git pull origin $(git rev-parse --abbrev-ref HEAD)"
|
||||
st = status
|
||||
br = branch
|
||||
bm = branch --merged
|
||||
bn = branch --no-merged
|
||||
hist = log --pretty=format:\"%Cgreen%h %Creset%cd %Cblue[%cn](%G?) %Creset%s%C(yellow)%d%C(reset)\" --graph --date=relative --decorate --color=always
|
||||
history = hist --all
|
||||
hs = hist -n 10
|
||||
hsa = hist -n 10 --all
|
||||
last = log -1 HEAD
|
||||
today = hist --since=midnight
|
||||
df = "!git log --pretty=format:\"%h %cd [%cn] %s%d\" --date=relative | fzf +m | awk '{print $1}' | xargs -I {} git diff {}^ {}"
|
||||
type = cat-file -t
|
||||
dump = cat-file -p
|
||||
unstage = "reset HEAD --"
|
||||
|
||||
[filter "lfs"]
|
||||
clean = git-lfs clean -- %f
|
||||
smudge = git-lfs smudge -- %f
|
||||
process = git-lfs filter-process
|
||||
required = true
|
||||
# edit conflicted file on merge
|
||||
edit-unmerged = "!$EDITOR $(git ls-files --unmerged | cut -f2 | sort -u)"
|
||||
|
||||
# add conflicted file on merge
|
||||
add-unmerged = "!git add $(git ls-files --unmerged | cut -f2 | sort -u)"
|
||||
remove-remote-tag = "!f() { git tag -d $1 && git push origin :refs/tags/$1 }; f"
|
||||
|
||||
[github]
|
||||
user = "thek4n"
|
||||
email = "thek4n@yandex.ru"
|
||||
|
||||
[user]
|
||||
name = "thek4n"
|
||||
email = "thek4n@yandex.ru"
|
||||
signingkey = "thek4n"
|
||||
|
||||
[url "https://github.com/"]
|
||||
insteadOf = "gh:"
|
||||
|
||||
[url "git@github.com:"]
|
||||
pushInsteadOf = "https://github.com/"
|
||||
pushInsteadOf = "http://github.com/"
|
||||
pushInsteadOf = "gh:"
|
||||
|
||||
[url "https://gist.github.com/"]
|
||||
insteadOf = "gist:"
|
||||
|
||||
[url "git@gist.github.com:"]
|
||||
pushInsteadOf = "https://gist.github.com/"
|
||||
pushInsteadOf = "http://gist.github.com/"
|
||||
pushInsteadOf = "gist:"
|
||||
12
home/user/.config/git/hooks/pre-commit
Executable file
12
home/user/.config/git/hooks/pre-commit
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
if command -v makepkg >/dev/null && [ -e PKGBUILD ]; then
|
||||
if [ -e VERSION ]; then
|
||||
sed -i "s/pkgver=.\+/pkgver=$(cat VERSION)/" PKGBUILD
|
||||
git add PKGBUILD
|
||||
fi
|
||||
|
||||
makepkg --printsrcinfo > .SRCINFO
|
||||
git add .SRCINFO
|
||||
exit
|
||||
fi
|
||||
@ -12,45 +12,14 @@ venv
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
*.spec
|
||||
|
||||
.env
|
||||
*.env
|
||||
*.log
|
||||
*.bak
|
||||
*~
|
||||
|
||||
# db
|
||||
*.db
|
||||
db.sqlite3
|
||||
|
||||
|
||||
nohup.out
|
||||
|
||||
# cmake
|
||||
cmake_install.cmake
|
||||
CMakeCache.txt
|
||||
CMakeFiles
|
||||
|
||||
# build files
|
||||
*.a
|
||||
*.so
|
||||
*.o
|
||||
a.out
|
||||
*.exe
|
||||
*.ipk
|
||||
|
||||
build/
|
||||
dist/
|
||||
node_modules/
|
||||
|
||||
.tns
|
||||
|
||||
.autoenv.zsh
|
||||
.autoenv_leave.zsh
|
||||
|
||||
*.tar
|
||||
*.gz
|
||||
*.zip
|
||||
|
||||
|
||||
.redo/
|
||||
|
||||
@ -1,13 +0,0 @@
|
||||
# vim: ft=gitconfig
|
||||
|
||||
[github]
|
||||
user = "thek4n"
|
||||
email = "thek4n@yandex.ru"
|
||||
|
||||
[user]
|
||||
name = "thek4n"
|
||||
email = "thek4n@yandex.ru"
|
||||
signingkey = "thek4n"
|
||||
|
||||
[url "git@github.com:TheK4n/notes"]
|
||||
insteadOf = "git@github.com:TheK4n/notes"
|
||||
@ -1,41 +0,0 @@
|
||||
# vim: ft=gitconfig
|
||||
|
||||
# alias gh:=https://github.com/
|
||||
[url "https://github.com/"]
|
||||
insteadOf = "gh:"
|
||||
|
||||
# alias gist:=https://gist.github.com/
|
||||
[url "https://gist.github.com/"]
|
||||
insteadOf = "gist:"
|
||||
|
||||
# alias gl:=https://gitlab.com/
|
||||
[url "https://gitlab.com/"]
|
||||
insteadOf = "gl:"
|
||||
|
||||
# alias bb:=https://bitbucket.org/
|
||||
[url "https://bitbucket.org/"]
|
||||
insteadOf = "bb:"
|
||||
|
||||
|
||||
[url "git@github.com:"]
|
||||
pushInsteadOf = "https://github.com/"
|
||||
pushInsteadOf = "http://github.com/"
|
||||
pushInsteadOf = "git@github.com:"
|
||||
pushInsteadOf = "gh:"
|
||||
|
||||
[url "git@gist.github.com:"]
|
||||
pushInsteadOf = "https://gist.github.com/"
|
||||
pushInsteadOf = "http://gist.github.com/"
|
||||
pushInsteadOf = "gist:"
|
||||
|
||||
[url "git@gitlab.com:"]
|
||||
pushInsteadOf = "https://gitlab.com/"
|
||||
pushInsteadOf = "http://gitlab.com/"
|
||||
pushInsteadOf = "git@gitlab.com:"
|
||||
pushInsteadOf = "gl:"
|
||||
|
||||
; [url "https://github.com/"]
|
||||
; insteadOf = "git@github.com:"
|
||||
|
||||
[url "https://gitlab.com/"]
|
||||
insteadOf = "git@gitlab.com:"
|
||||
236
home/user/.config/i3/config
Normal file
236
home/user/.config/i3/config
Normal file
@ -0,0 +1,236 @@
|
||||
# screen layout
|
||||
exec --no-startup-id ~/.screenlayout/default.sh
|
||||
|
||||
for_window [tiling] border pixel 3
|
||||
smart_borders on
|
||||
|
||||
set $mod Mod4
|
||||
|
||||
# screensaver
|
||||
set $i3lock_cmd "i3lock -enf -c 1e1e1e"
|
||||
exec --no-startup-id xset +dpms dpms 600 0 0
|
||||
exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock -enf -c 1e1e1e
|
||||
|
||||
exec_always --no-startup-id xset r rate 250 100
|
||||
exec_always --no-startup-id setxkbmap -model pc105 -layout us,ru -option grp:win_space_toggle -option ctrl:nocaps
|
||||
|
||||
# wallpapers
|
||||
exec --no-startup-id nitrogen --restore; sleep 1; picom -b --config ~/.config/picom/picom.conf
|
||||
exec --no-startup-id hsetroot
|
||||
exec --no-startup-id feh --randomize --no-fehbg --bg-scale $HOME/.wallpaper/*
|
||||
|
||||
set $font_size 11
|
||||
font xft:FiraCode $font_size
|
||||
|
||||
# Use pactl to adjust volume in PulseAudio.
|
||||
set $refresh_i3status killall -SIGUSR1 i3status
|
||||
bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status
|
||||
bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status
|
||||
bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status
|
||||
|
||||
bindsym XF86AudioPlay exec playerctl play-pause
|
||||
bindsym XF86AudioPause exec playerctl play-pause
|
||||
bindsym XF86AudioNext exec playerctl next
|
||||
bindsym XF86AudioPrev exec playerctl previous
|
||||
|
||||
bindsym XF86MonBrightnessUp exec xbacklight -inc 20
|
||||
bindsym XF86MonBrightnessDown exec xbacklight -dec 20
|
||||
|
||||
|
||||
bindsym $mod+z exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ 0 ## Hold to talk
|
||||
bindsym --release $mod+z exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ 1 ## Release to mute
|
||||
|
||||
bindsym $mod+Shift+z exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status
|
||||
bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status
|
||||
|
||||
bindsym XF86PickupPhone exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ 0 ## Hold to talk
|
||||
bindsym --release XF86PickupPhone exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ 1 ## Release to mute
|
||||
|
||||
bindsym XF86Go exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ 0 ## Hold to talk, x1carb11
|
||||
bindsym --release XF86Go exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ 1 ## Release to mute, x1carb11
|
||||
|
||||
|
||||
bindsym $mod+XF86AudioMicMute exec --no-startup-id pactl list short sources | awk '/input.*RUNNING/ {system("pactl set-source-mute " $1 " toggle")}' ## Find and mute mics
|
||||
|
||||
|
||||
bindsym $mod+m exec i3-input -F 'mark %s' -l 1 -P 'Mark: '
|
||||
bindsym $mod+g exec i3-input -F '[con_mark="%s"] focus' -l 1 -P 'Goto: '
|
||||
|
||||
focus_follows_mouse no
|
||||
mouse_warping none
|
||||
|
||||
# start a terminal
|
||||
bindsym $mod+Return exec alacritty
|
||||
|
||||
# kill focused window
|
||||
bindsym $mod+Shift+q kill
|
||||
|
||||
bindsym $mod+d exec --no-startup-id rofi -show drun -m -1
|
||||
bindsym $mod+i exec --no-startup-id i3_switch_workspace.sh
|
||||
bindsym $mod+o exec --no-startup-id slm_rofi.sh
|
||||
bindsym $mod+p exec --no-startup-id power_rofi.sh
|
||||
|
||||
# change focus
|
||||
bindsym $mod+h focus left
|
||||
bindsym $mod+j focus down
|
||||
bindsym $mod+k focus up
|
||||
bindsym $mod+l focus right
|
||||
|
||||
# alternatively, you can use the cursor keys:
|
||||
bindsym $mod+Left focus left
|
||||
bindsym $mod+Down focus down
|
||||
bindsym $mod+Up focus up
|
||||
bindsym $mod+Right focus right
|
||||
|
||||
# move focused window
|
||||
bindsym $mod+Shift+h move left
|
||||
bindsym $mod+Shift+j move down
|
||||
bindsym $mod+Shift+k move up
|
||||
bindsym $mod+Shift+l move right
|
||||
|
||||
bindsym $mod+Ctrl+Shift+l move workspace to output right
|
||||
bindsym $mod+Ctrl+Shift+h move workspace to output left
|
||||
bindsym $mod+Ctrl+Shift+k move workspace to output up
|
||||
bindsym $mod+Ctrl+Shift+j move workspace to output down
|
||||
|
||||
# alternatively, you can use the cursor keys:
|
||||
bindsym $mod+Shift+Left move left
|
||||
bindsym $mod+Shift+Down move down
|
||||
bindsym $mod+Shift+Up move up
|
||||
bindsym $mod+Shift+Right move right
|
||||
|
||||
|
||||
# enter fullscreen mode for the focused container
|
||||
bindsym $mod+f fullscreen toggle
|
||||
|
||||
# change container layout (tabbed, toggle split)
|
||||
bindsym $mod+t layout tabbed
|
||||
bindsym $mod+v layout toggle split
|
||||
bindsym $mod+a focus parent
|
||||
|
||||
# toggle tiling / floating
|
||||
bindsym $mod+Shift+slash floating toggle
|
||||
|
||||
# change focus between tiling / floating windows
|
||||
bindsym $mod+slash focus mode_toggle
|
||||
|
||||
# Use Mouse+$mod to drag floating windows to their wanted position
|
||||
floating_modifier $mod
|
||||
|
||||
# Define names for default workspaces for which we configure key bindings later on.
|
||||
# We use variables to avoid repeating the names in multiple places.
|
||||
set $ws1 "1 Browser"
|
||||
set $ws2 "2 Code"
|
||||
set $ws3 "3 Code"
|
||||
set $ws4 "4"
|
||||
set $ws5 "5"
|
||||
set $ws6 "6"
|
||||
set $ws7 "7"
|
||||
set $ws8 "8💬Social"
|
||||
set $ws9 "9🎵Music"
|
||||
set $ws10 "10🍿Media"
|
||||
|
||||
# switch to workspace
|
||||
bindsym $mod+1 workspace number $ws1
|
||||
bindsym $mod+2 workspace number $ws2
|
||||
bindsym $mod+3 workspace number $ws3
|
||||
bindsym $mod+4 workspace number $ws4
|
||||
bindsym $mod+5 workspace number $ws5
|
||||
bindsym $mod+6 workspace number $ws6
|
||||
bindsym $mod+7 workspace number $ws7
|
||||
bindsym $mod+8 workspace number $ws8
|
||||
bindsym $mod+9 workspace number $ws9
|
||||
bindsym $mod+0 workspace number $ws10
|
||||
|
||||
# move focused container to workspace
|
||||
bindsym $mod+Shift+1 move container to workspace number $ws1
|
||||
bindsym $mod+Shift+2 move container to workspace number $ws2
|
||||
bindsym $mod+Shift+3 move container to workspace number $ws3
|
||||
bindsym $mod+Shift+4 move container to workspace number $ws4
|
||||
bindsym $mod+Shift+5 move container to workspace number $ws5
|
||||
bindsym $mod+Shift+6 move container to workspace number $ws6
|
||||
bindsym $mod+Shift+7 move container to workspace number $ws7
|
||||
bindsym $mod+Shift+8 move container to workspace number $ws8
|
||||
bindsym $mod+Shift+9 move container to workspace number $ws9
|
||||
bindsym $mod+Shift+0 move container to workspace number $ws10
|
||||
|
||||
bindsym $mod+u workspace prev
|
||||
bindsym $mod+Shift+u workspace next
|
||||
|
||||
# resize window (you can also use the mouse for that)
|
||||
bindsym $mod+r mode "resize"
|
||||
mode "resize" {
|
||||
bindsym h resize shrink width 10 px or 10 ppt
|
||||
bindsym j resize grow height 10 px or 10 ppt
|
||||
bindsym k resize shrink height 10 px or 10 ppt
|
||||
bindsym l resize grow width 10 px or 10 ppt
|
||||
|
||||
bindsym $mod+r mode "default"
|
||||
bindsym p mode "resize_precise"
|
||||
|
||||
bindsym Return mode "default"
|
||||
bindsym Escape mode "default"
|
||||
}
|
||||
mode "resize_precise" {
|
||||
bindsym h resize shrink width 1 px or 1 ppt
|
||||
bindsym j resize grow height 1 px or 1 ppt
|
||||
bindsym k resize shrink height 1 px or 1 ppt
|
||||
bindsym l resize grow width 1 px or 1 ppt
|
||||
|
||||
bindsym $mod+r mode "default"
|
||||
bindsym p mode "resize"
|
||||
|
||||
bindsym Return mode "default"
|
||||
bindsym Escape mode "default"
|
||||
}
|
||||
|
||||
set $exitmode "Power: [e]xit, [r]eboot, [s]hutdown, s[u]spend, [l]ock, [b]lack"
|
||||
mode $exitmode {
|
||||
bindsym e exit
|
||||
bindsym r exec reboot
|
||||
bindsym s exec shutdown -h now
|
||||
bindsym u exec systemctl suspend; mode "default"
|
||||
bindsym l exec $i3lock_cmd; mode "default"
|
||||
bindsym b exec convert canvas:none PNG:- | feh -YF -; mode "default"
|
||||
|
||||
bindsym Escape mode "default"
|
||||
bindsym Return mode "default"
|
||||
}
|
||||
bindsym $mod+x mode $exitmode
|
||||
|
||||
|
||||
# reload the configuration file
|
||||
bindsym $mod+Shift+c reload
|
||||
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
|
||||
bindsym $mod+Shift+r restart
|
||||
|
||||
bar {
|
||||
output primary
|
||||
output nonprimary
|
||||
tray_output primary
|
||||
status_command exec ~/.local/bin/i3status_wrapper
|
||||
}
|
||||
|
||||
# Screenshots
|
||||
bindsym Print exec --no-startup-id maim "$HOME/Pictures/Screenshots/$(date +'%d-%m-%Y-%T').png"
|
||||
bindsym $mod+Print exec --no-startup-id maim --window $(xdotool getactivewindow) "$HOME/Pictures/Screenshots/$(date +'%d-%m-%Y-%T').png"
|
||||
bindsym Shift+Print exec --no-startup-id maim --select "$HOME/Pictures/Screenshots/$(date +'%d-%m-%Y-%T').png"
|
||||
|
||||
## Clipboard Screenshots
|
||||
bindsym Ctrl+Print exec --no-startup-id maim | xclip -selection clipboard -t image/png
|
||||
bindsym Ctrl+$mod+Print exec --no-startup-id maim --window $(xdotool getactivewindow) | xclip -selection clipboard -t image/png
|
||||
bindsym Ctrl+Shift+Print exec --no-startup-id maim --select | xclip -selection clipboard -t image/png
|
||||
|
||||
|
||||
# default workspaces for monitors in setup
|
||||
workspace $ws1 output primary
|
||||
workspace $ws2 output primary
|
||||
workspace $ws3 output primary
|
||||
workspace $ws9 output nonprimary
|
||||
workspace $ws10 output nonprimary
|
||||
|
||||
workspace hide1 output primary
|
||||
workspace hide2 output nonprimary
|
||||
bindsym $mod+q exec --no-startup-id i3-msg workspace hide1; workspace hide2
|
||||
|
||||
no_focus [title="^Peek preview$"]
|
||||
@ -1,64 +0,0 @@
|
||||
separator_block_width=15
|
||||
markup=pango
|
||||
|
||||
color=#FFFFFF
|
||||
|
||||
interval=5
|
||||
|
||||
[wireless]
|
||||
command=~/.config/i3blocks/scripts/builder.sh wireless
|
||||
interval=10
|
||||
|
||||
[ethernet]
|
||||
command=~/.config/i3blocks/scripts/builder.sh ethernet
|
||||
interval=10
|
||||
|
||||
[diskroot]
|
||||
command=~/.config/i3blocks/scripts/builder.sh disk_root
|
||||
interval=30
|
||||
|
||||
[diskhome]
|
||||
command=~/.config/i3blocks/scripts/builder.sh disk_home
|
||||
interval=30
|
||||
|
||||
[memory]
|
||||
command=~/.config/i3blocks/scripts/builder.sh memory
|
||||
interval=5
|
||||
|
||||
[cpu_usage]
|
||||
command=~/.config/i3blocks/scripts/builder.sh cpu_usage
|
||||
interval=5
|
||||
|
||||
[cpu_temp]
|
||||
command=~/.config/i3blocks/scripts/builder.sh cpu_temp
|
||||
interval=5
|
||||
|
||||
[bluetooth]
|
||||
command=~/.config/i3blocks/scripts/builder.sh bluetooth_battery
|
||||
interval=5
|
||||
|
||||
[battery]
|
||||
command=~/.config/i3blocks/scripts/builder.sh battery
|
||||
interval=30
|
||||
|
||||
[volume]
|
||||
command=~/.config/i3blocks/scripts/builder.sh volume
|
||||
interval=1
|
||||
signal=1
|
||||
|
||||
[pomodoro]
|
||||
command=~/.config/i3blocks/scripts/builder.sh pomodoro
|
||||
interval=1
|
||||
signal=2
|
||||
|
||||
[language]
|
||||
command=~/.config/i3blocks/scripts/builder.sh language
|
||||
signal=1
|
||||
|
||||
[userhost]
|
||||
command=~/.config/i3blocks/scripts/builder.sh userhost
|
||||
signal=1
|
||||
|
||||
[time]
|
||||
command=~/.config/i3blocks/scripts/builder.sh time
|
||||
interval=30
|
||||
@ -1,125 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -ue
|
||||
|
||||
|
||||
readonly EXIT_SUCCESS=0
|
||||
readonly EXIT_FAILURE=1
|
||||
|
||||
|
||||
cmd_wireless() {
|
||||
wifiname="$(LANG=C nmcli -t -f active,ssid dev wifi | grep '^yes' | cut -d: -f2)"
|
||||
wifi_ip=$(ip -o -4 addr show | grep wlp | awk '{print $4}' | cut -d/ -f1 | head -1)
|
||||
|
||||
if [ -z "${wifiname}" ] || [ -z "${wifi_ip}" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
printf ' %s %s\n' "${wifiname}" "${wifi_ip}"
|
||||
}
|
||||
|
||||
cmd_battery() {
|
||||
charging_status="$(cat /sys/class/power_supply/BAT0/status)"
|
||||
percent="$(cat /sys/class/power_supply/BAT0/capacity)"
|
||||
|
||||
if [ "${percent}" -lt 35 ]; then
|
||||
emoji_status="🪫"
|
||||
else
|
||||
emoji_status="🔋"
|
||||
fi
|
||||
|
||||
if [ "${charging_status}" = "Charging" ]; then
|
||||
emoji_status="🔌"
|
||||
fi
|
||||
|
||||
printf "%s %s%%\n" "${emoji_status}" "${percent}"
|
||||
}
|
||||
|
||||
cmd_disk_root() {
|
||||
df -h / | awk '/\// {print "/ "$3"/"$2}'
|
||||
}
|
||||
|
||||
cmd_disk_home() {
|
||||
res="$(df -h /home)"
|
||||
if [ "$(echo "${res}" | awk '/\// {print $6}')" = "/" ]; then
|
||||
return 1
|
||||
fi
|
||||
df -h /home | awk '/\// {print " "$3"/"$2}'
|
||||
}
|
||||
|
||||
cmd_memory() {
|
||||
free -h | awk '/^Mem/ {print "🎟 "$3"/"$2}' | sed 's/i//g'
|
||||
}
|
||||
|
||||
cmd_cpu_usage() {
|
||||
top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print " "100 - $1"%"}'
|
||||
}
|
||||
|
||||
cmd_cpu_temp() {
|
||||
temp_mC="$(cat /sys/class/thermal/thermal_zone0/temp)"
|
||||
temp_C="$((temp_mC / 1000))"
|
||||
|
||||
if [ "${temp_C}" -gt 80 ]; then
|
||||
printf '<span foreground="red"> %s°C</span>\n' "${temp_C}"
|
||||
else
|
||||
printf ' %s°C\n' "${temp_C}"
|
||||
fi
|
||||
}
|
||||
|
||||
cmd_time() {
|
||||
LC_ALL=C date '+ %d.%m.%y %a %H:%M'
|
||||
}
|
||||
|
||||
cmd_volume() {
|
||||
value="$(pactl --format=json get-sink-volume @DEFAULT_SINK@ | jq --raw-output '.volume."front-left".value_percent')"
|
||||
printf ' %s\n' "${value}"
|
||||
}
|
||||
|
||||
cmd_pomodoro() {
|
||||
pomodoro get
|
||||
}
|
||||
|
||||
cmd_bluetooth_battery() {
|
||||
device="$(upower -e | grep headset | head -1)"
|
||||
upower -i "${device}" | grep percentage | awk '{ print "🎧🔋"$2"" }'
|
||||
}
|
||||
|
||||
cmd_language() {
|
||||
layout="$(swaymsg -t get_inputs | jq -r '.[] | select(.type == "keyboard") | .xkb_active_layout_name' | head -1)"
|
||||
|
||||
case "${layout}" in
|
||||
"English (US)")
|
||||
printf '🇬🇧 En\n'
|
||||
;;
|
||||
Russian)
|
||||
printf '🇷🇺 Ru\n'
|
||||
;;
|
||||
*)
|
||||
printf '🌐 %s\n' "${layout}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
cmd_userhost() {
|
||||
printf "%s@%s\n" "${USER}" "${HOST:-${HOSTNAME:-}}"
|
||||
}
|
||||
|
||||
case "${1}" in
|
||||
wireless) shift; cmd_wireless "$@" ;;
|
||||
ethernet) shift; cmd_ethernet "$@" ;;
|
||||
battery) shift; cmd_battery "$@" ;;
|
||||
disk_root) shift; cmd_disk_root "$@" ;;
|
||||
disk_home) shift; cmd_disk_home "$@" ;;
|
||||
memory) shift; cmd_memory "$@" ;;
|
||||
cpu_usage) shift; cmd_cpu_usage "$@" ;;
|
||||
cpu_temp) shift; cmd_cpu_temp "$@" ;;
|
||||
time) shift; cmd_time "$@" ;;
|
||||
volume) shift; cmd_volume "$@" ;;
|
||||
pomodoro) shift; cmd_pomodoro "$@" ;;
|
||||
bluetooth_battery) shift; cmd_bluetooth_battery "$@" ;;
|
||||
language) shift; cmd_language "$@" ;;
|
||||
userhost) shift; cmd_userhost "$@" ;;
|
||||
|
||||
*) exit "${EXIT_FAILURE}" ;;
|
||||
esac
|
||||
exit "${EXIT_SUCCESS}"
|
||||
@ -1,8 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
swaymsg -m -t SUBSCRIBE "['input']" | \
|
||||
jq --unbuffered -r '.change' | while read -r line; do
|
||||
if echo "${line}" | grep -q "xkb_layout"; then
|
||||
pkill -RTMIN+1 i3blocks
|
||||
fi
|
||||
done
|
||||
81
home/user/.config/i3status/config
Normal file
81
home/user/.config/i3status/config
Normal file
@ -0,0 +1,81 @@
|
||||
general {
|
||||
colors = true
|
||||
interval = 5
|
||||
output_format = i3bar
|
||||
}
|
||||
|
||||
order += "wireless _first_"
|
||||
order += "ethernet _first_"
|
||||
order += "disk /"
|
||||
order += "disk /home"
|
||||
order += "memory"
|
||||
order += "cpu_usage"
|
||||
order += "cpu_temperature 0"
|
||||
order += "tztime holder__headphones"
|
||||
order += "battery all"
|
||||
order += "volume master"
|
||||
order += "tztime local"
|
||||
|
||||
wireless _first_ {
|
||||
format_up = " (%quality at %essid %frequency) %ip"
|
||||
format_down = " down"
|
||||
}
|
||||
|
||||
ethernet _first_ {
|
||||
format_up = " %ip"
|
||||
format_down = " down"
|
||||
}
|
||||
|
||||
battery all {
|
||||
format = "%status %percentage"
|
||||
last_full_capacity = false
|
||||
format_down = ""
|
||||
status_chr = "⚡"
|
||||
status_bat = "🔋"
|
||||
status_unk = "?"
|
||||
status_full = ""
|
||||
path = "/sys/class/power_supply/BAT%d/uevent"
|
||||
low_threshold = 15
|
||||
}
|
||||
|
||||
disk "/" {
|
||||
format = "/ %used/%total"
|
||||
}
|
||||
|
||||
disk "/home" {
|
||||
format = " %used/%total"
|
||||
}
|
||||
|
||||
memory {
|
||||
format = " %used/%total"
|
||||
threshold_degraded = "1G"
|
||||
threshold_critical = "200M"
|
||||
format_degraded = "MEMORY < %available"
|
||||
}
|
||||
|
||||
cpu_usage {
|
||||
format = " %usage"
|
||||
}
|
||||
|
||||
cpu_temperature 0 {
|
||||
format = " %degrees°"
|
||||
max_threshold = "80"
|
||||
format_above_threshold = " %degrees"
|
||||
}
|
||||
|
||||
tztime local {
|
||||
format = " %d.%m.%y %a %H:%M"
|
||||
}
|
||||
|
||||
volume master {
|
||||
format = " %volume"
|
||||
format_muted = ": muted %volume"
|
||||
device = "default"
|
||||
mixer = "Master"
|
||||
mixer_idx = 0
|
||||
}
|
||||
|
||||
|
||||
tztime holder__headphones {
|
||||
format = "holder__headphones"
|
||||
}
|
||||
@ -1 +0,0 @@
|
||||
output=DP-1
|
||||
@ -1,11 +0,0 @@
|
||||
[Default Applications]
|
||||
application/pdf=firefox.desktop;
|
||||
text/html=firefox.desktop
|
||||
x-scheme-handler/about=firefox.desktop
|
||||
x-scheme-handler/http=firefox.desktop
|
||||
x-scheme-handler/https=firefox.desktop
|
||||
x-scheme-handler/about=firefox.desktop
|
||||
x-scheme-handler/unknown=firefox.desktop
|
||||
x-scheme-handler/tonsite=org.telegram.desktop.desktop
|
||||
x-scheme-handler/tg=org.telegram.desktop.desktop
|
||||
x-scheme-handler/postman=Postman.desktop
|
||||
@ -1,5 +0,0 @@
|
||||
local opt = vim.opt_local
|
||||
|
||||
opt.expandtab = false
|
||||
opt.tabstop = 4
|
||||
opt.shiftwidth = 4
|
||||
@ -1,7 +0,0 @@
|
||||
vim.g.python_indent = {
|
||||
open_paren = 'shiftwidth()',
|
||||
nested_paren = 'shiftwidth()',
|
||||
continue = 'shiftwidth()',
|
||||
closed_paren_align_last_line = false,
|
||||
searchpair_timeout = 150,
|
||||
}
|
||||
@ -1 +1 @@
|
||||
require("core")
|
||||
require("base")
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
for _, source in ipairs({
|
||||
"core.options",
|
||||
"core.mappings",
|
||||
"core.lazy",
|
||||
})
|
||||
do
|
||||
for _, source in ipairs {
|
||||
"base.options",
|
||||
"base.mappings",
|
||||
"base.lazy",
|
||||
} do
|
||||
local status_ok, fault = pcall(require, source)
|
||||
if not status_ok then
|
||||
vim.api.nvim_err_writeln("Failed to load " .. source .. "\n\n" .. fault)
|
||||
36
home/user/.config/nvim/lua/base/lazy.lua
Normal file
36
home/user/.config/nvim/lua/base/lazy.lua
Normal file
@ -0,0 +1,36 @@
|
||||
|
||||
local function install_lazy_if_not_installed(lazypath)
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git", "clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
install_lazy_if_not_installed(lazypath)
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
|
||||
local plugins = {}
|
||||
|
||||
local modules = vim.split(vim.fn.glob(vim.fn.stdpath("config") .. '/lua/*/plugins/*lua'), '\n')
|
||||
|
||||
for i, module_path in pairs(modules) do
|
||||
splitted_path = vim.split(module_path, '/')
|
||||
module_name = splitted_path[#splitted_path]:gsub(".lua", "")
|
||||
|
||||
table.insert(plugins, require('base.plugins.' .. module_name))
|
||||
end
|
||||
|
||||
|
||||
require("lazy").setup(
|
||||
plugins,
|
||||
{
|
||||
lockfile = vim.fn.stdpath "data" .. "/lazy-lock.json"
|
||||
}
|
||||
)
|
||||
2
home/user/.config/nvim/lua/base/mappings/init.lua
Normal file
2
home/user/.config/nvim/lua/base/mappings/init.lua
Normal file
@ -0,0 +1,2 @@
|
||||
require("base.mappings.mappings")
|
||||
require("base.mappings.run-scripts")
|
||||
141
home/user/.config/nvim/lua/base/mappings/mappings.lua
Normal file
141
home/user/.config/nvim/lua/base/mappings/mappings.lua
Normal file
@ -0,0 +1,141 @@
|
||||
local map = vim.keymap.set
|
||||
|
||||
|
||||
vim.g.mapleader = ','
|
||||
|
||||
|
||||
local function create_function_tabdo(command)
|
||||
return function()
|
||||
local curr_tab = vim.fn.tabpagenr()
|
||||
vim.cmd.tabdo(command)
|
||||
vim.cmd.tabn(curr_tab)
|
||||
end
|
||||
end
|
||||
|
||||
map('n', '<Leader>hc', create_function_tabdo('set cursorline!'),
|
||||
{desc = "Toggle line highlighting"})
|
||||
|
||||
map('n', '<Leader>h/',
|
||||
function() vim.opt.hlsearch = not vim.opt.hlsearch["_value"] end,
|
||||
{desc = "Toggle search highlighting"})
|
||||
|
||||
|
||||
-- enable search highlight in search mode
|
||||
map('n', '/', ':set hlsearch<CR>/')
|
||||
|
||||
-- copy selection to search line
|
||||
map('v', '<C-f>', '"fy:set hlsearch<CR>/\\V<C-r>f\\C<CR>')
|
||||
|
||||
-- copy word under cursor to search line
|
||||
map('n', '<C-f>', ':set hlsearch<CR>/\\V<C-r><C-w>\\C<CR>')
|
||||
|
||||
map('n', '<Leader>hl', create_function_tabdo('lua toggle_number_style()'),
|
||||
{desc = "Toggle line number style"})
|
||||
|
||||
map('i', 'jf', '<ESC>')
|
||||
map('i', 'оа', '<ESC>')
|
||||
|
||||
map('n', '<Enter>', 'o<ESC>')
|
||||
map('n', '<Space>', 'O<ESC>')
|
||||
|
||||
-- x to blackhole
|
||||
map({'n', 'v'}, 'x', '"_x')
|
||||
map('n', '<bs>', '"_X')
|
||||
|
||||
|
||||
-- Put without overwrite yanked text
|
||||
map('x', 'p', 'P')
|
||||
|
||||
|
||||
-- Increment/decrement
|
||||
map('n', '+', '<C-a>')
|
||||
map('n', '-', '<C-x>')
|
||||
|
||||
-- map \ to prev finding
|
||||
map({"n", "v"}, [[\]], ',')
|
||||
|
||||
-- Select all
|
||||
map('n', '<C-a>', 'mvggVG')
|
||||
map('v', '<C-a>', '<Esc>`v:delmarks v<CR>', {silent = true})
|
||||
|
||||
|
||||
-- Scroll tabs
|
||||
map("n", '<C-l>', vim.cmd.tabnext)
|
||||
map("n", '<C-h>', vim.cmd.tabprev)
|
||||
|
||||
|
||||
-- Open file under cursor in new tab
|
||||
map("n", 'gf', '<C-w>gf')
|
||||
|
||||
|
||||
map("n", '<Leader>qq', '<cmd>bd!<CR>',
|
||||
{desc = "Kill current buffer"})
|
||||
|
||||
map("n", '<Leader>qa', '<cmd>qa!<CR>',
|
||||
{desc = "Exit without saving"})
|
||||
|
||||
|
||||
map("n", '<Leader>he', '<cmd>set list!<CR>',
|
||||
{desc = "Show hidden symbols"})
|
||||
vim.opt.listchars=[[tab:→\ ,eol:↵,trail:·,extends:↷,precedes:↶]]
|
||||
|
||||
|
||||
-- Expand %% to dirname of current file in command line
|
||||
map("c", '%%', [[getcmdtype() == ':' ? expand('%:h').'/' : '%%']], {expr = true})
|
||||
|
||||
|
||||
-- Save from root
|
||||
vim.api.nvim_create_user_command('W', [[execute 'silent! write !SUDO_ASKPASS=vim_askpass_helper sudo -A tee % >/dev/null' <bar> edit!]], {})
|
||||
vim.cmd([[autocmd FileChangedRO * set readonly!]])
|
||||
|
||||
|
||||
-- Toggle line number style
|
||||
function toggle_number_style()
|
||||
local opt = vim.opt
|
||||
local number = opt.number["_value"]
|
||||
local relativenumber = opt.relativenumber["_value"]
|
||||
|
||||
if (not number) and (not relativenumber) then
|
||||
opt.number = true
|
||||
opt.relativenumber = false
|
||||
elseif (number) and (not relativenumber) then
|
||||
opt.number = false
|
||||
opt.relativenumber = true
|
||||
elseif (not number) and (relativenumber) then
|
||||
opt.number = true
|
||||
opt.relativenumber = true
|
||||
elseif (number) and (relativenumber) then
|
||||
opt.number = false
|
||||
opt.relativenumber = false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
local function set_trouble_keymap(key, cmd)
|
||||
map("n", string.format("<space>x%s", key), string.format("<cmd>TroubleToggle %s<CR>", cmd))
|
||||
end
|
||||
|
||||
set_trouble_keymap("x", "")
|
||||
set_trouble_keymap("w", "workspace_diagnostics") -- lsp diagnostic of workspace
|
||||
set_trouble_keymap("d", "document_diagnostics") -- diagnostic of current file
|
||||
|
||||
|
||||
local function set_gitsigns_keymap(key, cmd)
|
||||
map("n", string.format("<space>g%s", key), string.format("<cmd>Gitsigns %s<CR>", cmd))
|
||||
end
|
||||
|
||||
set_gitsigns_keymap('p', 'preview_hunk') -- show diff
|
||||
set_gitsigns_keymap('b', 'blame_line') -- show author, hash, date and message of current line commit
|
||||
set_gitsigns_keymap('n', 'next_hunk') -- go to next unstaged changes
|
||||
set_gitsigns_keymap('N', 'prev_hunk') -- go to prev unstaged changes
|
||||
set_gitsigns_keymap('r', 'reset_hunk') -- reset hunk under cursor
|
||||
set_gitsigns_keymap('h', 'toggle_linehl') -- line highlighting
|
||||
|
||||
|
||||
map("n", "<Leader>pl", "<cmd>Lazy<CR>",
|
||||
{desc = "Package manager"})
|
||||
|
||||
map("n", "<Leader>pm", "<cmd>Mason<CR>",
|
||||
{desc = "LSP Manager"})
|
||||
86
home/user/.config/nvim/lua/base/mappings/run-scripts.lua
Normal file
86
home/user/.config/nvim/lua/base/mappings/run-scripts.lua
Normal file
@ -0,0 +1,86 @@
|
||||
|
||||
local function autocmd(func)
|
||||
local create_autocmd = vim.api.nvim_create_autocmd
|
||||
|
||||
create_autocmd("BufEnter",
|
||||
{ pattern = '*', callback = func}
|
||||
)
|
||||
end
|
||||
|
||||
local function set_keymap_base(key, cmd)
|
||||
local map = vim.keymap.set
|
||||
local opts = { noremap = true, silent = true }
|
||||
local keymap_keys = string.format([[<Leader>r%s]], key)
|
||||
map("n", keymap_keys, cmd, opts)
|
||||
end
|
||||
|
||||
local function set_keymap_format_file(cmd)
|
||||
local cmd_string = string.format([[:!%s %% <CR>]], cmd)
|
||||
set_keymap_base("f", cmd_string)
|
||||
end
|
||||
|
||||
local function set_keymap_run_script_base(key, cmd)
|
||||
local run_script_string = [[:tabnew %% <CR> :terminal %s %% <CR> :set nocursorline number norelativenumber <CR> G <CR>]]
|
||||
local cmd_string = string.format(run_script_string, cmd)
|
||||
set_keymap_base(key, cmd_string)
|
||||
end
|
||||
|
||||
local function set_keymap_run_script(cmd)
|
||||
set_keymap_run_script_base("r", cmd)
|
||||
end
|
||||
|
||||
local function set_keymap_test_file_base(key, cmd)
|
||||
local run_script_string = [[:tabnew %% <CR> :terminal %s %% <CR> :set nocursorline number norelativenumber <CR> G <CR>]]
|
||||
local cmd_string = string.format(run_script_string, cmd)
|
||||
set_keymap_base(key, cmd_string)
|
||||
end
|
||||
|
||||
local function set_keymap_test_file(cmd)
|
||||
set_keymap_test_file_base("t", cmd)
|
||||
end
|
||||
|
||||
local function set_keymap_run_script_by_shebang()
|
||||
set_keymap_run_script_base("s", [[$(head -1 % | cut -c 3-) %]])
|
||||
end
|
||||
|
||||
local function create_function_autocmd_by_filetype(set_keymap_func, ft, cmd)
|
||||
return function()
|
||||
if vim.bo.filetype == ft then
|
||||
set_keymap_func(cmd)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function create_function_autocmd_by_filename(set_keymap_func, fn, cmd)
|
||||
return function()
|
||||
if vim.fn.expand('%:t') == fn then
|
||||
set_keymap_func(cmd)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function autocmd_run_script_by_filetype(ft, cmd)
|
||||
autocmd(create_function_autocmd_by_filetype(set_keymap_run_script, ft, cmd))
|
||||
end
|
||||
|
||||
local function autocmd_format_file_by_filetype(ft, cmd)
|
||||
autocmd(create_function_autocmd_by_filetype(set_keymap_format_file, ft, cmd))
|
||||
end
|
||||
|
||||
local function autocmd_run_tests_by_filetype(ft, cmd)
|
||||
autocmd(create_function_autocmd_by_filetype(set_keymap_test_file, ft, cmd))
|
||||
end
|
||||
|
||||
|
||||
autocmd_run_script_by_filetype('python', 'python3')
|
||||
autocmd_run_script_by_filetype('go', 'go run')
|
||||
autocmd_run_script_by_filetype('rust', 'cargo run')
|
||||
|
||||
autocmd_run_tests_by_filetype('python', 'pytest')
|
||||
|
||||
autocmd(create_function_autocmd_by_filename(set_keymap_run_script, 'manpage', 'man -P cat -l'))
|
||||
|
||||
autocmd_format_file_by_filetype('rust', 'cargo fmt -p')
|
||||
autocmd_format_file_by_filetype('go', 'go fmt')
|
||||
|
||||
autocmd(set_keymap_run_script_by_shebang)
|
||||
@ -12,12 +12,12 @@ opt.relativenumber = true
|
||||
opt.clipboard:append { 'unnamed' }
|
||||
opt.clipboard:append { 'unnamedplus' }
|
||||
|
||||
opt.shortmess:append{a = true, s = true, I = true, c = true, S = true}
|
||||
opt.shortmess:append{a = true, s = true, I = true, c = true, S = true } -- disable startup message
|
||||
|
||||
opt.cmdheight = 0
|
||||
opt.cmdheight = 1
|
||||
vim.wo.signcolumn = "yes:1"
|
||||
|
||||
opt.shell = vim.env.SHELL
|
||||
opt.shell = 'zsh'
|
||||
|
||||
opt.ttimeoutlen = 50
|
||||
opt.timeoutlen = 500
|
||||
@ -28,7 +28,6 @@ opt.compatible = false
|
||||
|
||||
opt.hidden = true
|
||||
|
||||
-- indent
|
||||
opt.expandtab = true -- spaces instead of tab
|
||||
opt.smarttab = true
|
||||
opt.tabstop = 4 -- 1 tab appears number spaces
|
||||
@ -36,9 +35,7 @@ opt.softtabstop = 4
|
||||
opt.shiftwidth = vim.bo.tabstop -- insert tab or shift inserting .shiftwidth*.tabstop spaces or .shiftwidth/.tabstop tabs
|
||||
opt.autoindent = true
|
||||
opt.smartindent = true
|
||||
|
||||
-- tabline
|
||||
opt.showtabline = 0
|
||||
opt.showtabline = 2
|
||||
|
||||
opt.cursorline = true
|
||||
opt.wrap = false
|
||||
@ -57,16 +54,8 @@ opt.incsearch = true
|
||||
opt.mousehide = true
|
||||
opt.mouse = 'a'
|
||||
|
||||
opt.scrolloff = 999
|
||||
|
||||
|
||||
COLUMN_NUMBER_BEFORE_INSERT=1
|
||||
|
||||
vim.api.nvim_create_autocmd("InsertEnter", {
|
||||
callback = function()
|
||||
_, COLUMN_NUMBER_BEFORE_INSERT = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
end,
|
||||
})
|
||||
opt.colorcolumn = '81'
|
||||
opt.scrolloff = 7
|
||||
|
||||
|
||||
-- disable paste comment on new line
|
||||
@ -98,7 +87,7 @@ opt.directory = { prefix .. "/swap//" }
|
||||
|
||||
|
||||
local function makeDirIfNoExists(path)
|
||||
path = path["_value"]
|
||||
local path = path["_value"]
|
||||
if (vim.fn.isdirectory(path) == 0) then
|
||||
vim.fn.mkdir(path, "p")
|
||||
end
|
||||
@ -144,28 +133,17 @@ vim.cmd.highlight({ "DiagnosticHint", "guifg=Grey" })
|
||||
opt.langmap = 'ФИСВУАПРШОЛДЬТЩЗЙКЫЕГМЦЧНЯ;ABCDEFGHIJKLMNOPQRSTUVWXYZ,фисвуапршолдьтщзйкыегмцчня;abcdefghijklmnopqrstuvwxyz'
|
||||
|
||||
|
||||
vim.o.viewdir = vim.fn.stdpath('cache')..'/view'
|
||||
vim.fn.mkdir(vim.o.viewdir, 'p')
|
||||
opt.viewoptions = "folds,cursor"
|
||||
|
||||
vim.api.nvim_create_autocmd("BufWinLeave", {
|
||||
pattern = {"?*"},
|
||||
callback = function(args)
|
||||
local bufname = vim.api.nvim_buf_get_name(args.buf)
|
||||
if not bufname:match("^term://") then
|
||||
pattern = {"*.*"},
|
||||
callback = function()
|
||||
vim.cmd.mkview(1)
|
||||
end
|
||||
|
||||
end
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("BufWinEnter", {
|
||||
pattern = {"?*"},
|
||||
callback = function(args)
|
||||
local bufname = vim.api.nvim_buf_get_name(args.buf)
|
||||
if not bufname:match("^term://") then
|
||||
vim.cmd([[silent! loadview 1]])
|
||||
end
|
||||
pattern = {"*.*"},
|
||||
callback = function()
|
||||
vim.cmd('silent! loadview 1')
|
||||
end,
|
||||
})
|
||||
|
||||
35
home/user/.config/nvim/lua/base/plugins/auto_save.lua
Normal file
35
home/user/.config/nvim/lua/base/plugins/auto_save.lua
Normal file
@ -0,0 +1,35 @@
|
||||
return {
|
||||
'Pocco81/auto-save.nvim',
|
||||
config = function()
|
||||
require("auto-save").setup({
|
||||
enabled = true, -- start auto-save when the plugin is loaded (i.e. when your package manager loads it)
|
||||
execution_message = {
|
||||
message = function() -- message to print on save
|
||||
return ""
|
||||
end,
|
||||
dim = 0.18, -- dim the color of `message`
|
||||
cleaning_interval = 1250, -- (milliseconds) automatically clean MsgArea after displaying `message`. See :h MsgArea
|
||||
},
|
||||
trigger_events = {"InsertLeave", "TextChanged"}, -- vim events that trigger auto-save. See :h events
|
||||
condition = function(buf)
|
||||
local fn = vim.fn
|
||||
local utils = require("auto-save.utils.data")
|
||||
if
|
||||
fn.getbufvar(buf, "&modifiable") == 1 and
|
||||
utils.not_in(fn.getbufvar(buf, "&filetype"), {}) then
|
||||
return true -- met condition(s), can save
|
||||
end
|
||||
return false -- can't save
|
||||
end,
|
||||
write_all_buffers = false, -- write all buffers when the current one meets `condition`
|
||||
debounce_delay = 135, -- saves the file at most every `debounce_delay` milliseconds
|
||||
callbacks = { -- functions to be executed at different intervals
|
||||
enabling = nil, -- ran when enabling auto-save
|
||||
disabling = nil, -- ran when disabling auto-save
|
||||
before_asserting_save = nil, -- ran before checking `condition`
|
||||
before_saving = nil, -- ran before doing the actual save
|
||||
after_saving = nil -- ran after doing the actual save
|
||||
}
|
||||
})
|
||||
end
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
return {
|
||||
"max397574/better-escape.nvim",
|
||||
config = function()
|
||||
require("better_escape").setup({
|
||||
mapping = {'jf', 'оа'},
|
||||
timeout = vim.o.timeoutlen,
|
||||
})
|
||||
end,
|
||||
}
|
||||
14
home/user/.config/nvim/lua/base/plugins/colorschemes.lua
Normal file
14
home/user/.config/nvim/lua/base/plugins/colorschemes.lua
Normal file
@ -0,0 +1,14 @@
|
||||
return {
|
||||
{
|
||||
'EdenEast/nightfox.nvim',
|
||||
config = function()
|
||||
local colorscheme = require("nightfox")
|
||||
colorscheme.compile()
|
||||
colorscheme.setup()
|
||||
vim.cmd.colorscheme("nightfox")
|
||||
end
|
||||
},
|
||||
{
|
||||
'ellisonleao/gruvbox.nvim'
|
||||
},
|
||||
}
|
||||
12
home/user/.config/nvim/lua/base/plugins/dotenv.lua
Normal file
12
home/user/.config/nvim/lua/base/plugins/dotenv.lua
Normal file
@ -0,0 +1,12 @@
|
||||
return {
|
||||
"ellisonleao/dotenv.nvim",
|
||||
config = function()
|
||||
require('dotenv').setup({
|
||||
enable_on_load = true, -- will load your .env file upon loading a buffer
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
pattern = "*", callback = require('dotenv').autocmd
|
||||
})
|
||||
end
|
||||
}
|
||||
3
home/user/.config/nvim/lua/base/plugins/gdb.lua
Normal file
3
home/user/.config/nvim/lua/base/plugins/gdb.lua
Normal file
@ -0,0 +1,3 @@
|
||||
return {
|
||||
"sakhnik/nvim-gdb",
|
||||
}
|
||||
16
home/user/.config/nvim/lua/base/plugins/gitsigns.lua
Normal file
16
home/user/.config/nvim/lua/base/plugins/gitsigns.lua
Normal file
@ -0,0 +1,16 @@
|
||||
return {
|
||||
'lewis6991/gitsigns.nvim',
|
||||
enabled = vim.fn.executable "git" == 1,
|
||||
config = function()
|
||||
require("gitsigns").setup({
|
||||
signs = {
|
||||
add = { text = "+" },
|
||||
change = { text = "|" },
|
||||
delete = { text = "-" },
|
||||
topdelete = { text = "^" },
|
||||
changedelete = { text = "~" },
|
||||
untracked = { text = "0" },
|
||||
}
|
||||
})
|
||||
end
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
return {
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
config = function()
|
||||
require("ibl").setup({
|
||||
scope = { enabled = false },
|
||||
})
|
||||
end,
|
||||
main = "ibl"
|
||||
}
|
||||
9
home/user/.config/nvim/lua/base/plugins/leap.lua
Normal file
9
home/user/.config/nvim/lua/base/plugins/leap.lua
Normal file
@ -0,0 +1,9 @@
|
||||
return {
|
||||
'ggandor/leap.nvim',
|
||||
config = function()
|
||||
require('leap').opts.safe_labels = {}
|
||||
local set = vim.keymap.set
|
||||
set({'n', 'v'}, 'J', '<Plug>(leap-forward-to)')
|
||||
set({'n', 'v'}, 'K', '<Plug>(leap-backward-to)')
|
||||
end,
|
||||
}
|
||||
15
home/user/.config/nvim/lua/base/plugins/lint.lua
Normal file
15
home/user/.config/nvim/lua/base/plugins/lint.lua
Normal file
@ -0,0 +1,15 @@
|
||||
return {
|
||||
"mfussenegger/nvim-lint",
|
||||
config = function()
|
||||
local lint = require("lint")
|
||||
lint.linters_by_ft = {
|
||||
python = {"flake8"},
|
||||
sh = {"shellcheck"},
|
||||
}
|
||||
vim.api.nvim_create_autocmd({"TextChanged", "BufEnter"}, {
|
||||
callback = function()
|
||||
lint.try_lint()
|
||||
end,
|
||||
})
|
||||
end
|
||||
}
|
||||
40
home/user/.config/nvim/lua/base/plugins/lualine.lua
Normal file
40
home/user/.config/nvim/lua/base/plugins/lualine.lua
Normal file
@ -0,0 +1,40 @@
|
||||
|
||||
function get_formatted_cwd()
|
||||
return vim.fn.getcwd():gsub(os.getenv("HOME"), "~")
|
||||
end
|
||||
|
||||
local function get_virtual_env()
|
||||
return vim.fs.basename(os.getenv("VIRTUAL_ENV"))
|
||||
end
|
||||
|
||||
function get_formatted_virtual_env()
|
||||
if vim.bo.filetype == 'python' then
|
||||
return "<" .. get_virtual_env() .. ">"
|
||||
end
|
||||
return ""
|
||||
end
|
||||
|
||||
function detect_indent_type()
|
||||
if vim.bo.expandtab then
|
||||
return vim.bo.shiftwidth .. " spaces"
|
||||
else
|
||||
return vim.bo.shiftwidth / vim.bo.tabstop .. " tabs (" .. vim.bo.tabstop .. ")"
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
'nvim-lualine/lualine.nvim',
|
||||
config = function()
|
||||
require("lualine").setup({
|
||||
sections = {
|
||||
lualine_a = {'mode'},
|
||||
lualine_b = {'branch', 'diff', 'diagnostics'},
|
||||
lualine_c = {'get_formatted_cwd()'},
|
||||
lualine_x = {'get_formatted_virtual_env()', 'detect_indent_type()', 'filetype'},
|
||||
lualine_y = {'progress'},
|
||||
lualine_z = {'location'},
|
||||
},
|
||||
})
|
||||
end,
|
||||
dependencies = { 'kyazdani42/nvim-web-devicons' }
|
||||
}
|
||||
6
home/user/.config/nvim/lua/base/plugins/marks.lua
Normal file
6
home/user/.config/nvim/lua/base/plugins/marks.lua
Normal file
@ -0,0 +1,6 @@
|
||||
return {
|
||||
'chentoast/marks.nvim',
|
||||
config = function()
|
||||
require("marks").setup()
|
||||
end
|
||||
}
|
||||
56
home/user/.config/nvim/lua/base/plugins/mason.lua
Normal file
56
home/user/.config/nvim/lua/base/plugins/mason.lua
Normal file
@ -0,0 +1,56 @@
|
||||
local on_attach = function(client, bufnr)
|
||||
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
||||
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||||
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
-- Mappings.
|
||||
local opts = { noremap=true, silent=true }
|
||||
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
||||
buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
||||
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
||||
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>k', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>K', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
||||
buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>e', '<cmd>lua vim.diagnostic.open_float()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>p', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>n', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.format()<CR>', opts)
|
||||
end
|
||||
|
||||
return {
|
||||
{
|
||||
'williamboman/mason.nvim',
|
||||
dependencies = {
|
||||
'neovim/nvim-lspconfig',
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
},
|
||||
config = function()
|
||||
require("mason").setup()
|
||||
local mason_lspconfig = require("mason-lspconfig")
|
||||
|
||||
mason_lspconfig.setup()
|
||||
|
||||
mason_lspconfig.setup_handlers({
|
||||
function (server_name)
|
||||
require("lspconfig")[server_name].setup({
|
||||
on_attach = on_attach,
|
||||
flags = {
|
||||
debounce_text_changes = 150,
|
||||
}
|
||||
})
|
||||
end
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
65
home/user/.config/nvim/lua/base/plugins/misc.lua
Normal file
65
home/user/.config/nvim/lua/base/plugins/misc.lua
Normal file
@ -0,0 +1,65 @@
|
||||
return {
|
||||
'tpope/vim-repeat',
|
||||
'google/vim-searchindex',
|
||||
'rbgrouleff/bclose.vim',
|
||||
'chaoren/vim-wordmotion',
|
||||
'preservim/vim-pencil',
|
||||
{
|
||||
'windwp/nvim-autopairs',
|
||||
desc = "Auto pair brackets and tags",
|
||||
event = "InsertEnter",
|
||||
opts = {
|
||||
disable_in_macro = true,
|
||||
}
|
||||
},
|
||||
{
|
||||
"kylechui/nvim-surround",
|
||||
version = "*",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("nvim-surround").setup()
|
||||
end
|
||||
},
|
||||
{
|
||||
'windwp/nvim-ts-autotag',
|
||||
config = function()
|
||||
require("nvim-ts-autotag").setup()
|
||||
end
|
||||
},
|
||||
{
|
||||
'numToStr/Comment.nvim',
|
||||
config = function()
|
||||
require("Comment").setup()
|
||||
end
|
||||
},
|
||||
{
|
||||
'norcalli/nvim-colorizer.lua',
|
||||
config = function()
|
||||
require('colorizer').setup()
|
||||
end
|
||||
},
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
build = ':TSUpdate',
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
ensure_installed = {"python", "lua", "vim", "html", "rust", "markdown"},
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
enable = true,
|
||||
}
|
||||
})
|
||||
end
|
||||
},
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||
dependencies = { 'nvim-treesitter/nvim-treesitter' },
|
||||
},
|
||||
{
|
||||
'folke/trouble.nvim',
|
||||
dependencies = { 'kyazdani42/nvim-web-devicons' },
|
||||
config = function()
|
||||
require("trouble").setup()
|
||||
end
|
||||
},
|
||||
}
|
||||
19
home/user/.config/nvim/lua/base/plugins/neodev.lua
Normal file
19
home/user/.config/nvim/lua/base/plugins/neodev.lua
Normal file
@ -0,0 +1,19 @@
|
||||
return {
|
||||
'folke/neodev.nvim',
|
||||
ft = {'lua'},
|
||||
dependencies = {
|
||||
'neovim/nvim-lspconfig'
|
||||
},
|
||||
config = function()
|
||||
require('neodev').setup()
|
||||
require('lspconfig').lua_ls.setup({
|
||||
settings = {
|
||||
Lua = {
|
||||
completion = {
|
||||
callSnippet = "Replace"
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
}
|
||||
10
home/user/.config/nvim/lua/base/plugins/neoscroll.lua
Normal file
10
home/user/.config/nvim/lua/base/plugins/neoscroll.lua
Normal file
@ -0,0 +1,10 @@
|
||||
return {
|
||||
'karb94/neoscroll.nvim',
|
||||
config = function()
|
||||
require('neoscroll').setup({
|
||||
mappings = {'<C-u>', '<C-d>', '<C-b>',
|
||||
'<C-y>', '<C-e>', 'zt', 'zz', 'zb'},
|
||||
respect_scrolloff = false,
|
||||
})
|
||||
end
|
||||
}
|
||||
116
home/user/.config/nvim/lua/base/plugins/nvim_cmp.lua
Normal file
116
home/user/.config/nvim/lua/base/plugins/nvim_cmp.lua
Normal file
@ -0,0 +1,116 @@
|
||||
local border_opts = {
|
||||
border = "single",
|
||||
winhighlight = "Normal:Normal,FloatBorder:FloatBorder,CursorLine:Visual,Search:None",
|
||||
}
|
||||
|
||||
local function has_words_before()
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||
end
|
||||
|
||||
local function setup_cmp()
|
||||
local cmp = require("cmp")
|
||||
|
||||
cmp.setup({
|
||||
completion = {
|
||||
autocomplete = {'TextChanged'}
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
['<Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
['<S-Tab>'] = cmp.mapping.select_prev_item(),
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<CR>'] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = false,
|
||||
},
|
||||
},
|
||||
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(border_opts),
|
||||
documentation = cmp.config.window.bordered(border_opts),
|
||||
},
|
||||
sorting = {
|
||||
comparators = {
|
||||
cmp.config.compare.offset,
|
||||
cmp.config.compare.exact,
|
||||
cmp.config.compare.score,
|
||||
require "cmp-under-comparator".under,
|
||||
cmp.config.compare.kind,
|
||||
cmp.config.compare.sort_text,
|
||||
cmp.config.compare.length,
|
||||
cmp.config.compare.order,
|
||||
},
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp', priority = 1250 },
|
||||
{ name = 'luasnip', priority = 1000 },
|
||||
{ name = 'buffer', priority = 750 },
|
||||
{ name = "dotenv", priority = 500 },
|
||||
{ name = 'path', priority = 250 },
|
||||
}),
|
||||
})
|
||||
end
|
||||
|
||||
return {
|
||||
{
|
||||
'L3MON4D3/LuaSnip',
|
||||
build = "make install_jsregexp",
|
||||
dependencies = {
|
||||
'hrsh7th/nvim-cmp',
|
||||
'honza/vim-snippets',
|
||||
},
|
||||
config = function()
|
||||
local ls = require("luasnip")
|
||||
|
||||
vim.g.snips_author = 'thek4n'
|
||||
vim.g.snips_email = 'thek4n@yandex.com'
|
||||
vim.g.snips_github = 'https://github.com/thek4n'
|
||||
|
||||
local function jump(val)
|
||||
return function()
|
||||
ls.jump(val)
|
||||
end
|
||||
end
|
||||
|
||||
local map = vim.keymap.set
|
||||
map({'i', 's'}, '<C-n>', jump(1))
|
||||
map({'i', 's'}, '<C-p>', jump(-1))
|
||||
|
||||
|
||||
local luasnip_loaders = require("luasnip.loaders.from_snipmate")
|
||||
|
||||
luasnip_loaders.lazy_load()
|
||||
end
|
||||
},
|
||||
{
|
||||
'hrsh7th/nvim-cmp',
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
'saadparwaiz1/cmp_luasnip',
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'lukas-reineke/cmp-under-comparator',
|
||||
'SergioRibera/cmp-dotenv'
|
||||
},
|
||||
config = setup_cmp,
|
||||
},
|
||||
{
|
||||
'neovim/nvim-lspconfig',
|
||||
},
|
||||
}
|
||||
48
home/user/.config/nvim/lua/base/plugins/peek.lua
Normal file
48
home/user/.config/nvim/lua/base/plugins/peek.lua
Normal file
@ -0,0 +1,48 @@
|
||||
return {
|
||||
'toppair/peek.nvim',
|
||||
event = { "VeryLazy" },
|
||||
enabled = vim.fn.executable("deno") == 1,
|
||||
ft = {'markdown'},
|
||||
build = 'deno task --quiet build:fast',
|
||||
config = function()
|
||||
local peek = require('peek')
|
||||
|
||||
peek.setup({
|
||||
auto_load = true,
|
||||
close_on_bdelete = true,
|
||||
syntax = true,
|
||||
theme = 'dark',
|
||||
update_on_change = true,
|
||||
app = 'webview',
|
||||
filetype = {'markdown'},
|
||||
throttle_at = 200000,
|
||||
throttle_time = 'auto',
|
||||
})
|
||||
|
||||
if vim.fn.executable("i3-msg") then
|
||||
vim.api.nvim_create_user_command('PeekOpen', function()
|
||||
if not peek.is_open() and vim.bo[vim.api.nvim_get_current_buf()].filetype == 'markdown' then
|
||||
vim.fn.system('i3-msg split horizontal')
|
||||
peek.open()
|
||||
end
|
||||
end, {})
|
||||
|
||||
vim.api.nvim_create_user_command('PeekClose', function()
|
||||
if peek.is_open() then
|
||||
peek.close()
|
||||
vim.fn.system('i3-msg move left')
|
||||
end
|
||||
end, {})
|
||||
else
|
||||
vim.api.nvim_create_user_command("PeekOpen", require("peek").open, {})
|
||||
vim.api.nvim_create_user_command("PeekClose", require("peek").close, {})
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = 'markdown', callback = function()
|
||||
vim.keymap.set("n", "<Leader>rr", "<cmd>PeekOpen<CR>")
|
||||
end
|
||||
}
|
||||
)
|
||||
end,
|
||||
}
|
||||
85
home/user/.config/nvim/lua/base/plugins/telescope.lua
Normal file
85
home/user/.config/nvim/lua/base/plugins/telescope.lua
Normal file
@ -0,0 +1,85 @@
|
||||
return {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
enabled = vim.fn.executable "fzf" == 1,
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
{
|
||||
'nvim-telescope/telescope-fzf-native.nvim',
|
||||
enabled = vim.fn.executable "make" == 1,
|
||||
build = "make"
|
||||
}
|
||||
},
|
||||
keys = {
|
||||
{ '<Leader>ff', '<cmd>Telescope find_files<CR>' },
|
||||
{ '<Leader>fg', '<cmd>Telescope live_grep<CR>' },
|
||||
{ '<Leader>fc', '<cmd>Telescope git_commits<CR>' },
|
||||
{ '<Leader>fd', '<cmd>Telescope diagnostics<CR>' },
|
||||
},
|
||||
config = function()
|
||||
local telescope = require("telescope")
|
||||
|
||||
telescope.load_extension("fzf")
|
||||
|
||||
telescope.setup({
|
||||
pickers = {
|
||||
find_files = {
|
||||
hidden = true,
|
||||
},
|
||||
},
|
||||
defaults = {
|
||||
selection_caret = " ",
|
||||
path_display = { "truncate" },
|
||||
file_ignore_patterns = {
|
||||
".git/",
|
||||
"target/",
|
||||
"docs/",
|
||||
"vendor/*",
|
||||
"%.lock",
|
||||
"pycache/*",
|
||||
"%.sqlite3",
|
||||
"%.ipynb",
|
||||
"node_modules/*",
|
||||
"%.svg",
|
||||
"%.otf",
|
||||
"%.ttf",
|
||||
"%.webp",
|
||||
".dart_tool/",
|
||||
".github/",
|
||||
".gradle/",
|
||||
".idea/",
|
||||
".settings/",
|
||||
".vscode/",
|
||||
"pycache/",
|
||||
"build/",
|
||||
"env/",
|
||||
"gradle/",
|
||||
"node_modules/",
|
||||
"%.pdb",
|
||||
"%.dll",
|
||||
"%.class",
|
||||
"%.exe",
|
||||
"%.cache",
|
||||
"%.ico",
|
||||
"%.pdf",
|
||||
"%.dylib",
|
||||
"%.jar",
|
||||
"%.docx",
|
||||
"%.met",
|
||||
"smalljre_*/*",
|
||||
".vale/",
|
||||
"%.burp",
|
||||
"%.mp4",
|
||||
"%.mkv",
|
||||
"%.rar",
|
||||
"%.zip",
|
||||
"%.7z",
|
||||
"%.tar",
|
||||
"%.bz2",
|
||||
"%.epub",
|
||||
"%.flac",
|
||||
"%.tar.gz",
|
||||
},
|
||||
}
|
||||
})
|
||||
end
|
||||
}
|
||||
41
home/user/.config/nvim/lua/base/plugins/toggleterm.lua
Normal file
41
home/user/.config/nvim/lua/base/plugins/toggleterm.lua
Normal file
@ -0,0 +1,41 @@
|
||||
|
||||
local function set_term_keymap(key, cmd)
|
||||
local opts = { noremap = true, silent = true }
|
||||
local key_string = string.format([[<Leader>%s]], key)
|
||||
local cmd_string = string.format([[<cmd>%s<CR>]], cmd)
|
||||
vim.api.nvim_set_keymap('t', key_string, cmd_string, opts)
|
||||
end
|
||||
|
||||
local function set_term_keymaps()
|
||||
set_term_keymap('t', 'ToggleTerm')
|
||||
set_term_keymap('qa', 'qa!')
|
||||
set_term_keymap('qq', 'bd!')
|
||||
end
|
||||
|
||||
|
||||
return {
|
||||
"akinsho/toggleterm.nvim",
|
||||
config = function()
|
||||
vim.api.nvim_create_autocmd('TermEnter', {
|
||||
pattern = 'term://*toggleterm#*',
|
||||
callback = set_term_keymaps
|
||||
})
|
||||
|
||||
local terminal_default = require('toggleterm.terminal').Terminal:new({
|
||||
direction = 'horizontal',
|
||||
})
|
||||
|
||||
function _TERMINAL_TOGGLE()
|
||||
terminal_default:toggle()
|
||||
end
|
||||
|
||||
require("toggleterm").setup({
|
||||
direction = "horizontal",
|
||||
shell = vim.o.shell,
|
||||
hide_numbers = true,
|
||||
})
|
||||
end,
|
||||
keys = {
|
||||
{"<Leader>t", "<cmd>lua _TERMINAL_TOGGLE()<CR>"},
|
||||
}
|
||||
}
|
||||
@ -6,12 +6,5 @@ return {
|
||||
{
|
||||
'sgur/vim-textobj-parameter',
|
||||
dependencies = { 'kana/vim-textobj-user' }
|
||||
},
|
||||
{
|
||||
'chaoren/vim-wordmotion',
|
||||
},
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||
dependencies = { 'nvim-treesitter/nvim-treesitter' },
|
||||
},
|
||||
}
|
||||
}
|
||||
6
home/user/.config/nvim/lua/base/plugins/which_key.lua
Normal file
6
home/user/.config/nvim/lua/base/plugins/which_key.lua
Normal file
@ -0,0 +1,6 @@
|
||||
return {
|
||||
'folke/which-key.nvim',
|
||||
config = function()
|
||||
require("which-key").setup()
|
||||
end
|
||||
}
|
||||
@ -1,31 +0,0 @@
|
||||
|
||||
local function install_lazy_if_not_installed(lazypath)
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git", "clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable",
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
install_lazy_if_not_installed(lazypath)
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
|
||||
require("lazy").setup(
|
||||
"plugins",
|
||||
{
|
||||
change_detection = { enabled = false },
|
||||
lockfile = vim.fn.stdpath("data") .. "/lazy-lock.json",
|
||||
ui = { border = "rounded" },
|
||||
performance = {
|
||||
cache = {
|
||||
enabled = true,
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
@ -1,2 +0,0 @@
|
||||
require("core.mappings.mappings")
|
||||
require("core.mappings.run-scripts")
|
||||
@ -1,190 +0,0 @@
|
||||
local map = vim.keymap.set
|
||||
|
||||
|
||||
vim.g.mapleader = ','
|
||||
|
||||
|
||||
|
||||
-- Sections
|
||||
map('n', '<Leader>h', '', {desc = "UI"})
|
||||
map('n', '<Leader>c', '', {desc = "Colorschemes"})
|
||||
map('n', '<Leader>f', '', {desc = "Telescope"})
|
||||
map('n', '<Leader>p', '', {desc = "Config manage"})
|
||||
map('n', '<Leader>q', '', {desc = "Exits"})
|
||||
map('n', '<Leader>r', '', {desc = "Run file"})
|
||||
|
||||
|
||||
local function create_function_tabdo(command)
|
||||
return function()
|
||||
local curr_tab = vim.fn.tabpagenr()
|
||||
vim.cmd.tabdo(command)
|
||||
vim.cmd.tabn(curr_tab)
|
||||
end
|
||||
end
|
||||
|
||||
map('n', '<Leader>hc', create_function_tabdo('set cursorline!'),
|
||||
{desc = "Toggle line highlighting"})
|
||||
|
||||
map('n', '<Leader>cs',
|
||||
function() vim.fn.setreg('/', '\\%x') end,
|
||||
{desc = "Clear search"})
|
||||
|
||||
map('n', '<Leader>h/', function() vim.o.hlsearch = not vim.o.hlsearch end, {desc = "Clear search"})
|
||||
|
||||
|
||||
-- enable search highlight in search mode
|
||||
map('n', '/', ':set hlsearch<CR>/', {silent = true})
|
||||
|
||||
-- copy selection to search line
|
||||
map('v', '<C-f>', '"fy:set hlsearch<CR>/\\V<C-r>f\\C<CR>')
|
||||
|
||||
-- copy word under cursor to search line
|
||||
map('n', '<C-f>', ':set hlsearch<CR>/\\V<C-r><C-w>\\C<CR>')
|
||||
|
||||
map('n', '<Leader>hl', create_function_tabdo('lua toggle_number_style()'),
|
||||
{desc = "Toggle line number style"})
|
||||
|
||||
|
||||
map('n', '~', 'vg~', {desc = "Toggle character case"})
|
||||
map('n', 'Ё', 'vg~', {desc = "Toggle character case"})
|
||||
|
||||
map('v', 'Ё', '~', {desc = "Toggle character case"})
|
||||
|
||||
|
||||
map('n',
|
||||
'.',
|
||||
function()
|
||||
local current_position = vim.api.nvim_win_get_cursor(0)
|
||||
vim.cmd('norm! .')
|
||||
vim.api.nvim_win_set_cursor(0, current_position)
|
||||
end,
|
||||
{remap = false, silent = true}
|
||||
)
|
||||
|
||||
map('n', 'q:', ':')
|
||||
map('n', 'Ж', ':')
|
||||
|
||||
map('n', '<Enter>', 'o<ESC>')
|
||||
|
||||
|
||||
-- x to blackhole
|
||||
map({'n', 'v'}, 'x', '"_x')
|
||||
|
||||
|
||||
-- Put without overwrite yanked text
|
||||
map('v', 'p', 'P')
|
||||
|
||||
-- map \ to prev finding
|
||||
map({"n", "v"}, [[\]], ',')
|
||||
|
||||
-- Select all
|
||||
map('n', '<C-a>', 'mvggVG')
|
||||
map('v', '<C-a>', '<Esc>`v:delmarks v<CR>', {silent = true})
|
||||
|
||||
|
||||
map("n", '<Leader>qq', '<cmd>bd!<CR>',
|
||||
{desc = "Kill current buffer"})
|
||||
|
||||
map("n", '<Leader>qa', '<cmd>qa!<CR>',
|
||||
{desc = "Exit without saving"})
|
||||
|
||||
|
||||
map("n", '<Leader>he', '<cmd>set list!<CR>',
|
||||
{desc = "Show hidden symbols"})
|
||||
vim.opt.listchars=[[tab:→\ ,eol:↵,trail:·,extends:↷,precedes:↶]]
|
||||
|
||||
|
||||
map("n", "<Leader>pl", "<cmd>Lazy<CR>",
|
||||
{desc = "Package manager"})
|
||||
|
||||
map("n", "<Leader>pm", "<cmd>Mason<CR>",
|
||||
{desc = "LSP Manager"})
|
||||
|
||||
|
||||
-- Tab to go prev buffer
|
||||
map("n", "<TAB>", ":b#<CR>", {silent = true})
|
||||
|
||||
|
||||
-- Expand %% to dirname of current file in command line
|
||||
map("c", '%%', [[getcmdtype() == ':' ? expand('%:h').'/' : '%%']], {expr = true})
|
||||
|
||||
|
||||
-- Save from root
|
||||
vim.api.nvim_create_user_command('W', [[execute 'silent! write !SUDO_ASKPASS=vim_askpass_helper sudo -A tee % >/dev/null' <bar> edit!]], {})
|
||||
vim.api.nvim_create_user_command('X', [[execute 'silent! write !SUDO_ASKPASS=vim_askpass_helper sudo -A tee % >/dev/null' <bar> edit! | q]], {})
|
||||
vim.cmd([[autocmd FileChangedRO * set readonly!]])
|
||||
|
||||
|
||||
-- Toggle line number style
|
||||
function toggle_number_style()
|
||||
local opt = vim.opt
|
||||
local number = opt.number["_value"]
|
||||
local relativenumber = opt.relativenumber["_value"]
|
||||
|
||||
if (not number) and (not relativenumber) then
|
||||
opt.number = true
|
||||
opt.relativenumber = false
|
||||
elseif (number) and (not relativenumber) then
|
||||
opt.number = false
|
||||
opt.relativenumber = true
|
||||
elseif (not number) and (relativenumber) then
|
||||
opt.number = true
|
||||
opt.relativenumber = true
|
||||
elseif (number) and (relativenumber) then
|
||||
opt.number = false
|
||||
opt.relativenumber = false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function reload_config()
|
||||
vim.cmd.source(vim.env.MYVIMRC)
|
||||
vim.notify('Config reloaded...', vim.log.levels.INFO)
|
||||
end
|
||||
|
||||
local function fetch_config()
|
||||
vim.fn.system('git -C ~/dotfiles pull')
|
||||
end
|
||||
|
||||
local function update_plugins()
|
||||
vim.cmd("Lazy sync")
|
||||
end
|
||||
|
||||
local function fetch_and_reload_config_and_update_plugins()
|
||||
fetch_config()
|
||||
reload_config()
|
||||
update_plugins()
|
||||
end
|
||||
|
||||
map("n", "<Leader>pr", reload_config,
|
||||
{desc = "Reload config"})
|
||||
|
||||
map("n", "<Leader>pR", fetch_and_reload_config_and_update_plugins,
|
||||
{desc = "Fetch and reload config and update plugins"})
|
||||
|
||||
|
||||
vim.cmd([[
|
||||
menu Encoding.utf-8 :e ++enc=utf8<CR>
|
||||
menu Encoding.windows-1251 :e ++enc=cp1251 ++ff=dos<CR>
|
||||
menu Encoding.koi8-r :e ++enc=koi8-r ++ff=unix<CR>
|
||||
menu Encoding.cp866 :e ++enc=cp866 ++ff=dos<CR>
|
||||
menu Encoding.koi8-u :e ++enc=koi8-u ++ff=unix<CR>
|
||||
|
||||
map <F8> :emenu Encoding.
|
||||
]])
|
||||
|
||||
|
||||
vim.cmd([[
|
||||
menu Indent.tabs :set noexpandtab tabstop=4 shiftwidth=4<CR>
|
||||
menu Indent.spaces :set expandtab tabstop=4 shiftwidth=4<CR>
|
||||
|
||||
map <F7> :emenu Indent.
|
||||
]])
|
||||
|
||||
|
||||
map("n", "<Leader>cd", "<cmd>colorscheme default<CR>")
|
||||
map("n", "<Leader>cn", "<cmd>colorscheme nightfox<CR>")
|
||||
|
||||
map("n", "<Leader>ct", "<cmd>colorscheme elflord<CR>",
|
||||
{desc = "TTY colorscheme"}
|
||||
)
|
||||
@ -1,35 +0,0 @@
|
||||
|
||||
|
||||
local function map_filetype(filetype, key, cmd)
|
||||
local function format_string()
|
||||
local run_script_string = [[:terminal %s <CR> :set nocursorline number norelativenumber <CR> G]]
|
||||
local cmd_string = string.format(run_script_string, cmd)
|
||||
|
||||
local opts = { noremap = true, silent = true }
|
||||
vim.keymap.set('n', key, cmd_string, opts)
|
||||
end
|
||||
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType",
|
||||
{ pattern = filetype, callback = format_string}
|
||||
)
|
||||
end
|
||||
|
||||
map_filetype('*', '<Leader>rs', '$(head -1 % | cut -c 3-) %')
|
||||
|
||||
map_filetype('nroff', '<Leader>rr', 'man -P cat -l %')
|
||||
map_filetype('markdown', '<Leader>rr', 'pandoc -t plain %')
|
||||
|
||||
map_filetype('python', '<Leader>rr', 'python3 %')
|
||||
map_filetype('python', '<Leader>rt', 'pytest %')
|
||||
|
||||
map_filetype('go', '<Leader>rr', 'go run %')
|
||||
|
||||
map_filetype('rust', '<Leader>rr', 'cargo run')
|
||||
|
||||
map_filetype('c', '<Leader>rr', 'gcc -o "${TMPDIR}/a.out" % && "${TMPDIR}/a.out"')
|
||||
map_filetype('cpp', '<Leader>rr', 'g++ -o "${TMPDIR}/a.out" % && "${TMPDIR}/a.out"')
|
||||
|
||||
map_filetype('asm', '<Leader>rr', 'as -o "${TMPDIR}/out.o" % && ld -o "${TMPDIR}/a.out" "${TMPDIR}/out.o" && "${TMPDIR}/a.out"')
|
||||
|
||||
map_filetype('make', '<Leader>rr', 'make -C "$(dirname "%")"')
|
||||
@ -1,137 +0,0 @@
|
||||
local border_opts = {
|
||||
border = "rounded",
|
||||
winhighlight = "Normal:Normal,FloatBorder:FloatBorder,CursorLine:Visual,Search:None",
|
||||
max_width = 50,
|
||||
min_width = 50,
|
||||
max_height = math.floor(vim.o.lines * 0.4),
|
||||
min_height = 3,
|
||||
}
|
||||
|
||||
local function has_words_before()
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||
end
|
||||
|
||||
local function setup_cmp()
|
||||
local cmp = require("cmp")
|
||||
|
||||
cmp.setup({
|
||||
preselect = cmp.PreselectMode.None,
|
||||
completion = {
|
||||
completeopt = 'menu,menuone,noinsert,noselect',
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
vim.snippet.expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<Tab>'] = cmp.mapping(
|
||||
function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Select,
|
||||
select = true,
|
||||
})
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
{ "i", "s" }
|
||||
),
|
||||
['<C-k>'] = cmp.mapping.select_prev_item({ behaviour = cmp.SelectBehavior.Select }),
|
||||
['<C-j>'] = cmp.mapping.select_next_item({ behaviour = cmp.SelectBehavior.Select }),
|
||||
['<C-p>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-n>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
}),
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(border_opts),
|
||||
documentation = cmp.config.window.bordered(border_opts),
|
||||
},
|
||||
sorting = {
|
||||
priority_weight = 1.0,
|
||||
comparators = {
|
||||
cmp.config.compare.score,
|
||||
cmp.config.compare.locality,
|
||||
cmp.config.compare.recently_used,
|
||||
cmp.config.compare.offset,
|
||||
require("cmp-under-comparator").under,
|
||||
cmp.config.compare.order,
|
||||
},
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp', priority = 1500 },
|
||||
{ name = 'luasnip', priority = 1250 },
|
||||
{ name = 'buffer', priority = 1000 },
|
||||
{ name = 'tmux', priority = 750 },
|
||||
{ name = "dotenv", priority = 500 },
|
||||
{ name = 'path', priority = 250 },
|
||||
}),
|
||||
})
|
||||
end
|
||||
|
||||
return {
|
||||
{
|
||||
'L3MON4D3/LuaSnip',
|
||||
event = "InsertEnter",
|
||||
build = "make install_jsregexp",
|
||||
dependencies = {
|
||||
'hrsh7th/nvim-cmp',
|
||||
'honza/vim-snippets',
|
||||
},
|
||||
config = function()
|
||||
local ls = require("luasnip")
|
||||
|
||||
vim.g.snips_author = 'thek4n'
|
||||
vim.g.snips_email = 'thek4n@yandex.com'
|
||||
vim.g.snips_github = 'https://github.com/thek4n'
|
||||
|
||||
local function jump(val)
|
||||
return function()
|
||||
ls.jump(val)
|
||||
end
|
||||
end
|
||||
|
||||
local map = vim.keymap.set
|
||||
map({'i', 's'}, '<C-n>', jump(1), {silent = true})
|
||||
map({'i', 's'}, '<C-p>', jump(-1), {silent = true})
|
||||
map({'i', 's'}, '<C-k>', ls.expand, {silent = true})
|
||||
map({"i", "s"}, "<C-e>",
|
||||
function()
|
||||
if ls.choice_active() then
|
||||
ls.change_choice(1)
|
||||
end
|
||||
end,
|
||||
{silent = true}
|
||||
)
|
||||
|
||||
local luasnip_loaders = require("luasnip.loaders.from_snipmate")
|
||||
|
||||
luasnip_loaders.lazy_load()
|
||||
end
|
||||
},
|
||||
{
|
||||
'hrsh7th/nvim-cmp',
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
'saadparwaiz1/cmp_luasnip',
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'lukas-reineke/cmp-under-comparator',
|
||||
'SergioRibera/cmp-dotenv',
|
||||
'andersevenrud/cmp-tmux',
|
||||
},
|
||||
config = setup_cmp,
|
||||
},
|
||||
{
|
||||
'neovim/nvim-lspconfig',
|
||||
event = "InsertEnter",
|
||||
config = function()
|
||||
vim.diagnostic.config({ virtual_text = true })
|
||||
end,
|
||||
},
|
||||
}
|
||||
@ -1,189 +0,0 @@
|
||||
return {
|
||||
{
|
||||
"ellisonleao/dotenv.nvim",
|
||||
config = function()
|
||||
require('dotenv').setup({
|
||||
enable_on_load = true, -- will load your .env file upon loading a buffer
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
pattern = "*", callback = require('dotenv').autocmd
|
||||
})
|
||||
end
|
||||
},
|
||||
{
|
||||
"ThePrimeagen/refactoring.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
},
|
||||
config = function()
|
||||
require("telescope").load_extension("refactoring")
|
||||
end,
|
||||
keys = {
|
||||
{ "<space>r", "", desc = "Refactoring", mode = {"n", "v"} },
|
||||
{
|
||||
"<space>rr",
|
||||
":lua require('refactoring').select_refactor()<CR>",
|
||||
desc = "Select refactoring",
|
||||
mode = {"n", "x"},
|
||||
},
|
||||
-- Refactoring operations
|
||||
{
|
||||
"<space>re",
|
||||
"<Esc><Cmd>lua require('refactoring').refactor('Extract Function')<CR>",
|
||||
desc = "Extract Function",
|
||||
mode = "x",
|
||||
},
|
||||
{
|
||||
"<space>rf",
|
||||
"<Esc><Cmd>lua require('refactoring').refactor('Extract Function To File')<CR>",
|
||||
desc = "Extract Function To File",
|
||||
mode = "x",
|
||||
},
|
||||
{
|
||||
"<space>rv",
|
||||
"<Esc><Cmd>lua require('refactoring').refactor('Extract Variable')<CR>",
|
||||
desc = "Extract Variable",
|
||||
mode = "x",
|
||||
},
|
||||
{
|
||||
"<space>rI",
|
||||
"<Esc><Cmd>lua require('refactoring').refactor('Inline Function')<CR>",
|
||||
desc = "Inline Function",
|
||||
mode = "n",
|
||||
},
|
||||
{
|
||||
"<space>ri",
|
||||
"<Esc><Cmd>lua require('refactoring').refactor('Inline Variable')<CR>",
|
||||
desc = "Inline Variable",
|
||||
mode = {"n", "x"},
|
||||
},
|
||||
-- Extract block
|
||||
{
|
||||
"<space>rb",
|
||||
"<Cmd>lua require('refactoring').refactor('Extract Block')<CR>",
|
||||
desc = "Extract Block",
|
||||
mode = "n",
|
||||
},
|
||||
{
|
||||
"<space>rbf",
|
||||
"<Cmd>lua require('refactoring').refactor('Extract Block To File')<CR>",
|
||||
desc = "Extract Block To File",
|
||||
mode = "n",
|
||||
},
|
||||
-- Telescope
|
||||
{
|
||||
"<leader>fr",
|
||||
"<Cmd>lua require('telescope').extensions.refactoring.refactors()<CR>",
|
||||
desc = "Telescope refactorings",
|
||||
mode = "n",
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
'folke/neodev.nvim',
|
||||
ft = {'lua'},
|
||||
dependencies = {
|
||||
'neovim/nvim-lspconfig'
|
||||
},
|
||||
config = function()
|
||||
require('neodev').setup()
|
||||
end
|
||||
},
|
||||
{
|
||||
'folke/trouble.nvim',
|
||||
dependencies = { 'kyazdani42/nvim-web-devicons' },
|
||||
config = function()
|
||||
require("trouble").setup()
|
||||
|
||||
vim.keymap.set("n", "<space>x", "", {desc = "Diagnostics"})
|
||||
local function set_trouble_keymap(key, cmd, opts)
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
string.format("<space>x%s", key),
|
||||
string.format("<cmd>Trouble %s<CR>", cmd),
|
||||
opts
|
||||
)
|
||||
end
|
||||
|
||||
set_trouble_keymap("x", "diagnostics toggle", {desc = "Workspace diagnostics window"})
|
||||
set_trouble_keymap("X", "diagnostics toggle filter.buf=0", {desc = "Buffer diagnostics window"})
|
||||
set_trouble_keymap("Q", "qflist toggle", {desc = "Qflist"})
|
||||
set_trouble_keymap("l", "lsp toggle focus=false win.position=right", {desc = "Toggle LSP diagnostics"})
|
||||
|
||||
end
|
||||
},
|
||||
{
|
||||
'lewis6991/gitsigns.nvim',
|
||||
event = "BufReadPost",
|
||||
enabled = vim.fn.executable "git" == 1,
|
||||
config = function()
|
||||
require("gitsigns").setup({
|
||||
signs = {
|
||||
add = { text = "+" },
|
||||
change = { text = "|" },
|
||||
delete = { text = "-" },
|
||||
topdelete = { text = "^" },
|
||||
changedelete = { text = "~" },
|
||||
untracked = { text = "0" },
|
||||
},
|
||||
signs_staged = {
|
||||
add = { text = '+' },
|
||||
change = { text = '|' },
|
||||
delete = { text = '-' },
|
||||
topdelete = { text = "^" },
|
||||
changedelete = { text = '~' },
|
||||
untracked = { text = '0' },
|
||||
},
|
||||
signs_staged_enable = true,
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<space>g", "", {desc = "Git actions"})
|
||||
local function set_gitsigns_keymap(key, cmd, opts)
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
string.format("<space>g%s", key),
|
||||
string.format("<cmd>Gitsigns %s<CR>", cmd),
|
||||
opts
|
||||
)
|
||||
end
|
||||
|
||||
set_gitsigns_keymap('p', 'preview_hunk', {desc = "Preview hunk"})
|
||||
set_gitsigns_keymap('b', 'blame_line', {desc = "Show line commit info"})
|
||||
set_gitsigns_keymap('n', 'next_hunk', {desc = "Next changes"})
|
||||
set_gitsigns_keymap('N', 'prev_hunk', {desc = "Previous changes"})
|
||||
set_gitsigns_keymap('r', 'reset_hunk', {desc = "Reset changes"})
|
||||
set_gitsigns_keymap('h', 'toggle_linehl', {desc = "Toggle changes highlight"})
|
||||
end
|
||||
},
|
||||
{
|
||||
"wsdjeg/vim-fetch",
|
||||
},
|
||||
{
|
||||
"aznhe21/actions-preview.nvim",
|
||||
dependencies = {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
'MunifTanjim/nui.nvim'
|
||||
},
|
||||
config = function()
|
||||
require("actions-preview").setup {
|
||||
telescope = {
|
||||
sorting_strategy = "ascending",
|
||||
layout_strategy = "vertical",
|
||||
layout_config = {
|
||||
width = 0.8,
|
||||
height = 0.9,
|
||||
prompt_position = "top",
|
||||
preview_cutoff = 20,
|
||||
preview_height = function(_, _, max_lines)
|
||||
return max_lines - 15
|
||||
end,
|
||||
},
|
||||
},
|
||||
}
|
||||
vim.keymap.set("n", "<space>c", "", {desc = "Code action"})
|
||||
vim.keymap.set("n", "<space>ca", require("actions-preview").code_actions, {desc = "Code action"})
|
||||
end,
|
||||
},
|
||||
}
|
||||
@ -1,80 +0,0 @@
|
||||
|
||||
local lsp_have_feature = {
|
||||
rename = function(client)
|
||||
return client.supports_method "textDocument/rename"
|
||||
end,
|
||||
inlay_hint = function(client)
|
||||
return client.supports_method "textDocument/inlayHint"
|
||||
end,
|
||||
}
|
||||
|
||||
local function get_lsp_client_names(have_feature)
|
||||
local client_names = {}
|
||||
local attached_clients = vim.lsp.get_clients { bufnr = 0 }
|
||||
for _, client in ipairs(attached_clients) do
|
||||
if have_feature(client) then
|
||||
table.insert(client_names, client.name)
|
||||
end
|
||||
end
|
||||
return client_names
|
||||
end
|
||||
|
||||
local function lsp_buf_rename(client_name)
|
||||
vim.lsp.buf.rename(nil, { name = client_name })
|
||||
end
|
||||
|
||||
function LSP_BUF_RENAME_USE_ANY(fallback)
|
||||
local client_names = get_lsp_client_names(lsp_have_feature.rename)
|
||||
for _, client_name in ipairs(client_names) do
|
||||
lsp_buf_rename(client_name)
|
||||
return
|
||||
end
|
||||
if fallback then
|
||||
fallback()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
return {
|
||||
{
|
||||
'mason-org/mason.nvim',
|
||||
dependencies = {
|
||||
'neovim/nvim-lspconfig',
|
||||
"mason-org/mason-lspconfig.nvim",
|
||||
'nvim-telescope/telescope.nvim',
|
||||
},
|
||||
config = function()
|
||||
-- Mappings.
|
||||
local opts = { noremap=true, silent=true }
|
||||
|
||||
local function desc(description)
|
||||
return vim.tbl_extend("keep", opts, {desc = description})
|
||||
end
|
||||
|
||||
-- Sections
|
||||
vim.api.nvim_set_keymap('n', '<space>w', '', {desc = "Workspace manage"})
|
||||
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
vim.api.nvim_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', desc("Go declaration"))
|
||||
vim.api.nvim_set_keymap('n', 'gd', '<cmd>Telescope lsp_definitions<CR>', desc("Go definition"))
|
||||
vim.api.nvim_set_keymap('n', 'gi', '<cmd>Telescope lsp_implementations<CR>', desc("Go implementation"))
|
||||
vim.api.nvim_set_keymap('n', 'gr', '<cmd>Telescope lsp_references<CR>', desc("Go references"))
|
||||
vim.api.nvim_set_keymap('n', 'gt', '<cmd>Telescope lsp_type_definitions<CR>', desc("Go type references"))
|
||||
vim.api.nvim_set_keymap('n', '<space>k', '<cmd>lua vim.lsp.buf.hover()<CR>', desc("Show help"))
|
||||
vim.api.nvim_set_keymap('n', '<space>K', '<cmd>lua vim.lsp.buf.signature_help()<CR>', desc("Show signature"))
|
||||
vim.api.nvim_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', desc("Add workspace folder"))
|
||||
vim.api.nvim_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', desc("Remove workspace folder"))
|
||||
vim.api.nvim_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', desc("Show workspace folders"))
|
||||
vim.api.nvim_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', desc("Show type"))
|
||||
vim.api.nvim_set_keymap('n', '<space>rn', "<cmd>lua LSP_BUF_RENAME_USE_ANY()<CR>", desc("Rename object"))
|
||||
vim.api.nvim_set_keymap('n', '<space>e', '<cmd>lua vim.diagnostic.open_float()<CR>', desc("Show diagnostic"))
|
||||
vim.api.nvim_set_keymap('n', '<space>p', '<cmd>lua vim.diagnostic.goto_prev()<CR>', desc("Previous problem"))
|
||||
vim.api.nvim_set_keymap('n', '<space>n', '<cmd>lua vim.diagnostic.goto_next()<CR>', desc("Next problem"))
|
||||
vim.api.nvim_set_keymap('n', '<space>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', opts)
|
||||
vim.api.nvim_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.format()<CR>', desc("Format file"))
|
||||
|
||||
require("mason").setup()
|
||||
require("mason-lspconfig").setup()
|
||||
end,
|
||||
},
|
||||
}
|
||||
@ -1,128 +0,0 @@
|
||||
return {
|
||||
'tpope/vim-repeat',
|
||||
'google/vim-searchindex',
|
||||
'preservim/vim-pencil',
|
||||
{
|
||||
'windwp/nvim-autopairs',
|
||||
desc = "Auto pair brackets and tags",
|
||||
event = "InsertEnter",
|
||||
opts = {
|
||||
disable_in_macro = true,
|
||||
}
|
||||
},
|
||||
{
|
||||
"kylechui/nvim-surround",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("nvim-surround").setup()
|
||||
end
|
||||
},
|
||||
{
|
||||
'windwp/nvim-ts-autotag',
|
||||
config = function()
|
||||
require("nvim-ts-autotag").setup()
|
||||
end
|
||||
},
|
||||
{
|
||||
'numToStr/Comment.nvim',
|
||||
keys = { { "gc" }, { "gc", mode = "v" } },
|
||||
config = function()
|
||||
require("Comment").setup()
|
||||
end
|
||||
},
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
build = ':TSUpdate',
|
||||
event = "BufReadPost",
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
ensure_installed = {"python", "lua", "vim", "html", "rust", "markdown", "regex"},
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
enable = true,
|
||||
}
|
||||
})
|
||||
end
|
||||
},
|
||||
{
|
||||
"thek4n/mdimage.nvim",
|
||||
config = function()
|
||||
require("mdimage").setup({
|
||||
target_path = "./.img",
|
||||
})
|
||||
end
|
||||
},
|
||||
{
|
||||
"thek4n/postman.nvim",
|
||||
keys = {"<leader>rl"},
|
||||
cmd = {"PostmanExec"},
|
||||
config = function()
|
||||
vim.keymap.set("n", "<Leader>rl", '<cmd>PostmanExec<CR>')
|
||||
end
|
||||
},
|
||||
{
|
||||
'monaqa/dial.nvim',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
keys = {"+", "-"},
|
||||
config = function()
|
||||
local augend = require("dial.augend")
|
||||
|
||||
require("dial.config").augends:register_group{
|
||||
default = {
|
||||
augend.integer.alias.decimal_int,
|
||||
augend.semver.alias.semver,
|
||||
augend.constant.alias.bool
|
||||
},
|
||||
}
|
||||
|
||||
vim.keymap.set("n", "+", function()
|
||||
require("dial.map").manipulate("increment", "normal")
|
||||
end)
|
||||
vim.keymap.set("n", "-", function()
|
||||
require("dial.map").manipulate("decrement", "normal")
|
||||
end)
|
||||
end
|
||||
},
|
||||
{
|
||||
'chentoast/marks.nvim',
|
||||
config = function()
|
||||
require("marks").setup()
|
||||
end
|
||||
},
|
||||
{
|
||||
'Pocco81/auto-save.nvim',
|
||||
config = function()
|
||||
require("auto-save").setup({
|
||||
enabled = true, -- start auto-save when the plugin is loaded (i.e. when your package manager loads it)
|
||||
execution_message = {
|
||||
message = function() -- message to print on save
|
||||
return ""
|
||||
end,
|
||||
dim = 0.18, -- dim the color of `message`
|
||||
cleaning_interval = 1250, -- (milliseconds) automatically clean MsgArea after displaying `message`. See :h MsgArea
|
||||
},
|
||||
trigger_events = {"InsertLeave", "TextChanged"}, -- vim events that trigger auto-save. See :h events
|
||||
condition = function(buf)
|
||||
local fn = vim.fn
|
||||
local utils = require("auto-save.utils.data")
|
||||
if
|
||||
fn.getbufvar(buf, "&modifiable") == 1 and
|
||||
utils.not_in(fn.getbufvar(buf, "&filetype"), {})
|
||||
then
|
||||
return true -- met condition(s), can save
|
||||
end
|
||||
return false -- can't save
|
||||
end,
|
||||
write_all_buffers = false, -- write all buffers when the current one meets `condition`
|
||||
debounce_delay = 135, -- saves the file at most every `debounce_delay` milliseconds
|
||||
callbacks = { -- functions to be executed at different intervals
|
||||
enabling = nil, -- ran when enabling auto-save
|
||||
disabling = nil, -- ran when disabling auto-save
|
||||
before_asserting_save = nil, -- ran before checking `condition`
|
||||
before_saving = nil, -- ran before doing the actual save
|
||||
after_saving = nil -- ran after doing the actual save
|
||||
}
|
||||
})
|
||||
end
|
||||
},
|
||||
}
|
||||
@ -1,129 +0,0 @@
|
||||
return {
|
||||
{
|
||||
'nvim-telescope/telescope.nvim',
|
||||
enabled = vim.fn.executable("fzf") == 1,
|
||||
dependencies = {
|
||||
{
|
||||
'nvim-lua/plenary.nvim',
|
||||
},
|
||||
{
|
||||
'nvim-telescope/telescope-fzf-native.nvim',
|
||||
enabled = vim.fn.executable("make") == 1,
|
||||
build = "make"
|
||||
},
|
||||
},
|
||||
cmd = {
|
||||
"Telescope"
|
||||
},
|
||||
previewers = {
|
||||
buffer_previewer_maker = require('telescope.previewers').buffer_previewer_maker
|
||||
},
|
||||
keys = {
|
||||
{ '<Leader>fb', '<cmd>Telescope buffers<CR>' },
|
||||
{ '<Leader>ff', '<cmd>Telescope find_files<CR>' },
|
||||
{ '<Leader>fg', '<cmd>Telescope live_grep<CR>' },
|
||||
{ '<Leader>fc', '<cmd>Telescope git_commits<CR>' },
|
||||
{ '<Leader>fd', '<cmd>Telescope diagnostics<CR>' },
|
||||
{ '<Leader><Leader>', '<cmd>Telescope buffers<CR>' },
|
||||
},
|
||||
config = function()
|
||||
local telescope = require("telescope")
|
||||
local actions = require("telescope.actions")
|
||||
|
||||
telescope.load_extension("fzf")
|
||||
|
||||
telescope.setup({
|
||||
pickers = {
|
||||
find_files = {
|
||||
hidden = true,
|
||||
},
|
||||
},
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-j>"] = actions.move_selection_next,
|
||||
["<C-k>"] = actions.move_selection_previous,
|
||||
["<C-n>"] = actions.preview_scrolling_down,
|
||||
["<C-p>"] = actions.preview_scrolling_up,
|
||||
["<C-a>"] = actions.toggle_all,
|
||||
["<C-o>"] = actions.toggle_selection,
|
||||
},
|
||||
n = {
|
||||
["<C-j>"] = actions.move_selection_next,
|
||||
["<C-k>"] = actions.move_selection_previous,
|
||||
["<C-n>"] = actions.preview_scrolling_down,
|
||||
["<C-p>"] = actions.preview_scrolling_up,
|
||||
["<C-a>"] = actions.toggle_all,
|
||||
}
|
||||
},
|
||||
selection_caret = " ",
|
||||
path_display = { "truncate" },
|
||||
file_ignore_patterns = {
|
||||
"%.git/",
|
||||
"%.svn/",
|
||||
"%.o",
|
||||
"%.a",
|
||||
"%.so",
|
||||
"a%.out",
|
||||
"venv/",
|
||||
"CMakeFiles/",
|
||||
"cmake_install%.cmake",
|
||||
"CMakeCache%.txt",
|
||||
"target/",
|
||||
"%.pytest_cache/",
|
||||
"vendor/",
|
||||
"%.lock",
|
||||
"%.db",
|
||||
"%.sqlite3",
|
||||
"%.sqlite",
|
||||
"%.ipynb",
|
||||
"%.svg",
|
||||
"%.burp",
|
||||
"%.mp4",
|
||||
"%.png",
|
||||
"%.jpeg",
|
||||
"%.jpg",
|
||||
"%.gif",
|
||||
"%.mkv",
|
||||
"%.otf",
|
||||
"%.ttf",
|
||||
"%.webp",
|
||||
"%.bin",
|
||||
"%.dart_tool/",
|
||||
"%.gradle/",
|
||||
"%.idea/",
|
||||
"%.settings/",
|
||||
"%.vscode/",
|
||||
"pycache/",
|
||||
"build/",
|
||||
"env/",
|
||||
"gradle/",
|
||||
"node_modules/",
|
||||
"%.pdb",
|
||||
"%.dll",
|
||||
"%.class",
|
||||
"%.exe",
|
||||
"%.cache",
|
||||
"%.ico",
|
||||
"%.pdf",
|
||||
"%.dylib",
|
||||
"%.jar",
|
||||
"%.docx",
|
||||
"%.met",
|
||||
"%.vale/",
|
||||
"%.rar",
|
||||
"%.zip",
|
||||
"%.7z",
|
||||
"%.tar",
|
||||
"%.xz",
|
||||
"%.gz",
|
||||
"%.bz2",
|
||||
"%.epub",
|
||||
"%.flac",
|
||||
"%.tar.gz",
|
||||
},
|
||||
}
|
||||
})
|
||||
end
|
||||
}
|
||||
}
|
||||
@ -1,209 +0,0 @@
|
||||
local function get_virtual_env()
|
||||
return vim.fs.basename(os.getenv("VIRTUAL_ENV"))
|
||||
end
|
||||
|
||||
function GET_FORMATTED_VIRTUAL_ENV()
|
||||
if vim.bo.filetype == 'python' then
|
||||
return "<" .. get_virtual_env() .. ">"
|
||||
end
|
||||
return ""
|
||||
end
|
||||
|
||||
function DETECT_INDENT_TYPE()
|
||||
if vim.bo.expandtab then
|
||||
return vim.bo.shiftwidth .. " spaces"
|
||||
else
|
||||
return vim.bo.shiftwidth / vim.bo.tabstop .. " tabs (" .. vim.bo.tabstop .. ")"
|
||||
end
|
||||
end
|
||||
|
||||
local function is_absolute_path(path)
|
||||
return string.sub(path, 1, 1) == '/' or string.sub(path, 1, 1) == '~'
|
||||
end
|
||||
|
||||
return {
|
||||
{
|
||||
"folke/twilight.nvim",
|
||||
cmd = "Twilight"
|
||||
},
|
||||
{
|
||||
'HiPhish/rainbow-delimiters.nvim',
|
||||
},
|
||||
{
|
||||
'nvim-lualine/lualine.nvim',
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
component_separators = { left = '', right = '' },
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {'mode'},
|
||||
lualine_b = {'branch', 'diff', 'diagnostics'},
|
||||
lualine_c = {
|
||||
{
|
||||
'vim.fn.getcwd()',
|
||||
fmt = function(str)
|
||||
return str:gsub(os.getenv("HOME"), "~")
|
||||
end,
|
||||
color = { fg='white', gui='bold' },
|
||||
padding = { left = 1, right = 0 }
|
||||
},
|
||||
{
|
||||
'filename',
|
||||
fmt = function(str)
|
||||
local res = str
|
||||
|
||||
if is_absolute_path(res) then
|
||||
res = " " .. res
|
||||
else
|
||||
res = "/" .. res
|
||||
end
|
||||
|
||||
return res
|
||||
end,
|
||||
file_status = true,
|
||||
path = 1,
|
||||
padding = { left = 0, right = 1 }
|
||||
},
|
||||
},
|
||||
lualine_x = {'GET_FORMATTED_VIRTUAL_ENV()', 'DETECT_INDENT_TYPE()', 'filetype'},
|
||||
lualine_y = {'searchcount'},
|
||||
lualine_z = {'location', 'selectioncount'},
|
||||
},
|
||||
})
|
||||
end,
|
||||
dependencies = { 'kyazdani42/nvim-web-devicons' },
|
||||
},
|
||||
{
|
||||
'EdenEast/nightfox.nvim',
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
build = function()
|
||||
require("nightfox").compile()
|
||||
end,
|
||||
config = function()
|
||||
require("nightfox").setup({
|
||||
options = {
|
||||
transparent = true,
|
||||
styles = {
|
||||
strings = "italic",
|
||||
comments = "italic",
|
||||
constants = "bold",
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
vim.cmd.colorscheme("nightfox")
|
||||
end
|
||||
},
|
||||
{
|
||||
'ellisonleao/gruvbox.nvim',
|
||||
lazy = true,
|
||||
},
|
||||
{
|
||||
"folke/tokyonight.nvim",
|
||||
lazy = true,
|
||||
},
|
||||
{
|
||||
'xiyaowong/transparent.nvim',
|
||||
enabled = false,
|
||||
lazy = true,
|
||||
config = function()
|
||||
require("transparent").setup({
|
||||
exclude_groups = {'CursorLine'},
|
||||
})
|
||||
end
|
||||
},
|
||||
{
|
||||
'lukas-reineke/virt-column.nvim',
|
||||
lazy = false,
|
||||
config = function()
|
||||
require("virt-column").setup({
|
||||
virtcolumn = '80'
|
||||
})
|
||||
end
|
||||
},
|
||||
{
|
||||
'norcalli/nvim-colorizer.lua',
|
||||
lazy = false,
|
||||
config = function()
|
||||
require('colorizer').setup()
|
||||
end
|
||||
},
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
config = function()
|
||||
require("ibl").setup({
|
||||
scope = { enabled = false },
|
||||
})
|
||||
end,
|
||||
main = "ibl"
|
||||
},
|
||||
{
|
||||
'karb94/neoscroll.nvim',
|
||||
config = function()
|
||||
require('neoscroll').setup({
|
||||
mappings = {'<C-u>', '<C-d>', '<C-b>',
|
||||
'<C-y>', '<C-e>', 'zt', 'zz', 'zb'},
|
||||
respect_scrolloff = true,
|
||||
})
|
||||
end
|
||||
},
|
||||
{
|
||||
'folke/which-key.nvim',
|
||||
config = function()
|
||||
require("which-key").setup()
|
||||
end
|
||||
},
|
||||
{
|
||||
"folke/todo-comments.nvim",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
opts = {}
|
||||
},
|
||||
{
|
||||
"folke/noice.nvim",
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
"MunifTanjim/nui.nvim",
|
||||
},
|
||||
config = function()
|
||||
require("noice").setup({
|
||||
presets = {
|
||||
bottom_search = true,
|
||||
},
|
||||
cmdline = {
|
||||
enabled = true,
|
||||
view = "cmdline_popup",
|
||||
},
|
||||
health = {
|
||||
checker = false,
|
||||
},
|
||||
routes = {
|
||||
{ -- hack to disable search count
|
||||
filter = {
|
||||
event = "msg_show",
|
||||
kind = "echo",
|
||||
["not"] = { cmdline = true },
|
||||
},
|
||||
opts = { skip = true },
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
},
|
||||
{
|
||||
"https://github.com/liangxianzhe/floating-input.nvim.git",
|
||||
config = function()
|
||||
vim.ui.input = function(opts, on_confirm)
|
||||
require("floating-input").input(opts, on_confirm, { border = 'single' })
|
||||
end
|
||||
end
|
||||
},
|
||||
{
|
||||
"petertriho/nvim-scrollbar",
|
||||
config = function()
|
||||
require("scrollbar").setup()
|
||||
end
|
||||
},
|
||||
}
|
||||
434
home/user/.config/picom/picom.conf
Normal file
434
home/user/.config/picom/picom.conf
Normal file
@ -0,0 +1,434 @@
|
||||
|
||||
#################################
|
||||
# Shadows #
|
||||
#################################
|
||||
|
||||
|
||||
# Enabled client-side shadows on windows. Note desktop windows
|
||||
# (windows with '_NET_WM_WINDOW_TYPE_DESKTOP') never get shadow,
|
||||
# unless explicitly requested using the wintypes option.
|
||||
#
|
||||
# shadow = false
|
||||
shadow = true;
|
||||
|
||||
# The blur radius for shadows, in pixels. (defaults to 12)
|
||||
# shadow-radius = 12
|
||||
shadow-radius = 7;
|
||||
|
||||
# The opacity of shadows. (0.0 - 1.0, defaults to 0.75)
|
||||
# shadow-opacity = .75
|
||||
|
||||
# The left offset for shadows, in pixels. (defaults to -15)
|
||||
# shadow-offset-x = -15
|
||||
shadow-offset-x = -7;
|
||||
|
||||
# The top offset for shadows, in pixels. (defaults to -15)
|
||||
# shadow-offset-y = -15
|
||||
shadow-offset-y = -7;
|
||||
|
||||
# Red color value of shadow (0.0 - 1.0, defaults to 0).
|
||||
# shadow-red = 0
|
||||
|
||||
# Green color value of shadow (0.0 - 1.0, defaults to 0).
|
||||
# shadow-green = 0
|
||||
|
||||
# Blue color value of shadow (0.0 - 1.0, defaults to 0).
|
||||
# shadow-blue = 0
|
||||
|
||||
# Hex string color value of shadow (#000000 - #FFFFFF, defaults to #000000). This option will override options set shadow-(red/green/blue)
|
||||
# shadow-color = "#000000"
|
||||
|
||||
# Specify a list of conditions of windows that should have no shadow.
|
||||
#
|
||||
# examples:
|
||||
# shadow-exclude = "n:e:Notification";
|
||||
#
|
||||
# shadow-exclude = []
|
||||
shadow-exclude = [
|
||||
"name = 'Notification'",
|
||||
"class_g = 'Conky'",
|
||||
"class_g ?= 'Notify-osd'",
|
||||
"class_g = 'Cairo-clock'",
|
||||
"_GTK_FRAME_EXTENTS@:c"
|
||||
];
|
||||
|
||||
# Specify a list of conditions of windows that should have no shadow painted over, such as a dock window.
|
||||
# clip-shadow-above = []
|
||||
|
||||
# Specify a X geometry that describes the region in which shadow should not
|
||||
# be painted in, such as a dock window region. Use
|
||||
# shadow-exclude-reg = "x10+0+0"
|
||||
# for example, if the 10 pixels on the bottom of the screen should not have shadows painted on.
|
||||
#
|
||||
# shadow-exclude-reg = ""
|
||||
|
||||
# Crop shadow of a window fully on a particular Xinerama screen to the screen.
|
||||
# xinerama-shadow-crop = false
|
||||
|
||||
|
||||
#################################
|
||||
# Fading #
|
||||
#################################
|
||||
|
||||
|
||||
# Fade windows in/out when opening/closing and when opacity changes,
|
||||
# unless no-fading-openclose is used.
|
||||
fading = false
|
||||
# fading = true;
|
||||
|
||||
# Opacity change between steps while fading in. (0.01 - 1.0, defaults to 0.028)
|
||||
# fade-in-step = 0.028
|
||||
fade-in-step = 0.075;
|
||||
|
||||
# Opacity change between steps while fading out. (0.01 - 1.0, defaults to 0.03)
|
||||
# fade-out-step = 0.03
|
||||
fade-out-step = 0.075;
|
||||
|
||||
# The time between steps in fade step, in milliseconds. (> 0, defaults to 10)
|
||||
# fade-delta = 10
|
||||
|
||||
# Specify a list of conditions of windows that should not be faded.
|
||||
# fade-exclude = []
|
||||
|
||||
# Do not fade on window open/close.
|
||||
# no-fading-openclose = false
|
||||
|
||||
# Do not fade destroyed ARGB windows with WM frame. Workaround of bugs in Openbox, Fluxbox, etc.
|
||||
# no-fading-destroyed-argb = false
|
||||
|
||||
|
||||
#################################
|
||||
# Transparency / Opacity #
|
||||
#################################
|
||||
|
||||
|
||||
# Opacity of inactive windows. (0.1 - 1.0, defaults to 1.0)
|
||||
inactive-opacity = 1
|
||||
# inactive-opacity = 0.95;
|
||||
|
||||
# Opacity of window titlebars and borders. (0.1 - 1.0, disabled by default)
|
||||
# frame-opacity = 1.0
|
||||
frame-opacity = 0.9;
|
||||
|
||||
# Let inactive opacity set by -i override the '_NET_WM_WINDOW_OPACITY' values of windows.
|
||||
# inactive-opacity-override = true
|
||||
inactive-opacity-override = false;
|
||||
|
||||
# Default opacity for active windows. (0.0 - 1.0, defaults to 1.0)
|
||||
# active-opacity = 1.0
|
||||
|
||||
# Dim inactive windows. (0.0 - 1.0, defaults to 0.0)
|
||||
inactive-dim = 0.15
|
||||
|
||||
# Specify a list of conditions of windows that should never be considered focused.
|
||||
# focus-exclude = []
|
||||
focus-exclude = [
|
||||
"class_g = 'firefox'",
|
||||
"class_g = 'webview'",
|
||||
"class_g = 'Cairo-clock'",
|
||||
"class_g = 'Conky'"
|
||||
];
|
||||
|
||||
# Use fixed inactive dim value, instead of adjusting according to window opacity.
|
||||
# inactive-dim-fixed = 1.0
|
||||
|
||||
# Specify a list of opacity rules, in the format `PERCENT:PATTERN`,
|
||||
# like `50:name *= "Firefox"`. picom-trans is recommended over this.
|
||||
# Note we don't make any guarantee about possible conflicts with other
|
||||
# programs that set '_NET_WM_WINDOW_OPACITY' on frame or client windows.
|
||||
# example:
|
||||
# opacity-rule = [ "80:class_g = 'URxvt'" ];
|
||||
#
|
||||
# opacity-rule = []
|
||||
|
||||
|
||||
#################################
|
||||
# Corners #
|
||||
#################################
|
||||
|
||||
# Sets the radius of rounded window corners. When > 0, the compositor will
|
||||
# round the corners of windows. Does not interact well with
|
||||
# `transparent-clipping`.
|
||||
corner-radius = 3
|
||||
|
||||
# Exclude conditions for rounded corners.
|
||||
rounded-corners-exclude = [
|
||||
"window_type = 'dock'",
|
||||
"window_type = 'desktop'"
|
||||
];
|
||||
|
||||
|
||||
#################################
|
||||
# Background-Blurring #
|
||||
#################################
|
||||
|
||||
|
||||
# Parameters for background blurring, see the *BLUR* section for more information.
|
||||
# blur-method =
|
||||
# blur-size = 12
|
||||
#
|
||||
# blur-deviation = false
|
||||
#
|
||||
# blur-strength = 5
|
||||
|
||||
# Blur background of semi-transparent / ARGB windows.
|
||||
# Bad in performance, with driver-dependent behavior.
|
||||
# The name of the switch may change without prior notifications.
|
||||
#
|
||||
# blur-background = false
|
||||
|
||||
# Blur background of windows when the window frame is not opaque.
|
||||
# Implies:
|
||||
# blur-background
|
||||
# Bad in performance, with driver-dependent behavior. The name may change.
|
||||
#
|
||||
# blur-background-frame = false
|
||||
|
||||
|
||||
# Use fixed blur strength rather than adjusting according to window opacity.
|
||||
# blur-background-fixed = false
|
||||
|
||||
|
||||
# Specify the blur convolution kernel, with the following format:
|
||||
# example:
|
||||
# blur-kern = "5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1";
|
||||
#
|
||||
# blur-kern = ""
|
||||
blur-kern = "3x3box";
|
||||
|
||||
|
||||
# Exclude conditions for background blur.
|
||||
# blur-background-exclude = []
|
||||
blur-background-exclude = [
|
||||
"window_type = 'dock'",
|
||||
"window_type = 'desktop'",
|
||||
"_GTK_FRAME_EXTENTS@:c"
|
||||
];
|
||||
|
||||
#################################
|
||||
# General Settings #
|
||||
#################################
|
||||
|
||||
# Enable remote control via D-Bus. See the man page for more details.
|
||||
# dbus = true
|
||||
|
||||
# Daemonize process. Fork to background after initialization. Causes issues with certain (badly-written) drivers.
|
||||
# daemon = false
|
||||
|
||||
# Specify the backend to use: `xrender`, `glx`, or `xr_glx_hybrid`.
|
||||
# `xrender` is the default one.
|
||||
#
|
||||
# backend = "glx"
|
||||
backend = "xrender";
|
||||
|
||||
# Enable/disable VSync.
|
||||
# vsync = false
|
||||
vsync = true;
|
||||
|
||||
# Enable remote control via D-Bus. See the *D-BUS API* section below for more details.
|
||||
# dbus = false
|
||||
|
||||
# Try to detect WM windows (a non-override-redirect window with no
|
||||
# child that has 'WM_STATE') and mark them as active.
|
||||
#
|
||||
# mark-wmwin-focused = false
|
||||
mark-wmwin-focused = true;
|
||||
|
||||
# Mark override-redirect windows that doesn't have a child window with 'WM_STATE' focused.
|
||||
# mark-ovredir-focused = false
|
||||
mark-ovredir-focused = true;
|
||||
|
||||
# Try to detect windows with rounded corners and don't consider them
|
||||
# shaped windows. The accuracy is not very high, unfortunately.
|
||||
#
|
||||
# detect-rounded-corners = false
|
||||
detect-rounded-corners = true;
|
||||
|
||||
# Detect '_NET_WM_WINDOW_OPACITY' on client windows, useful for window managers
|
||||
# not passing '_NET_WM_WINDOW_OPACITY' of client windows to frame windows.
|
||||
#
|
||||
# detect-client-opacity = false
|
||||
detect-client-opacity = true;
|
||||
|
||||
# Use EWMH '_NET_ACTIVE_WINDOW' to determine currently focused window,
|
||||
# rather than listening to 'FocusIn'/'FocusOut' event. Might have more accuracy,
|
||||
# provided that the WM supports it.
|
||||
#
|
||||
# use-ewmh-active-win = false
|
||||
|
||||
# Unredirect all windows if a full-screen opaque window is detected,
|
||||
# to maximize performance for full-screen windows. Known to cause flickering
|
||||
# when redirecting/unredirecting windows.
|
||||
#
|
||||
# unredir-if-possible = false
|
||||
|
||||
# Delay before unredirecting the window, in milliseconds. Defaults to 0.
|
||||
# unredir-if-possible-delay = 0
|
||||
|
||||
# Conditions of windows that shouldn't be considered full-screen for unredirecting screen.
|
||||
# unredir-if-possible-exclude = []
|
||||
|
||||
# Use 'WM_TRANSIENT_FOR' to group windows, and consider windows
|
||||
# in the same group focused at the same time.
|
||||
#
|
||||
# detect-transient = false
|
||||
detect-transient = true;
|
||||
|
||||
# Use 'WM_CLIENT_LEADER' to group windows, and consider windows in the same
|
||||
# group focused at the same time. This usually means windows from the same application
|
||||
# will be considered focused or unfocused at the same time.
|
||||
# 'WM_TRANSIENT_FOR' has higher priority if detect-transient is enabled, too.
|
||||
#
|
||||
# detect-client-leader = false
|
||||
|
||||
# Resize damaged region by a specific number of pixels.
|
||||
# A positive value enlarges it while a negative one shrinks it.
|
||||
# If the value is positive, those additional pixels will not be actually painted
|
||||
# to screen, only used in blur calculation, and such. (Due to technical limitations,
|
||||
# with use-damage, those pixels will still be incorrectly painted to screen.)
|
||||
# Primarily used to fix the line corruption issues of blur,
|
||||
# in which case you should use the blur radius value here
|
||||
# (e.g. with a 3x3 kernel, you should use `--resize-damage 1`,
|
||||
# with a 5x5 one you use `--resize-damage 2`, and so on).
|
||||
# May or may not work with *--glx-no-stencil*. Shrinking doesn't function correctly.
|
||||
#
|
||||
# resize-damage = 1
|
||||
|
||||
# Specify a list of conditions of windows that should be painted with inverted color.
|
||||
# Resource-hogging, and is not well tested.
|
||||
#
|
||||
# invert-color-include = []
|
||||
|
||||
# GLX backend: Avoid using stencil buffer, useful if you don't have a stencil buffer.
|
||||
# Might cause incorrect opacity when rendering transparent content (but never
|
||||
# practically happened) and may not work with blur-background.
|
||||
# My tests show a 15% performance boost. Recommended.
|
||||
#
|
||||
glx-no-stencil = true;
|
||||
|
||||
# GLX backend: Avoid rebinding pixmap on window damage.
|
||||
# Probably could improve performance on rapid window content changes,
|
||||
# but is known to break things on some drivers (LLVMpipe, xf86-video-intel, etc.).
|
||||
# Recommended if it works.
|
||||
#
|
||||
# glx-no-rebind-pixmap = false
|
||||
|
||||
# Disable the use of damage information.
|
||||
# This cause the whole screen to be redrawn every time, instead of the part of the screen
|
||||
# has actually changed. Potentially degrades the performance, but might fix some artifacts.
|
||||
# The opposing option is use-damage
|
||||
#
|
||||
# no-use-damage = false
|
||||
use-damage = true;
|
||||
|
||||
# Use X Sync fence to sync clients' draw calls, to make sure all draw
|
||||
# calls are finished before picom starts drawing. Needed on nvidia-drivers
|
||||
# with GLX backend for some users.
|
||||
#
|
||||
# xrender-sync-fence = false
|
||||
|
||||
# GLX backend: Use specified GLSL fragment shader for rendering window
|
||||
# contents. Read the man page for a detailed explanation of the interface.
|
||||
#
|
||||
# window-shader-fg = "default"
|
||||
|
||||
# Use rules to set per-window shaders. Syntax is SHADER_PATH:PATTERN, similar
|
||||
# to opacity-rule. SHADER_PATH can be "default". This overrides window-shader-fg.
|
||||
#
|
||||
# window-shader-fg-rule = [
|
||||
# "my_shader.frag:window_type != 'dock'"
|
||||
# ]
|
||||
|
||||
# Force all windows to be painted with blending. Useful if you
|
||||
# have a glx-fshader-win that could turn opaque pixels transparent.
|
||||
#
|
||||
# force-win-blend = false
|
||||
|
||||
# Do not use EWMH to detect fullscreen windows.
|
||||
# Reverts to checking if a window is fullscreen based only on its size and coordinates.
|
||||
#
|
||||
# no-ewmh-fullscreen = false
|
||||
|
||||
# Dimming bright windows so their brightness doesn't exceed this set value.
|
||||
# Brightness of a window is estimated by averaging all pixels in the window,
|
||||
# so this could comes with a performance hit.
|
||||
# Setting this to 1.0 disables this behaviour. Requires --use-damage to be disabled. (default: 1.0)
|
||||
#
|
||||
# max-brightness = 1.0
|
||||
|
||||
# Make transparent windows clip other windows like non-transparent windows do,
|
||||
# instead of blending on top of them.
|
||||
#
|
||||
# transparent-clipping = false
|
||||
|
||||
# Specify a list of conditions of windows that should never have transparent
|
||||
# clipping applied. Useful for screenshot tools, where you need to be able to
|
||||
# see through transparent parts of the window.
|
||||
#
|
||||
# transparent-clipping-exclude = []
|
||||
|
||||
# Set the log level. Possible values are:
|
||||
# "trace", "debug", "info", "warn", "error"
|
||||
# in increasing level of importance. Case doesn't matter.
|
||||
# If using the "TRACE" log level, it's better to log into a file
|
||||
# using *--log-file*, since it can generate a huge stream of logs.
|
||||
#
|
||||
# log-level = "debug"
|
||||
log-level = "warn";
|
||||
|
||||
# Set the log file.
|
||||
# If *--log-file* is never specified, logs will be written to stderr.
|
||||
# Otherwise, logs will to written to the given file, though some of the early
|
||||
# logs might still be written to the stderr.
|
||||
# When setting this option from the config file, it is recommended to use an absolute path.
|
||||
#
|
||||
# log-file = "/path/to/your/log/file"
|
||||
|
||||
# Show all X errors (for debugging)
|
||||
# show-all-xerrors = false
|
||||
|
||||
# Write process ID to a file.
|
||||
# write-pid-path = "/path/to/your/log/file"
|
||||
|
||||
# Window type settings
|
||||
#
|
||||
# 'WINDOW_TYPE' is one of the 15 window types defined in EWMH standard:
|
||||
# "unknown", "desktop", "dock", "toolbar", "menu", "utility",
|
||||
# "splash", "dialog", "normal", "dropdown_menu", "popup_menu",
|
||||
# "tooltip", "notification", "combo", and "dnd".
|
||||
#
|
||||
# Following per window-type options are available: ::
|
||||
#
|
||||
# fade, shadow:::
|
||||
# Controls window-type-specific shadow and fade settings.
|
||||
#
|
||||
# opacity:::
|
||||
# Controls default opacity of the window type.
|
||||
#
|
||||
# focus:::
|
||||
# Controls whether the window of this type is to be always considered focused.
|
||||
# (By default, all window types except "normal" and "dialog" has this on.)
|
||||
#
|
||||
# full-shadow:::
|
||||
# Controls whether shadow is drawn under the parts of the window that you
|
||||
# normally won't be able to see. Useful when the window has parts of it
|
||||
# transparent, and you want shadows in those areas.
|
||||
#
|
||||
# clip-shadow-above:::
|
||||
# Controls whether shadows that would have been drawn above the window should
|
||||
# be clipped. Useful for dock windows that should have no shadow painted on top.
|
||||
#
|
||||
# redir-ignore:::
|
||||
# Controls whether this type of windows should cause screen to become
|
||||
# redirected again after been unredirected. If you have unredir-if-possible
|
||||
# set, and doesn't want certain window to cause unnecessary screen redirection,
|
||||
# you can set this to `true`.
|
||||
#
|
||||
wintypes:
|
||||
{
|
||||
tooltip = { fade = true; shadow = true; opacity = 0.75; focus = true; full-shadow = false; };
|
||||
dock = { shadow = false; clip-shadow-above = true; }
|
||||
dnd = { shadow = false; }
|
||||
popup_menu = { opacity = 0.8; }
|
||||
dropdown_menu = { opacity = 0.8; }
|
||||
};
|
||||
@ -2,9 +2,5 @@ configuration {
|
||||
show-icons: true;
|
||||
terminal: "alacritty";
|
||||
font: "xft:FiraCode 12";
|
||||
kb-accept-entry: "Ctrl+m,Return";
|
||||
kb-row-up: "Ctrl+k";
|
||||
kb-row-down: "Ctrl+j";
|
||||
kb-remove-to-eol: "";
|
||||
}
|
||||
@theme "Arc-Dark"
|
||||
|
||||
@ -1,28 +0,0 @@
|
||||
# vim: ft=swayconfig
|
||||
# Sway autostart
|
||||
|
||||
exec swayidle -w \
|
||||
timeout 1800 'swaylock -f' \
|
||||
timeout 1805 'swaymsg "output * power off"' \
|
||||
resume 'swaymsg "output * power on"' \
|
||||
before-sleep 'swaylock -f'
|
||||
|
||||
# Screen layout
|
||||
exec_always ~/.screenlayout/default
|
||||
|
||||
output * bg "$(find ~/.wallpaper -type f | shuf -n 1)" fill
|
||||
|
||||
# Notifications
|
||||
#systemctl --user enable --now dbus.service
|
||||
exec mako --anchor top-right --default-timeout 4000 --icons 1 --actions 1 --output $primary
|
||||
|
||||
exec_always wayvnc -o $primary -S "$(mktemp --dry-run --tmpdir="${XDG_RUNTIME_DIR}" wayvnc.XXXXXXXXXX)" 127.0.0.1 5900
|
||||
exec_always wayvnc -o $secondary -S "$(mktemp --dry-run --tmpdir="${XDG_RUNTIME_DIR}" wayvnc.XXXXXXXXXX)" 127.0.0.1 5901
|
||||
exec --no-startup-id easyeffects --gapplication-service
|
||||
|
||||
exec --no-startup-id pomodoro daemon
|
||||
|
||||
exec $browser
|
||||
exec $terminal
|
||||
exec Telegram
|
||||
exec firefox_media
|
||||
@ -1,19 +0,0 @@
|
||||
# vim: ft=swayconfig
|
||||
# Sway bar
|
||||
|
||||
bar {
|
||||
mode dock
|
||||
position bottom
|
||||
status_command i3blocks
|
||||
wrap_scroll no
|
||||
bindsym button4 nop
|
||||
bindsym button5 nop
|
||||
hidden_state hide
|
||||
output *
|
||||
tray_output $primary
|
||||
strip_workspace_name no
|
||||
strip_workspace_numbers no
|
||||
modifier $mod
|
||||
}
|
||||
|
||||
exec ~/.config/i3blocks/scripts/layout_change_handler.sh
|
||||
@ -1,201 +0,0 @@
|
||||
# vim: ft=swayconfig
|
||||
# Sway bindings
|
||||
|
||||
bindsym --locked XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5% && pkill -RTMIN+1 i3blocks
|
||||
bindsym --locked XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5% && pkill -RTMIN+1 i3blocks
|
||||
bindsym --locked XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle && pkill -RTMIN+1 i3blocks
|
||||
|
||||
bindsym --locked XF86AudioPlay exec playerctl play-pause
|
||||
bindsym --locked XF86AudioPause exec playerctl play-pause
|
||||
bindsym --locked XF86AudioNext exec playerctl next
|
||||
bindsym --locked XF86AudioPrev exec playerctl previous
|
||||
bindsym --locked XF86Tools exec pavucontrol
|
||||
|
||||
bindsym --locked XF86MonBrightnessUp exec brightnessctl set 5%+
|
||||
bindsym --locked XF86MonBrightnessDown exec brightnessctl set 5%-
|
||||
|
||||
bindsym --to-code $mod+p exec pomodoro toggle && pkill -RTMIN+2 i3blocks
|
||||
|
||||
bindsym $mod+z exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ 0 ## Hold to talk
|
||||
bindsym --release $mod+z exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ 1 ## Release to mute
|
||||
|
||||
bindsym $mod+Shift+z exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle
|
||||
bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle
|
||||
|
||||
bindsym XF86PickupPhone exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ 0 ## Hold to talk
|
||||
bindsym --release XF86PickupPhone exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ 1 ## Release to mute
|
||||
|
||||
bindsym XF86Go exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ 0 ## Hold to talk, x1carb11
|
||||
bindsym --release XF86Go exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ 1 ## Release to mute, x1carb11
|
||||
|
||||
|
||||
bindsym $mod+XF86AudioMicMute exec --no-startup-id pactl list short sources | awk '/input.*RUNNING/ {system("pactl set-source-mute " $1 " toggle")}' ## Find and mute mics
|
||||
|
||||
bindsym --to-code $mod+s exec ~/.config/sway/scripts/swap-workspaces.sh
|
||||
|
||||
bindsym --to-code $mod+Shift+q kill
|
||||
bindsym --to-code $mod+Shift+r reload
|
||||
|
||||
set $menu rofi -show drun -m -1
|
||||
bindsym --to-code $mod+d exec $menu
|
||||
bindsym $mod+o exec --no-startup-id slm_rofi
|
||||
|
||||
# Change focus
|
||||
bindsym --to-code $mod+h focus left
|
||||
bindsym --to-code $mod+j focus down
|
||||
bindsym --to-code $mod+k focus up
|
||||
bindsym --to-code $mod+l focus right
|
||||
bindsym --to-code $mod+Left focus left
|
||||
bindsym --to-code $mod+Down focus down
|
||||
bindsym --to-code $mod+Up focus up
|
||||
bindsym --to-code $mod+Right focus right
|
||||
|
||||
# Move focused window
|
||||
bindsym --to-code $mod+Shift+h move left
|
||||
bindsym --to-code $mod+Shift+j move down
|
||||
bindsym --to-code $mod+Shift+k move up
|
||||
bindsym --to-code $mod+Shift+l move right
|
||||
bindsym --to-code $mod+Shift+Left move left
|
||||
bindsym --to-code $mod+Shift+Down move down
|
||||
bindsym --to-code $mod+Shift+Up move up
|
||||
bindsym --to-code $mod+Shift+Right move right
|
||||
|
||||
|
||||
bindsym --to-code $mod+Ctrl+Shift+l move workspace to output right
|
||||
bindsym --to-code $mod+Ctrl+Shift+h move workspace to output left
|
||||
bindsym --to-code $mod+Ctrl+Shift+k move workspace to output up
|
||||
bindsym --to-code $mod+Ctrl+Shift+j move workspace to output down
|
||||
|
||||
|
||||
bindsym --to-code $mod+f fullscreen toggle
|
||||
|
||||
bindsym --to-code $mod+t layout tabbed
|
||||
bindsym --to-code $mod+v layout toggle split
|
||||
bindsym --to-code $mod+a focus parent
|
||||
|
||||
bindsym --to-code $mod+Shift+slash floating toggle
|
||||
bindsym --to-code $mod+Shift+comma sticky toggle
|
||||
|
||||
# Change focus between tiling / floating windows
|
||||
bindsym --to-code $mod+slash focus mode_toggle
|
||||
|
||||
|
||||
bindsym --to-code Print exec --no-startup-id screenshot select copy
|
||||
bindsym --to-code $mod+Print exec --no-startup-id screenshot window copy
|
||||
bindsym --to-code Ctrl+Print exec --no-startup-id screenshot entire copy
|
||||
|
||||
bindsym --to-code Shift+Print exec --no-startup-id screenshot select save
|
||||
bindsym --to-code Shift+$mod+Print exec --no-startup-id screenshot window save
|
||||
bindsym --to-code Shift+Ctrl+Print exec --no-startup-id screenshot entire save
|
||||
|
||||
|
||||
bindsym --to-code $mod+q workspace hide1; workspace hide2
|
||||
|
||||
|
||||
bindsym $mod+Shift+minus move scratchpad
|
||||
bindsym $mod+minus scratchpad show
|
||||
|
||||
|
||||
bindsym --to-code $mod+b bar mode toggle
|
||||
|
||||
set $exitmode "Power: [e]xit, [r]eboot, [s]hutdown, s[u]spend, [l]ock, [b]lack, [R]UEFI"
|
||||
mode $exitmode {
|
||||
bindsym --to-code e exit
|
||||
bindsym --to-code r exec --no-startup-id reboot
|
||||
bindsym --to-code s exec --no-startup-id shutdown -h now
|
||||
bindsym --to-code u exec ~/.config/sway/scripts/lock-telegram.sh && systemctl suspend; mode "default"
|
||||
bindsym --to-code l exec ~/.config/sway/scripts/lock-telegram.sh && swaylock -f; mode "default"
|
||||
bindsym --to-code b exec magick canvas:none PNG:- | feh --class black -YFx -; mode "default"
|
||||
bindsym --to-code Shift+r exec --no-startup-id systemctl reboot --firmware-setup
|
||||
|
||||
bindsym Escape mode "default"
|
||||
bindsym Return mode "default"
|
||||
}
|
||||
bindsym --to-code $mod+x mode $exitmode
|
||||
|
||||
# switch to workspace
|
||||
bindsym --to-code $mod+1 workspace number $ws1
|
||||
bindsym --to-code $mod+2 workspace number $ws2
|
||||
bindsym --to-code $mod+3 workspace number $ws3
|
||||
bindsym --to-code $mod+4 workspace number $ws4
|
||||
bindsym --to-code $mod+5 workspace number $ws5
|
||||
bindsym --to-code $mod+6 workspace number $ws6
|
||||
bindsym --to-code $mod+7 workspace number $ws7
|
||||
bindsym --to-code $mod+8 workspace number $ws8
|
||||
bindsym --to-code $mod+9 workspace number $ws9
|
||||
bindsym --to-code $mod+0 workspace number $ws10
|
||||
|
||||
# move focused container to workspace
|
||||
bindsym --to-code $mod+Shift+1 move container to workspace number $ws1
|
||||
bindsym --to-code $mod+Shift+2 move container to workspace number $ws2
|
||||
bindsym --to-code $mod+Shift+3 move container to workspace number $ws3
|
||||
bindsym --to-code $mod+Shift+4 move container to workspace number $ws4
|
||||
bindsym --to-code $mod+Shift+5 move container to workspace number $ws5
|
||||
bindsym --to-code $mod+Shift+6 move container to workspace number $ws6
|
||||
bindsym --to-code $mod+Shift+7 move container to workspace number $ws7
|
||||
bindsym --to-code $mod+Shift+8 move container to workspace number $ws8
|
||||
bindsym --to-code $mod+Shift+9 move container to workspace number $ws9
|
||||
bindsym --to-code $mod+Shift+0 move container to workspace number $ws10
|
||||
|
||||
bindsym --to-code $mod+u workspace prev
|
||||
bindsym --to-code $mod+Shift+u workspace next
|
||||
|
||||
# workspace_auto_back_and_forth no
|
||||
bindsym --to-code $mod+Tab workspace back_and_forth
|
||||
|
||||
# resize window (you can also use the mouse for that)
|
||||
set $resizemode "Resize: toggle [p]recize"
|
||||
mode $resizemode {
|
||||
bindsym --to-code h resize shrink width 10 px or 10 ppt
|
||||
bindsym --to-code j resize grow height 10 px or 10 ppt
|
||||
bindsym --to-code k resize shrink height 10 px or 10 ppt
|
||||
bindsym --to-code l resize grow width 10 px or 10 ppt
|
||||
|
||||
bindsym --to-code $mod+r mode "default"
|
||||
bindsym --to-code p mode $presizemode
|
||||
|
||||
bindsym --to-code Return mode "default"
|
||||
bindsym --to-code Escape mode "default"
|
||||
}
|
||||
set $presizemode "Precise resize: toggle [p]resize"
|
||||
mode $presizemode {
|
||||
bindsym --to-code h resize shrink width 1 px or 1 ppt
|
||||
bindsym --to-code j resize grow height 1 px or 1 ppt
|
||||
bindsym --to-code k resize shrink height 1 px or 1 ppt
|
||||
bindsym --to-code l resize grow width 1 px or 1 ppt
|
||||
|
||||
bindsym --to-code $mod+r mode "default"
|
||||
bindsym --to-code p mode $resizemode
|
||||
|
||||
bindsym --to-code Return mode "default"
|
||||
bindsym --to-code Escape mode "default"
|
||||
}
|
||||
bindsym --to-code $mod+r mode $resizemode
|
||||
|
||||
input type:keyboard {
|
||||
xkb_layout us,ru
|
||||
xkb_options grp:win_space_toggle,caps:ctrl_modifier
|
||||
xkb_model "pc101"
|
||||
repeat_delay 250
|
||||
repeat_rate 100
|
||||
}
|
||||
|
||||
input type:pointer {
|
||||
natural_scroll disabled
|
||||
}
|
||||
|
||||
input type:touchpad {
|
||||
tap enabled
|
||||
tap_button_map lrm
|
||||
dwt enabled
|
||||
scroll_method two_finger
|
||||
natural_scroll enabled
|
||||
drag enabled
|
||||
drag_lock disabled
|
||||
pointer_accel 0.4
|
||||
}
|
||||
|
||||
bindgesture swipe:3:right workspace next
|
||||
bindgesture swipe:3:left workspace prev
|
||||
bindgesture swipe:3:up exec $menu
|
||||
bindgesture swipe:3:down workspace hide1; workspace hide2
|
||||
@ -1,34 +0,0 @@
|
||||
# Sway config sourcer
|
||||
|
||||
exec swaylock -f
|
||||
|
||||
set $mod Mod4
|
||||
|
||||
set $ws1 "1 Browser"
|
||||
set $ws2 "2 Code"
|
||||
set $ws3 "3"
|
||||
set $ws4 "4"
|
||||
set $ws5 "5"
|
||||
set $ws6 "6"
|
||||
set $ws7 "7"
|
||||
set $ws8 "8💬Social"
|
||||
set $ws9 "9🎵Music"
|
||||
set $ws10 "10🍿Media"
|
||||
|
||||
set $terminal ~/.config/sway/scripts/auto-alacritty.sh
|
||||
set $browser firefox
|
||||
|
||||
# Example variables.d:
|
||||
#set $primary DVI-I-1
|
||||
#set $secondary VGA-1
|
||||
#set $terminal alacritty
|
||||
#set $browser firefox
|
||||
include ~/.config/sway/variables.d/*.conf
|
||||
|
||||
include ~/.config/sway/other.conf
|
||||
include ~/.config/sway/bindings.conf
|
||||
include ~/.config/sway/bar.conf
|
||||
include ~/.config/sway/autostart.conf
|
||||
|
||||
include /etc/sway/config.d/*.conf
|
||||
include ~/.config/sway/config.d/*.conf
|
||||
@ -1,55 +0,0 @@
|
||||
# vim: ft=swayconfig
|
||||
# Other sway config
|
||||
|
||||
# Hide cursor
|
||||
seat seat0 hide_cursor when-typing enable
|
||||
seat seat0 hide_cursor 5000
|
||||
|
||||
|
||||
set $font_size 11
|
||||
font xft:FiraCode $font_size
|
||||
|
||||
floating_modifier $mod
|
||||
|
||||
focus_follows_mouse no
|
||||
mouse_warping none
|
||||
popup_during_fullscreen smart
|
||||
smart_borders on
|
||||
focus_on_window_activation urgent
|
||||
|
||||
default_border pixel 1
|
||||
default_floating_border normal
|
||||
hide_edge_borders smart
|
||||
|
||||
for_window [tiling] border pixel 3
|
||||
for_window [title="Picture-in-Picture"] sticky enable
|
||||
for_window [title="Picture-in-Picture"] border pixel 0
|
||||
for_window [app_id="firefox"] inhibit_idle fullscreen
|
||||
|
||||
for_window [app_id="pavucontrol"] {
|
||||
floating enable
|
||||
resize set width 60 ppt height 80 ppt
|
||||
move position center
|
||||
}
|
||||
|
||||
for_window [class="black"] fullscreen enable
|
||||
|
||||
no_focus [title="^Peek preview$"]
|
||||
no_focus [class="black"]
|
||||
|
||||
assign [app_id="firefox_media"] workspace $ws10
|
||||
assign [app_id="Alacritty"] workspace $ws2
|
||||
assign [app_id="org.telegram.desktop"] workspace $ws8
|
||||
assign [app_id="firefox"] workspace $ws1
|
||||
|
||||
workspace $ws1 output $primary
|
||||
workspace $ws2 output $primary
|
||||
workspace $ws3 output $primary
|
||||
workspace $ws9 output $secondary
|
||||
workspace $ws10 output $secondary
|
||||
|
||||
workspace hide1 output $primary
|
||||
workspace hide2 output $secondary
|
||||
|
||||
|
||||
exec_always test -f ~/.Xresources && xrdb -merge ~/.Xresources
|
||||
@ -1,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
while true; do
|
||||
alacritty
|
||||
sleep 1
|
||||
done
|
||||
@ -1,25 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
TELEGRAM_WINDOW="$(
|
||||
swaymsg -t get_tree | \
|
||||
jq -r '.. | select(.app_id? == "org.telegram.desktop") | .id' | \
|
||||
head -n 1
|
||||
)"
|
||||
|
||||
readonly TELEGRAM_WINDOW
|
||||
|
||||
|
||||
if [ -z "${TELEGRAM_WINDOW}" ]; then
|
||||
echo "Error: Telegram not found"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
swaymsg "[con_id=${TELEGRAM_WINDOW}] focus"
|
||||
|
||||
sleep 0.2
|
||||
|
||||
wtype -M ctrl l
|
||||
|
||||
swaymsg workspace back_and_forth
|
||||
|
||||
exit 0
|
||||
@ -1,26 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
set -eu
|
||||
|
||||
|
||||
current_monitor=$(swaymsg -r -t get_workspaces | jq '.[] | select(.focused).output' | tr -d '"')
|
||||
other_monitor=$(swaymsg -r -t get_outputs | jq -r ".[] | select(.active and .name != \"${current_monitor}\").name" | head -n 1)
|
||||
|
||||
if [ -z "${other_monitor}" ]; then
|
||||
echo "No other active monitor found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
current_workspace=$(swaymsg -r -t get_workspaces | jq '.[] | select(.focused).name' | tr -d '"')
|
||||
other_workspace=$(swaymsg -r -t get_workspaces | jq -r ".[] | select(.visible and .output == \"${other_monitor}\").name" | head -n 1)
|
||||
|
||||
if [ -n "${other_workspace}" ]; then
|
||||
# Swap workspaces
|
||||
swaymsg "workspace ${other_workspace}; move workspace to output ${current_monitor}"
|
||||
swaymsg "workspace ${current_workspace}; move workspace to output ${other_monitor}"
|
||||
swaymsg "workspace ${other_workspace}"
|
||||
else
|
||||
# Just move current workspace if target is empty
|
||||
swaymsg "move workspace to output ${other_monitor}"
|
||||
fi
|
||||
@ -1,3 +0,0 @@
|
||||
color=000000
|
||||
ignore-empty-password
|
||||
show-failed-attempts
|
||||
@ -1,18 +0,0 @@
|
||||
[Unit]
|
||||
Description=MPV Audio Player Service
|
||||
Documentation=man:mpv(1)
|
||||
After=sound.target graphical-session.target
|
||||
Wants=sound.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=%h/.local/bin/mpv-service.sh
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=%t/bus
|
||||
Environment=XDG_RUNTIME_DIR=%t
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
@ -1,17 +0,0 @@
|
||||
[Unit]
|
||||
Description=SSH proxy
|
||||
Requires=default.target
|
||||
After=default.target
|
||||
|
||||
# ln -s % ~/.config/systemd/user
|
||||
# systemctl --user enable --now ssh-proxy@server.vpn
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/ssh -o ControlMaster=no -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -vCTN -D 127.0.0.1:1080 %i
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
StartLimitInterval=0
|
||||
StartLimitBurst=0
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
@ -1,15 +0,0 @@
|
||||
[Unit]
|
||||
Description=Tmux server
|
||||
Requires=default.target
|
||||
After=default.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/tmux -D -L %u
|
||||
ExecStop=/usr/bin/tmux -L %u kill-server
|
||||
ExecReload=/usr/bin/tmux -L %u source-file %h/.config/tmux/tmux.conf
|
||||
Restart=on-failure
|
||||
ExecStartPost=/usr/bin/tmux -L %u new-session -d -s landing 'sh -c "tmux rename-window -t 1 landing; tmux set-option remain-on-exit on; figlet -w 200 -c -f big Landing; trap : INT; while true; do sleep 3600; done"'
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
@ -3,11 +3,10 @@ Description=VNC Server for X11
|
||||
Requires=default.target
|
||||
After=default.target
|
||||
|
||||
# x11vnc -storepasswd ~/.vnc/passwd
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStartPre=/bin/sleep 10
|
||||
ExecStart=/usr/bin/x11vnc -noxdamage -rfbauth %h/.vnc/passwd -display :0 -forever -reopen -shared
|
||||
ExecStart=/usr/bin/x11vnc -noxdamage -rfbauth %h/.vnc/passwd -display :0 -forever
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user