2024-10-20 19:53:44 +0100

This commit is contained in:
js0ny 2024-10-20 19:53:25 +01:00
parent bde5d89003
commit 488c69e301
12 changed files with 279 additions and 32 deletions

3
.gitignore vendored
View file

@ -1,4 +1,4 @@
*_private/
*private*
.private.env.*
nvim/tt.*
nvim/.tests
@ -16,3 +16,4 @@ test.*
*.tar
*.zip
*.tgz
WindowsTerminal.json

3
.haskline Normal file
View file

@ -0,0 +1,3 @@
editMode: Vi
bind: ctrl-p up
bind: ctrl-n down

6
.markdownlint.json Normal file
View file

@ -0,0 +1,6 @@
{
"line-length": false,
"no-inline-html": false,
"no-alt-text": false,
"ul-style": { "style": "dash" }
}

74
.obsidian.vimrc Normal file
View file

@ -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 <Down> " 向下
noremap e <Up> " 向上
noremap i <Right> " 向右
""" 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<CR> " Add delete to selection
vnoremap ` c`<C-r>"`<Esc> " editor:toogle-code is buggy
vnoremap * :addbold<CR> " Add bold to selection
vnoremap _ :additalic<CR> " 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<CR>
nnoremap I :nexttab<CR>
exmap reload :source .obsidian.vimrc<CR>
unmap <Space>
exmap vsplit obcommand workspace:split-vertical
exmap hsplit obcommand workspace:split-horizontal
map <Space>| :vsplit<CR>
map <Space>- :hsplit<CR>
map <Space>bd
exmap chat obcommand obsidian-custom-frames:open-custom-frames-chatgpt
map <Space>ai :chat<CR>
exmap omnisearch obcommand omnisearch:show-modal
map <Space><Space> :omnisearch<CR>
""" g-commands
exmap tsource obcommand editor:toggle-source
nnoremap gs :tsource<CR>

View file

@ -1,2 +1,2 @@
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
# index-url = https://pypi.tuna.tsinghua.edu.cn/simple

View file

@ -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++ #

View file

@ -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*

103
surfingkeys.js Normal file
View file

@ -0,0 +1,103 @@
// Paste this into surfingkeys advanced settings
/** Examples
// an example to create a new mapping `ctrl-y`
api.mapkey('<ctrl-y>', '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('<ctrl-i>');
*/
// 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.</ctrl-i></ctrl-y>

29
vscode/vscode.vimrc Normal file
View file

@ -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 <Down> " 向下
noremap e <Up> " 向上
noremap i <Right> " 向右

View file

@ -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
; [experimental]
; # requires dnsTunneling but are also OPTIONAL
; bestEffortDnsParsing=true
; useWindowsDnsCache=true
; hostAddressLoopback=true

View file

@ -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

View file

@ -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