From df88998b9b08296bd0664132e2bd2d5c92c572fb Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Fri, 26 Feb 2021 11:46:22 +0800 Subject: [PATCH 01/16] [feature] setup windows terminal --- win/setup/windows-terminal.ps1 | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 win/setup/windows-terminal.ps1 diff --git a/win/setup/windows-terminal.ps1 b/win/setup/windows-terminal.ps1 new file mode 100644 index 0000000..50120a3 --- /dev/null +++ b/win/setup/windows-terminal.ps1 @@ -0,0 +1,3 @@ + +$dotfiles=(Get-Item $PSScriptRoot).Parent.FullName +New-Item -Force -ItemType SymbolicLink -Target $dotfiles\win\WindowsTerminal\settings.json -Path $Env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json From 22cf417416daf4f51417bd3f506f9be105537cc6 Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Fri, 26 Feb 2021 17:12:15 +0800 Subject: [PATCH 02/16] [bugfix] Windows Terminal settings.json path --- win/setup/windows-terminal.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/setup/windows-terminal.ps1 b/win/setup/windows-terminal.ps1 index 50120a3..46bb1f9 100644 --- a/win/setup/windows-terminal.ps1 +++ b/win/setup/windows-terminal.ps1 @@ -1,3 +1,3 @@ $dotfiles=(Get-Item $PSScriptRoot).Parent.FullName -New-Item -Force -ItemType SymbolicLink -Target $dotfiles\win\WindowsTerminal\settings.json -Path $Env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json +New-Item -Force -ItemType SymbolicLink -Target $dotfiles\WindowsTerminal\settings.json -Path $Env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json From bd40bc172597b2523a81da97284d25dfbbaa0f99 Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Fri, 26 Feb 2021 18:12:32 +0800 Subject: [PATCH 03/16] [bugfix] oh-my-posh v3 / path resolved --- win/WindowsTerminal/settings.json | 6 +- win/polipo/config | 161 ++++++++++++++++++++++++++++++ win/polipo/download.md | 3 + win/profile.ps1 | 9 +- win/setup/mpv.ps1 | 2 +- win/setup/oh-my-posh.ps1 | 6 +- win/setup/vim.ps1 | 2 +- win/setup/windows-terminal.ps1 | 2 +- 8 files changed, 182 insertions(+), 9 deletions(-) create mode 100644 win/polipo/config create mode 100644 win/polipo/download.md diff --git a/win/WindowsTerminal/settings.json b/win/WindowsTerminal/settings.json index ef32b65..be5722d 100644 --- a/win/WindowsTerminal/settings.json +++ b/win/WindowsTerminal/settings.json @@ -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}", diff --git a/win/polipo/config b/win/polipo/config new file mode 100644 index 0000000..29c16a5 --- /dev/null +++ b/win/polipo/config @@ -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 diff --git a/win/polipo/download.md b/win/polipo/download.md new file mode 100644 index 0000000..f1b78d3 --- /dev/null +++ b/win/polipo/download.md @@ -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` \ No newline at end of file diff --git a/win/profile.ps1 b/win/profile.ps1 index d75b0e1..6fd1433 100644 --- a/win/profile.ps1 +++ b/win/profile.ps1 @@ -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,7 +22,11 @@ Set-Alias -Name bm Open-Bookmark Set-Alias -Name v nvim $isPs7 = $host.Version.Major -ge 7 if ( $isPs7 ) { - Set-Prompt + if ((Get-Module oh-my-posh).Version.Major -eq 3) { + Set-PoshPrompt + } else { + Set-Prompt + } } function kcc { k config get-contexts $args } diff --git a/win/setup/mpv.ps1 b/win/setup/mpv.ps1 index db6d0e5..e1830ed 100644 --- a/win/setup/mpv.ps1 +++ b/win/setup/mpv.ps1 @@ -1,4 +1,4 @@ -$dotfiles=(Get-Item $PSScriptRoot).Parent.FullName +$dotfiles=(Get-Item $PSScriptRoot).Parent.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 \ No newline at end of file diff --git a/win/setup/oh-my-posh.ps1 b/win/setup/oh-my-posh.ps1 index dc22204..3636424 100644 --- a/win/setup/oh-my-posh.ps1 +++ b/win/setup/oh-my-posh.ps1 @@ -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 diff --git a/win/setup/vim.ps1 b/win/setup/vim.ps1 index f241990..b885e79 100644 --- a/win/setup/vim.ps1 +++ b/win/setup/vim.ps1 @@ -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 } diff --git a/win/setup/windows-terminal.ps1 b/win/setup/windows-terminal.ps1 index 46bb1f9..a3ac8f0 100644 --- a/win/setup/windows-terminal.ps1 +++ b/win/setup/windows-terminal.ps1 @@ -1,3 +1,3 @@ -$dotfiles=(Get-Item $PSScriptRoot).Parent.FullName +$dotfiles=(Get-Item $PSScriptRoot).Parent.Parent.FullName New-Item -Force -ItemType SymbolicLink -Target $dotfiles\WindowsTerminal\settings.json -Path $Env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json From 7ef32384a7eb457e7e2549c1aef1de184ac4b12f Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Sat, 27 Feb 2021 09:52:19 +0800 Subject: [PATCH 04/16] [bugfix] add copyCutCmd --- gui/mpv/scripts/cut.js | 61 +++++++++++++++++++++++++++++++++++++++++ gui/mpv/scripts/cut.lua | 38 ------------------------- 2 files changed, 61 insertions(+), 38 deletions(-) create mode 100644 gui/mpv/scripts/cut.js delete mode 100644 gui/mpv/scripts/cut.lua diff --git a/gui/mpv/scripts/cut.js b/gui/mpv/scripts/cut.js new file mode 100644 index 0000000..6d81f90 --- /dev/null +++ b/gui/mpv/scripts/cut.js @@ -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); diff --git a/gui/mpv/scripts/cut.lua b/gui/mpv/scripts/cut.lua deleted file mode 100644 index ec58107..0000000 --- a/gui/mpv/scripts/cut.lua +++ /dev/null @@ -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); From 738cc7581d441d269e108e67050e8ab42d18a164 Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Sat, 27 Feb 2021 09:52:47 +0800 Subject: [PATCH 05/16] [feature] auto unmaximize window before move --- win/win.ahk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/win/win.ahk b/win/win.ahk index dcf3d8d..440e64e 100644 --- a/win/win.ahk +++ b/win/win.ahk @@ -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") From fe535313911a2243b66fdb20222d03d44b801114 Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Sat, 27 Feb 2021 09:53:05 +0800 Subject: [PATCH 06/16] [bugfix] fix configuration path --- win/setup/mpv.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/win/setup/mpv.ps1 b/win/setup/mpv.ps1 index e1830ed..650ff9e 100644 --- a/win/setup/mpv.ps1 +++ b/win/setup/mpv.ps1 @@ -1,4 +1,4 @@ $dotfiles=(Get-Item $PSScriptRoot).Parent.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 \ No newline at end of file +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 From 2e873564c65e2dd1c799f09758b770bf7bd802cb Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Sun, 28 Feb 2021 12:33:19 +0800 Subject: [PATCH 07/16] [feature] mkdir / copy fullpath / copy file name --- cli/lf/lfrc.win | 5 +++++ win/setup/lf.ps1 | 3 +++ win/setup/windows-terminal.ps1 | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 cli/lf/lfrc.win create mode 100644 win/setup/lf.ps1 diff --git a/cli/lf/lfrc.win b/cli/lf/lfrc.win new file mode 100644 index 0000000..897eb3f --- /dev/null +++ b/cli/lf/lfrc.win @@ -0,0 +1,5 @@ + +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 '"','')) diff --git a/win/setup/lf.ps1 b/win/setup/lf.ps1 new file mode 100644 index 0000000..5745f22 --- /dev/null +++ b/win/setup/lf.ps1 @@ -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 diff --git a/win/setup/windows-terminal.ps1 b/win/setup/windows-terminal.ps1 index a3ac8f0..d773fd0 100644 --- a/win/setup/windows-terminal.ps1 +++ b/win/setup/windows-terminal.ps1 @@ -1,3 +1,3 @@ $dotfiles=(Get-Item $PSScriptRoot).Parent.Parent.FullName -New-Item -Force -ItemType SymbolicLink -Target $dotfiles\WindowsTerminal\settings.json -Path $Env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json +New-Item -Force -ItemType SymbolicLink -Target $dotfiles\win\WindowsTerminal\settings.json -Path $Env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json From 27d3a43452443b60809212198abc95e076d434dd Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Tue, 2 Mar 2021 10:52:31 +0800 Subject: [PATCH 08/16] [feature] add lf --- cli/fish.sh | 1 + cli/fish/functions/f.fish | 12 ++++++++++++ cli/lf.sh | 16 ++++++++++++++++ cli/lf/lfrc | 8 ++++++++ devel/go.sh | 2 +- 5 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 cli/fish/functions/f.fish create mode 100755 cli/lf.sh create mode 100644 cli/lf/lfrc diff --git a/cli/fish.sh b/cli/fish.sh index c4138ea..0c62277 100755 --- a/cli/fish.sh +++ b/cli/fish.sh @@ -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" diff --git a/cli/fish/functions/f.fish b/cli/fish/functions/f.fish new file mode 100644 index 0000000..700966c --- /dev/null +++ b/cli/fish/functions/f.fish @@ -0,0 +1,12 @@ +function f --description='sync lf pwd to shell when exit' + 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 diff --git a/cli/lf.sh b/cli/lf.sh new file mode 100755 index 0000000..394591d --- /dev/null +++ b/cli/lf.sh @@ -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" diff --git a/cli/lf/lfrc b/cli/lf/lfrc new file mode 100644 index 0000000..59d08ed --- /dev/null +++ b/cli/lf/lfrc @@ -0,0 +1,8 @@ +set drawbox +cmd mkdir %mkdir "$@" + +cmd copyfilepath %echo "$f" | xsel -b +cmd copyfilename %basename "$f" | xsel -b + +map Yp copyfilepath +map Yn copyfilename diff --git a/devel/go.sh b/devel/go.sh index 010b865..b6ab9c4 100755 --- a/devel/go.sh +++ b/devel/go.sh @@ -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 From 3582bb47377a6776f35d4f88f87572a7174858de Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Tue, 2 Mar 2021 17:49:01 +0800 Subject: [PATCH 09/16] [feature] add icons --- cli/fish/functions/f.fish | 162 ++++++++++++++++++++++++++++++++++++++ cli/lf/lfrc | 1 + 2 files changed, 163 insertions(+) diff --git a/cli/fish/functions/f.fish b/cli/fish/functions/f.fish index 700966c..71fbf91 100644 --- a/cli/fish/functions/f.fish +++ b/cli/fish/functions/f.fish @@ -1,4 +1,166 @@ 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 diff --git a/cli/lf/lfrc b/cli/lf/lfrc index 59d08ed..0f68500 100644 --- a/cli/lf/lfrc +++ b/cli/lf/lfrc @@ -1,4 +1,5 @@ set drawbox +set icons cmd mkdir %mkdir "$@" cmd copyfilepath %echo "$f" | xsel -b From a863c733473a5ae47a4481cdd402da323f2d0da4 Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Fri, 5 Mar 2021 11:56:56 +0800 Subject: [PATCH 10/16] [feature] capital P for paste-overwrite --- cli/lf/lfrc | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/cli/lf/lfrc b/cli/lf/lfrc index 0f68500..cd43a86 100644 --- a/cli/lf/lfrc +++ b/cli/lf/lfrc @@ -3,7 +3,21 @@ set icons cmd mkdir %mkdir "$@" cmd copyfilepath %echo "$f" | xsel -b -cmd copyfilename %basename "$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 From 1c91dde68b6226bff035986ee7d8685b87cdf020 Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Sat, 6 Mar 2021 21:06:27 +0800 Subject: [PATCH 11/16] [misc] add ~/go/bin to PATH --- cli/fish/config.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/fish/config.fish b/cli/fish/config.fish index cfb971b..5d3cd59 100644 --- a/cli/fish/config.fish +++ b/cli/fish/config.fish @@ -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 From 6324cfd7b024d1a4e36b20d5f0c295e4abc694dd Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Sun, 21 Mar 2021 18:09:58 +0800 Subject: [PATCH 12/16] [misc] lf for win --- cli/lf/lfrc.win | 5 +++++ win/profile.ps1 | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/cli/lf/lfrc.win b/cli/lf/lfrc.win index 897eb3f..8831d89 100644 --- a/cli/lf/lfrc.win +++ b/cli/lf/lfrc.win @@ -1,5 +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 rename diff --git a/win/profile.ps1 b/win/profile.ps1 index 6fd1433..4cde92e 100644 --- a/win/profile.ps1 +++ b/win/profile.ps1 @@ -113,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 +} From 2cc47607df0f0e26fc08ce6c46cda3400e91c522 Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Thu, 25 Mar 2021 11:54:17 +0800 Subject: [PATCH 13/16] [feature] auto set window title --- cli/tmux/tmux.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cli/tmux/tmux.conf b/cli/tmux/tmux.conf index 18b1754..9e6bf25 100644 --- a/cli/tmux/tmux.conf +++ b/cli/tmux/tmux.conf @@ -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" ############################ From 59f75acb083dc548d2a36936ee639e5449caa6f0 Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Thu, 25 Mar 2021 11:54:29 +0800 Subject: [PATCH 14/16] [bugfix] error when running inside idea --- cli/fish/functions/fish_right_prompt.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/fish/functions/fish_right_prompt.fish b/cli/fish/functions/fish_right_prompt.fish index e4b467e..7048fea 100644 --- a/cli/fish/functions/fish_right_prompt.fish +++ b/cli/fish/functions/fish_right_prompt.fish @@ -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 From dffca1979f9e10bae7e61283d228eda8c21adee8 Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Thu, 25 Mar 2021 11:54:46 +0800 Subject: [PATCH 15/16] [feature] launch idea on dwm --- bin/idea | 5 +++++ 1 file changed, 5 insertions(+) create mode 100755 bin/idea diff --git a/bin/idea b/bin/idea new file mode 100755 index 0000000..886682f --- /dev/null +++ b/bin/idea @@ -0,0 +1,5 @@ +#!/bin/sh + +wmname LG3D +/home/klesh/Programs/idea-IC-203.7717.32/bin/idea.sh + From 74c750d8cc26141cf2e13699c76d7c9430c1648f Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Sat, 27 Mar 2021 11:02:45 +0800 Subject: [PATCH 16/16] [bugfix] dbeaver interface flicking --- bin/dbe | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100755 bin/dbe diff --git a/bin/dbe b/bin/dbe new file mode 100755 index 0000000..d46fa93 --- /dev/null +++ b/bin/dbe @@ -0,0 +1,6 @@ +#!/bin/sh + +export GTK_IM_MODULE="ibus" +export QT_IM_MODULE="ibus" +export XMODIFIERS="@im=ibus" +dbeaver