Merge branch 'master' of gitee.com:klesh/dotfiles

This commit is contained in:
Klesh Wong 2021-03-27 22:28:35 +08:00
commit f3a75a83db
23 changed files with 504 additions and 51 deletions

6
bin/dbe Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
export GTK_IM_MODULE="ibus"
export QT_IM_MODULE="ibus"
export XMODIFIERS="@im=ibus"
dbeaver

5
bin/idea Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
wmname LG3D
/home/klesh/Programs/idea-IC-203.7717.32/bin/idea.sh

View File

@ -58,6 +58,7 @@ lnsf "$DIR/fish/functions/fish_prompt.fish" "$XDG_CONFIG_HOME/fish/functions/fis
lnsf "$DIR/fish/functions/fish_right_prompt.fish" "$XDG_CONFIG_HOME/fish/functions/fish_right_prompt.fish"
lnsf "$DIR/fish/functions/fisher.fish" "$XDG_CONFIG_HOME/fish/functions/fisher.fish"
lnsf "$DIR/fish/functions/r.fish" "$XDG_CONFIG_HOME/fish/functions/r.fish"
lnsf "$DIR/fish/functions/f.fish" "$XDG_CONFIG_HOME/fish/functions/f.fish"
lnsf "$DIR/fish/functions/append_paths.fish" "$XDG_CONFIG_HOME/fish/functions/append_paths.fish"
lnsf "$DIR/fish/functions/source_files.fish" "$XDG_CONFIG_HOME/fish/functions/source_files.fish"

View File

@ -53,7 +53,7 @@ if status is-interactive
alias dt='date "+%Y%m%d-%H%M%S"'
# === PATH and file sourcing
append_paths ~/bin ~/.local/bin ~/.yarn/bin ~/dotfiles/bin ~/dotfiles/devops/bin
append_paths ~/go/bin ~/bin ~/.local/bin ~/.yarn/bin ~/dotfiles/bin ~/dotfiles/devops/bin
source_files /usr/share/autojump/autojump.fish /usr/local/share/autojump/autojump.fish \
~/.jabba/jabba.fish \
~/.profile.fish

174
cli/fish/functions/f.fish Normal file
View File

@ -0,0 +1,174 @@
function f --description='sync lf pwd to shell when exit'
set -x LF_ICONS "\
tw= :\
st= :\
ow= :\
dt= :\
di= :\
fi= :\
ln= :\
or= :\
ex= :\
*.c= :\
*.cc= :\
*.clj= :\
*.coffee= :\
*.cpp= :\
*.css= :\
*.d= :\
*.dart= :\
*.erl= :\
*.exs= :\
*.fs= :\
*.go= :\
*.h= :\
*.hh= :\
*.hpp= :\
*.hs= :\
*.html= :\
*.java= :\
*.jl= :\
*.js= :\
*.json= :\
*.lua= :\
*.md= :\
*.php= :\
*.pl= :\
*.pro= :\
*.py= :\
*.rb= :\
*.rs= :\
*.scala= :\
*.ts= :\
*.vim= :\
*.cmd= :\
*.ps1= :\
*.sh= :\
*.bash= :\
*.zsh= :\
*.fish= :\
*.tar= :\
*.tgz= :\
*.arc= :\
*.arj= :\
*.taz= :\
*.lha= :\
*.lz4= :\
*.lzh= :\
*.lzma= :\
*.tlz= :\
*.txz= :\
*.tzo= :\
*.t7z= :\
*.zip= :\
*.z= :\
*.dz= :\
*.gz= :\
*.lrz= :\
*.lz= :\
*.lzo= :\
*.xz= :\
*.zst= :\
*.tzst= :\
*.bz2= :\
*.bz= :\
*.tbz= :\
*.tbz2= :\
*.tz= :\
*.deb= :\
*.rpm= :\
*.jar= :\
*.war= :\
*.ear= :\
*.sar= :\
*.rar= :\
*.alz= :\
*.ace= :\
*.zoo= :\
*.cpio= :\
*.7z= :\
*.rz= :\
*.cab= :\
*.wim= :\
*.swm= :\
*.dwm= :\
*.esd= :\
*.jpg= :\
*.jpeg= :\
*.mjpg= :\
*.mjpeg= :\
*.gif= :\
*.bmp= :\
*.pbm= :\
*.pgm= :\
*.ppm= :\
*.tga= :\
*.xbm= :\
*.xpm= :\
*.tif= :\
*.tiff= :\
*.png= :\
*.svg= :\
*.svgz= :\
*.mng= :\
*.pcx= :\
*.mov= :\
*.mpg= :\
*.mpeg= :\
*.m2v= :\
*.mkv= :\
*.webm= :\
*.ogm= :\
*.mp4= :\
*.m4v= :\
*.mp4v= :\
*.vob= :\
*.qt= :\
*.nuv= :\
*.wmv= :\
*.asf= :\
*.rm= :\
*.rmvb= :\
*.flc= :\
*.avi= :\
*.fli= :\
*.flv= :\
*.gl= :\
*.dl= :\
*.xcf= :\
*.xwd= :\
*.yuv= :\
*.cgm= :\
*.emf= :\
*.ogv= :\
*.ogx= :\
*.aac= :\
*.au= :\
*.flac= :\
*.m4a= :\
*.mid= :\
*.midi= :\
*.mka= :\
*.mp3= :\
*.mpc= :\
*.ogg= :\
*.ra= :\
*.wav= :\
*.oga= :\
*.opus= :\
*.spx= :\
*.xspf= :\
*.pdf= :\
*.nix= :\
"
set tempfile (mktemp -t tmp.XXXXXX)
command lf -last-dir-path $tempfile $argv
if test -s $tempfile
set dir (cat $tempfile)
if test -n $dir -a -d $dir
builtin cd -- $dir
end
end
command rm -f -- $tempfile
end

