From 488c69e301502f75e811e325b6f28abb5ad128f0 Mon Sep 17 00:00:00 2001 From: js0ny Date: Sun, 20 Oct 2024 19:53:25 +0100 Subject: [PATCH] 2024-10-20 19:53:44 +0100 --- .gitignore | 3 +- .haskline | 3 + .markdownlint.json | 6 ++ .obsidian.vimrc | 74 +++++++++++++++++++ pip.conf | 2 +- powershell/shared.ps1 | 2 +- readme.md | 19 +---- surfingkeys.js | 103 +++++++++++++++++++++++++++ vscode/vscode.vimrc | 29 ++++++++ win/.wslconfig | 20 +++--- win/Microsoft.PowerShell_profile.ps1 | 47 ++++++++++++ win/neovide.toml | 3 +- 12 files changed, 279 insertions(+), 32 deletions(-) create mode 100644 .haskline create mode 100644 .markdownlint.json create mode 100644 .obsidian.vimrc create mode 100644 surfingkeys.js create mode 100644 vscode/vscode.vimrc diff --git a/.gitignore b/.gitignore index 1c942eb..35878af 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -*_private/ +*private* .private.env.* nvim/tt.* nvim/.tests @@ -16,3 +16,4 @@ test.* *.tar *.zip *.tgz +WindowsTerminal.json \ No newline at end of file diff --git a/.haskline b/.haskline new file mode 100644 index 0000000..6750f58 --- /dev/null +++ b/.haskline @@ -0,0 +1,3 @@ +editMode: Vi +bind: ctrl-p up +bind: ctrl-n down \ No newline at end of file diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 0000000..f325493 --- /dev/null +++ b/.markdownlint.json @@ -0,0 +1,6 @@ +{ + "line-length": false, + "no-inline-html": false, + "no-alt-text": false, + "ul-style": { "style": "dash" } +} \ No newline at end of file diff --git a/.obsidian.vimrc b/.obsidian.vimrc new file mode 100644 index 0000000..41199cc --- /dev/null +++ b/.obsidian.vimrc @@ -0,0 +1,74 @@ +" Put this in OBSIDIAN_VAULT/.obsidian.vimrc + +" Colemak 方向键映射 (hnei) +nnoremap k n +nnoremap K N +nnoremap j e +vnoremap j e +nnoremap l i +nnoremap N J +nnoremap E K +nnoremap I L +nnoremap J E +vnoremap J E +nnoremap L I +nnoremap k n +nnoremap K N +nnoremap j e +vnoremap j e +nnoremap l i +nnoremap N J +nnoremap E K +nnoremap I L +nnoremap J E +vnoremap J E +nnoremap L I +" 方向键映射 +noremap n " 向下 +noremap e " 向上 +noremap i " 向右 + + +""" Word wrap cursor movement +nmap j gj +nmap k gk + +nmap Y y$ " Use Y to yank to the EOL + +set clipboard=unnamed " Sync with System Clipboard + +""" Visual mode surrounding +exmap addbold obcommand editor:toogle-bold +exmap additalic obcommand editor:toogle-italic +exmap addhighlight obcommand editor:toogle-highlight +exmap addcode obcommand editor:toogle-code +exmap adddel obcommand editor:toogle-strikethrough +vnoremap ~ :adddel " Add delete to selection +vnoremap ` c`"` " editor:toogle-code is buggy +vnoremap * :addbold " Add bold to selection +vnoremap _ :additalic " Add italic to selection +vnoremap = :addhighlight " Add highlight to selection + +exmap prevtab obcommand workspace:previous-tab +exmap nexttab obcommand workspace:next-tab +nnoremap H :prevtab +nnoremap I :nexttab + +exmap reload :source .obsidian.vimrc + +unmap +exmap vsplit obcommand workspace:split-vertical +exmap hsplit obcommand workspace:split-horizontal +map | :vsplit +map - :hsplit +map bd + +exmap chat obcommand obsidian-custom-frames:open-custom-frames-chatgpt +map ai :chat + +exmap omnisearch obcommand omnisearch:show-modal +map :omnisearch + +""" g-commands +exmap tsource obcommand editor:toggle-source +nnoremap gs :tsource diff --git a/pip.conf b/pip.conf index 883b782..27a69a5 100644 --- a/pip.conf +++ b/pip.conf @@ -1,2 +1,2 @@ [global] -index-url = https://pypi.tuna.tsinghua.edu.cn/simple \ No newline at end of file +# index-url = https://pypi.tuna.tsinghua.edu.cn/simple \ No newline at end of file diff --git a/powershell/shared.ps1 b/powershell/shared.ps1 index 16de582..bd7c77b 100644 --- a/powershell/shared.ps1 +++ b/powershell/shared.ps1 @@ -4,7 +4,6 @@ Set-PSReadLineOption -EditMode vi # Vi Keybindings Set-PSReadLineOption -PredictionViewStyle ListView Set-PSReadLineOption -PredictionSource HistoryAndPlugin Set-PSReadLineOption -ContinuationPrompt "`e[36m CR > " - ### Keybindings ### Set-PSReadLineKeyHandler -Chord "Ctrl+Shift+f" -Function ForwardWord @@ -78,6 +77,7 @@ ${function:pylsenvs} = { conda env list } ${function:pymkenv} = { conda create --name $args[0] } ${function:pyrmenv} = { conda remove --name $args[0] --all } + # C & C++ # diff --git a/readme.md b/readme.md index 6fd7612..5cf4169 100644 --- a/readme.md +++ b/readme.md @@ -1,19 +1,4 @@ -# .DOTFILES js0ny +# .dotfiles -## Navigator - -- [Windows](./win/readme.md) -- [Linux](./linux/readme.md) -- [Mac](./mac/readme.md) - -- [Neovim](./nvim/readme.md) -- [VSCode](./vscode/readme.md) - -- [IdeaVim](./.ideavimrc) - -- [Git](./.gitconfig) - -- [pip](./pip.conf) -- [npm](./.npmrc) -- [conda](./.condarc) +Moving to *Colemak* diff --git a/surfingkeys.js b/surfingkeys.js new file mode 100644 index 0000000..7406ff4 --- /dev/null +++ b/surfingkeys.js @@ -0,0 +1,103 @@ +// Paste this into surfingkeys advanced settings + +/** Examples + +// an example to create a new mapping `ctrl-y` +api.mapkey('', 'Show me the money', function() { + Front.showPopup('a well-known phrase uttered by characters in the 1996 film Jerry Maguire (Escape to close).'); +}); + +// an example to replace `T` with `gt`, click `Default mappings` to see how `T` works. +api.map('gt', 'T'); + + +// an example to remove mapkey `Ctrl-i` +api.unmap(''); + +*/ +// Settings +settings.language = "zh-CN" ; +settings.showModeStatus = true; +// Colemak hjkl (hnei) +// map('h', 'h') // left no change +api.map('n', 'j') // down +api.vmap('n', 'j') // down +api.map('e', 'k') // up +api.vmap('e', 'k') // up +api.map('i', 'l') // right +api.vmap('i', 'l') // right +// DELETED map j -> e : use j to scroll up half page +api.vmap('j', 'e') // end of word +api.map('k', 'n') // search next word (Original Position of n) +api.vmap('k', 'n') // search next word (Original Position of n) +api.map('l', 'i') // insert mode, similar position to original i +api.vmap('l', 'i') // insert mode, similar position to original i +api.map('L', 'I') // insert mode with vim popup, similar pos to I + +// Prev/Next Page (WASD-like left-hand navigation) +api.map('A', 'E') +api.map('S', 'R') +// map('d', 'd') for scroll down half page +api.map('j', 'u') //scrool up half page +api.map('T', 'C') // Open in new tab + +// Search Alias +api.addSearchAlias('f', 'Felo', 'https://felo.ai/search?q=', 's', 'https://duckduckgo.com/ac/?q=', function(response) { + var res = JSON.parse(response.text); + return res.map(function(r){ + return r.phrase; + }); +}); +api.addSearchAlias('p', 'Perplexity', 'https://www.perplexity.ai/?q=', 's', 'https://duckduckgo.com/ac/?q=', function(response) { + var res = JSON.parse(response.text); + return res.map(function(r){ + return r.phrase; + }); +}); +api.addSearchAlias('r', 'Raindrop', 'https://app.raindrop.io/my/0/', 's', 'https://duckduckgo.com/ac/?q=', function(response) { + var res = JSON.parse(response.text); + return res.map(function(r){ + return r.phrase; + }); +}); + + +// Theme +settings.theme = ` +.sk_theme { + font-family: Input Sans Condensed, Charcoal, sans-serif; + font-size: 10pt; + background: #24272e; + color: #abb2bf; +} +.sk_theme tbody { + color: #fff; +} +.sk_theme input { + color: #d0d0d0; +} +.sk_theme .url { + color: #61afef; +} +.sk_theme .annotation { + color: #56b6c2; +} +.sk_theme .omnibar_highlight { + color: #528bff; +} +.sk_theme .omnibar_timestamp { + color: #e5c07b; +} +.sk_theme .omnibar_visitcount { + color: #98c379; +} +.sk_theme #sk_omnibarSearchResult ul li:nth-child(odd) { + background: #303030; +} +.sk_theme #sk_omnibarSearchResult ul li.focused { + background: #3e4452; +} +#sk_status, #sk_find { + font-size: 20pt; +}`; +// click `Save` button to make above settings to take effect. \ No newline at end of file diff --git a/vscode/vscode.vimrc b/vscode/vscode.vimrc new file mode 100644 index 0000000..5bab85e --- /dev/null +++ b/vscode/vscode.vimrc @@ -0,0 +1,29 @@ +"vim.vimrc.path": "$HOME/.vscode.vimrc", // from vscode settings.json + +" Colemak 方向键映射 (hnei) +nnoremap k n +nnoremap K N +nnoremap j e +vnoremap j e +nnoremap l i +nnoremap N J +nnoremap E K +nnoremap I L +nnoremap J E +vnoremap J E +nnoremap L I +nnoremap k n +nnoremap K N +nnoremap j e +vnoremap j e +nnoremap l i +nnoremap N J +nnoremap E K +nnoremap I L +nnoremap J E +vnoremap J E +nnoremap L I +" 方向键映射 +noremap n " 向下 +noremap e " 向上 +noremap i " 向右 diff --git a/win/.wslconfig b/win/.wslconfig index c128cdf..3a96c0c 100644 --- a/win/.wslconfig +++ b/win/.wslconfig @@ -1,11 +1,11 @@ -[wsl2] -networkingMode=mirrored -dnsTunneling=true -firewall=true -autoProxy=true +; [wsl2] +; networkingMode=mirrored +; dnsTunneling=true +; firewall=true +; autoProxy=true -[experimental] -# requires dnsTunneling but are also OPTIONAL -bestEffortDnsParsing=true -useWindowsDnsCache=true -hostAddressLoopback=true \ No newline at end of file +; [experimental] +; # requires dnsTunneling but are also OPTIONAL +; bestEffortDnsParsing=true +; useWindowsDnsCache=true +; hostAddressLoopback=true \ No newline at end of file diff --git a/win/Microsoft.PowerShell_profile.ps1 b/win/Microsoft.PowerShell_profile.ps1 index a98c81f..76f31bc 100644 --- a/win/Microsoft.PowerShell_profile.ps1 +++ b/win/Microsoft.PowerShell_profile.ps1 @@ -19,6 +19,7 @@ ${function:shcfg} = { code $PROFILE } ${function:reload} = { . $PROFILE } ${function:pulldots} = { Set-Location -Path $DOTFILES && git pull } Set-Alias "pwshcfg" "shcfg" + # C & C++ # # Set-Alias "cl" "clang" @@ -51,6 +52,46 @@ Set-Alias "pip3" "pip" ${function:wsl1} = {wsl.exe --distribution Debian} ${function:wsl2} = {wsl.exe --distribution Ubuntu-22.04} +# Search Software # + +function Get-AppPackageListRemote { + param( + [string]$Name + ) + if (-not $Name) { + Write-Host "Please provide a package name." + return + } + Write-Host "Searching for $Name..." + Write-Host "=== winget ===" + winget search $Name + Write-Host "=== choco ===" + choco search $Name +} + +Set-Alias "pkgsearch" "Get-AppPackageListRemote" + +function Get-AppPackageListLocal { + winget list + choco list + scoop list +} +# Toggle Theme # + +function Set-SystemTheme { + $regPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" + $currentMode = Get-ItemProperty -Path $regPath -Name "AppsUseLightTheme" + if ($currentMode.AppsUseLightTheme -eq 1) { + Set-ItemProperty -Path $regPath -Name "AppsUseLightTheme" -Value 0 + Write-Host "已切换到深色模式" + } + else { + Set-ItemProperty -Path $regPath -Name "AppsUseLightTheme" -Value 1 + Write-Host "已切换到浅色模式" + } +} + +Set-Alias "theme" "Set-SystemTheme" # Miscs # @@ -62,6 +103,12 @@ Import-Module CompletionPredictor ### Misc ### +${function:qwen} = "ollama run qwen2.5:14b" + +# ## Oh-My-Posh ## + +# Oh-My-Posh init pwsh --config "$HOME\AppData\Local\Programs\oh-my-posh\themes\tokyonight_storm.omp.json" | Invoke-Expression + ## Conda ## #region conda initialize diff --git a/win/neovide.toml b/win/neovide.toml index e1b21fb..19df476 100644 --- a/win/neovide.toml +++ b/win/neovide.toml @@ -8,8 +8,7 @@ tabs = true theme = "auto" title-hidden = true vsync = false -wsl = true -neovim-bin = "/opt/nvim-linux64/bin/nvim" +wsl = false [font] normal = ["CaskaydiaCove Nerd Font"] # Will use the bundled Fira Code Nerd Font by default