View File

@ -9,7 +9,7 @@ function fish_right_prompt
test -z $CMD_DURATION -o \( $CMD_DURATION -lt 3000 \) && return
test -z $WINDOWID && return
set active_window (xdotool getactivewindow 2>/dev/null)
test $active_window -eq $WINDOWID && return
test "$active_window" -eq "$WINDOWID" && return
set message (history --max=1) [$duration]
notify-send (test "$s" -ne 0 && echo '--icon=dialog-warning') $message
end

16
cli/lf.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
set -e
DIR=$(dirname "$(readlink -f "$0")")
. "$DIR/../env.sh"
if ! has_cmd go; then
"$PDIR/devel/go.sh"
fi
log 'Setting up lf'
# install lf
env GOPROXY= CGO_ENABLED=0 GO111MODULE=on go get -u -ldflags="-s -w" github.com/gokcehan/lf
# linking configuration files
lnsf "$DIR/lf/lfrc" "$XDG_CONFIG_HOME/lf/lfrc"

23
cli/lf/lfrc Normal file
View File

@ -0,0 +1,23 @@
set drawbox
set icons
cmd mkdir %mkdir "$@"
cmd copyfilepath %echo "$f" | xsel -b
map Yp copyfilepath
cmd copyfilename %basename "$f" | xsel -b
map Yn copyfilename
cmd pasteoverwrite %{{
load=$(lf -remote 'load')
mode=$(echo "$load" | sed -n '1p')
list=$(echo "$load" | sed '1d')
if [ $mode = 'copy' ]; then
cp -R $list .
elif [ $mode = 'move' ]; then
mv $list .
fi
lf -remote 'send load'
lf -remote 'send clear'
}}
map P pasteoverwrite

10
cli/lf/lfrc.win Normal file
View File

@ -0,0 +1,10 @@
set icons
set drawbox
cmd mkdir %mkdir "$@"
cmd fp %powershell -NoProfile -Command Set-Clipboard $env:f
cmd fn %powershell -NoProfile -Command Set-Clipboard (Split-Path -Leaf ($env:f -replace '"',''))
map <f-2> rename

View File

@ -9,6 +9,8 @@ set -g pane-base-index 1
set-option -g mouse on
#set-option -g mouse-select-pane on
set-option -g display-time 4000
set-option -g set-titles on
set-option -g set-titles-string "#S / #W"
############################

View File

@ -18,7 +18,7 @@ esac
if in_china; then
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
go env -w GOPROXY=https://mirrors.aliyun.com/goproxy/
fi
# coc.nvim

61
gui/mpv/scripts/cut.js Normal file
View File

@ -0,0 +1,61 @@
var beginPos, endPos
function markBegin() {
beginPos = mp.get_property('time-pos')
mp.osd_message('Begin Position Marked at ' + beginPos)
}
function markEnd() {
endPos = mp.get_property('time-pos')
mp.osd_message('End Position Marked at ' + endPos)
}
function getMarked() {
if (!beginPos && !endPos) {
mp.osd_message('Please set Begin Position with Ctrl-b, End Position with Ctrl-e')
return
}
var ss = beginPos || 0
var t = endPos || mp.get_property('duration')
var path = mp.get_property('path')
var dir_file = mp.utils.split_path(path)
return {
dir: dir_file[0],
file: dir_file[1],
path: path,
ss: ss,
t: t
}
}
function outputMarked() {
var m = getMarked()
var output_dir = mp.utils.join_path(m.dir, 'clips')
mp.utils.subprocess({
args: ['mkdir', '-p', output_dir],
cancellable: false
})
output_file = mp.utils.join_path(output_dir, m.file)
mp.utils.subprocess({
args: ['ffmpeg', '-ss', ss, '-i', m.path, '-t', t, '-c', 'copy', output_file],
cancellable: false
})
mp.osd_message('Clip save to ' + output_file)
}
function copyCutCmd() {
var m = getMarked()
var cmd = 'ffmpeg -ss ' + m.ss + ' -i ' + "'" + m.file + "' -t " + m.t + " -c copy '"+m.file + "-" + (Math.floor(m.ss/60)) +"'"
mp.utils.subprocess({
args: ['powershell', '-NoProfile', '-Command', 'Set-Clipboard "'+cmd+'"'],
cancellable: false
})
mp.osd_message("command has been copied to your clipboard")
}
mp.add_key_binding("ctrl+b", "mark_begin", markBegin);
mp.add_key_binding("ctrl+e", "mark_end", markEnd);
mp.add_key_binding("ctrl+o", "output_marked", outputMarked);
mp.add_key_binding("ctrl+shift+o", "copy_cut_cmd", copyCutCmd);

View File

@ -1,38 +0,0 @@
local utils = require "mp.utils"
function mark_begin()
begin_pos = mp.get_property('time-pos')
mp.osd_message('Begin Position Marked at ' .. begin_pos)
end
function mark_end()
end_pos = mp.get_property('time-pos')
mp.osd_message('End Position Marked at ' .. end_pos)
end
function output_marked()
if not begin_pos and not end_pos then
mp.osd_message('Please set Begin Position with Ctrl-b, End Position with Ctrl-e')
return
end
ss = begin_pos or 0
t = end_pos or mp.get_property('duration')
path = mp.get_property('path')
dir, file = utils.split_path(path)
output_dir = utils.join_path(dir, 'clips')
utils.subprocess({
args={'mkdir', '-p', output_dir},
cancellable=false
})
output_file = utils.join_path(output_dir, file)
utils.subprocess({
args={'ffmpeg', '-ss', tostring(ss), '-i', path, '-t', tostring(t), '-c', 'copy', output_file},
cancellable=false
})
mp.osd_message('Clip save to ' .. output_file)
end
mp.add_key_binding("ctrl+b", "mark_begin", mark_begin);
mp.add_key_binding("ctrl+e", "mark_end", mark_end);
mp.add_key_binding("ctrl+o", "output_marked", output_marked);

View File

@ -7,9 +7,9 @@
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"initialPosition": "2118,0",
"initialRows": 71,
"initialCols": 142,
//"initialPosition": "2118,0",
//"initialRows": 71,
//"initialCols": 142,
"defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",

161
win/polipo/config Normal file
View File

@ -0,0 +1,161 @@
# Sample configuration file for Polipo. -*-sh-*-
# You should not need to use a configuration file; all configuration
# variables have reasonable defaults. If you want to use one, you
# can copy this to /etc/polipo/config or to ~/.polipo and modify.
# This file only contains some of the configuration variables; see the
# list given by ``polipo -v'' and the manual for more.
### Basic configuration
### *******************
# Uncomment one of these if you want to allow remote clients to
# connect:
# proxyAddress = "::0" # both IPv4 and IPv6
proxyAddress = "127.0.0.1" # IPv4 only
# If you do that, you'll want to restrict the set of hosts allowed to
# connect:
# allowedClients = 127.0.0.1, 134.157.168.57
# allowedClients = 127.0.0.1, 134.157.168.0/24
# Uncomment this if you want your Polipo to identify itself by
# something else than the host name:
# proxyName = "polipo.example.org"
# Uncomment this if there's only one user using this instance of Polipo:
# cacheIsShared = false
# Uncomment this if you want to use a parent proxy:
# parentProxy = "squid.example.org:3128"
# Uncomment this if you want to use a parent SOCKS proxy:
socksParentProxy = "localhost:2020"
socksProxyType = socks5
# Uncomment this if you want to scrub private information from the log:
# scrubLogs = true
### Memory
### ******
# Uncomment this if you want Polipo to use a ridiculously small amount
# of memory (a hundred C-64 worth or so):
# chunkHighMark = 819200
# objectHighMark = 128
# Uncomment this if you've got plenty of memory:
# chunkHighMark = 50331648
# objectHighMark = 16384
### On-disk data
### ************
# Uncomment this if you want to disable the on-disk cache:
# diskCacheRoot = ""
# Uncomment this if you want to put the on-disk cache in a
# non-standard location:
# diskCacheRoot = "~/.polipo-cache/"
# Uncomment this if you want to disable the local web server:
# localDocumentRoot = ""
# Uncomment this if you want to enable the pages under /polipo/index?
# and /polipo/servers?. This is a serious privacy leak if your proxy
# is shared.
# disableIndexing = false
# disableServersList = false
### Domain Name System
### ******************
# Uncomment this if you want to contact IPv4 hosts only (and make DNS
# queries somewhat faster):
# dnsQueryIPv6 = no
# Uncomment this if you want Polipo to prefer IPv4 to IPv6 for
# double-stack hosts:
# dnsQueryIPv6 = reluctantly
# Uncomment this to disable Polipo's DNS resolver and use the system's
# default resolver instead. If you do that, Polipo will freeze during
# every DNS query:
# dnsUseGethostbyname = yes
### HTTP
### ****
# Uncomment this if you want to enable detection of proxy loops.
# This will cause your hostname (or whatever you put into proxyName
# above) to be included in every request:
# disableVia=false
# Uncomment this if you want to slightly reduce the amount of
# information that you leak about yourself:
# censoredHeaders = from, accept-language
# censorReferer = maybe
# Uncomment this if you're paranoid. This will break a lot of sites,
# though:
# censoredHeaders = set-cookie, cookie, cookie2, from, accept-language
# censorReferer = true
# Uncomment this if you want to use Poor Man's Multiplexing; increase
# the sizes if you're on a fast line. They should each amount to a few
# seconds' worth of transfer; if pmmSize is small, you'll want
# pmmFirstSize to be larger.
# Note that PMM is somewhat unreliable.
# pmmFirstSize = 16384
# pmmSize = 8192
# Uncomment this if your user-agent does something reasonable with
# Warning headers (most don't):
# relaxTransparency = maybe
# Uncomment this if you never want to revalidate instances for which
# data is available (this is not a good idea):
# relaxTransparency = yes
# Uncomment this if you have no network:
# proxyOffline = yes
# Uncomment this if you want to avoid revalidating instances with a
# Vary header (this is not a good idea):
# mindlesslyCacheVary = true
# Uncomment this if you want to add a no-transform directive to all
# outgoing requests.
# alwaysAddNoTransform = true

3
win/polipo/download.md Normal file
View File

@ -0,0 +1,3 @@
https://www.irif.fr/~jch/software/files/polipo/polipo-1.1.0-win32.zip
create shortcut with `polipo.exe -c config`

View File

@ -7,6 +7,9 @@ Set-PSReadLineOption -EditMode Emacs
Set-PSReadLineOption -PredictionSource History
Set-PsFzfOption -PSReadlineChordProvider 'Ctrl+t' -PSReadlineChordReverseHistory 'Ctrl+r'
Import-Module posh-git
Import-Module oh-my-posh
$Dir = (Get-Item (Get-Item $PSCommandPath).Target).Directory.FullName
$Env:Path += ";$Dir\bin"
@ -19,8 +22,12 @@ Set-Alias -Name bm Open-Bookmark
Set-Alias -Name v nvim
$isPs7 = $host.Version.Major -ge 7
if ( $isPs7 ) {
if ((Get-Module oh-my-posh).Version.Major -eq 3) {
Set-PoshPrompt
} else {
Set-Prompt
}
}
function kcc { k config get-contexts $args }
function kcu { k config use-context $args}
@ -106,3 +113,13 @@ function pass-edit {
Remove-Item $tmpfile.FullName -Force
}
}
function f {
[Cmdletbinding()]
$tmpfile = New-TemporaryFile
lf -last-dir-path $tmpfile
$lastdir = Get-Content $tmpfile
Remove-Item $tmpfile
cd $lastdir
}

3
win/setup/lf.ps1 Normal file
View File

@ -0,0 +1,3 @@
$dotfiles=(Get-Item $PSScriptRoot).Parent.Parent.FullName
New-Item -Force -ItemType SymbolicLink -Target $dotfiles\cli\lf\lfrc.win -Path $Env:LOCALAPPDATA\lf\lfrc

View File

@ -1,4 +1,4 @@
$dotfiles=(Get-Item $PSScriptRoot).Parent.FullName
New-Item -ItemType SymbolicLink -Target $dotfiles\config\mpv\mpv.conf -Path $Env:APPDATA\mpv\mpv.conf -Force
New-Item -ItemType SymbolicLink -Target $dotfiles\config\mpv\scripts -Path $Env:APPDATA\mpv\scripts -Force
$dotfiles=(Get-Item $PSScriptRoot).Parent.Parent.FullName
New-Item -ItemType SymbolicLink -Target $dotfiles\gui\mpv\mpv.conf -Path $Env:APPDATA\mpv\mpv.conf -Force
New-Item -ItemType SymbolicLink -Target $dotfiles\gui\mpv\scripts -Path $Env:APPDATA\mpv\scripts -Force

View File

@ -1,10 +1,12 @@
# curl: https://curl.se/windows/
# ag: https://github.com/k-takata/the_silver_searcher-win32/releases
# fzf: https://github.com/junegunn/fzf/releases/latest
Install-Module -Name PowerShellGet -Force -AllowPrerelease
# $PSDefaultParameterValues = @{ "*:Proxy"="http://localhost:8123" }
#Install-Module -Name PowerShellGet -Force -AllowPrerelease
Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted
Install-Module -Name posh-git
Install-Module -Name oh-my-posh
Install-Module -Name psfzf
$dotfiles=(Get-Item $PSScriptRoot).Parent.FullName
$dotfiles=(Get-Item $PSScriptRoot).Parent.Parent.FullName
New-Item -ItemType SymbolicLink -Target $dotfiles\win\profile.ps1 -Path $profile -Force

View File

@ -1,5 +1,5 @@
$dotfiles=(Get-Item $PSScriptRoot).Parent.FullName
$dotfiles=(Get-Item $PSScriptRoot).Parent.Parent.FullName
if ( ! (Test-Path $Env:LOCALAPPDATA\nvim) ) {
New-Item -ItemType Directory -Path $Env:LOCALAPPDATA\nvim
}

View File

@ -0,0 +1,3 @@
$dotfiles=(Get-Item $PSScriptRoot).Parent.Parent.FullName
New-Item -Force -ItemType SymbolicLink -Target $dotfiles\win\WindowsTerminal\settings.json -Path $Env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json

View File

@ -160,6 +160,10 @@ FocusWinByDirection(direction) {
}
MoveActiveWinByDirection(direction) {
WinGet, isMax, MinMax, A
if (isMax) {
WinRestore, A
}
global RATIO
GetCursorMonGeometry(x, y, w, h)
activeWinId := WinExist("A")