雑多メモ
最近、GitHubからGmail宛てのメール通知がフォーラムカテゴリ以外に散らばるようになったのでその対策
- GitHubのSettings -> Emails -> Add email addressから
youraccount+gmail@gmail.com
のようなエイリアスを追加する - Settings -> Notifications -> Default notification emailを追加したメールアドレスに変更する
- Gmailで
deliveredto:youraccount+github@gmail.com
を検索して検索オプションを表示する (Deliver-Toヘッダに通知用メールアドレスが載っている) - 続行ボタンを押して適用するカテゴリにフォーラムを指定してフィルタを作成する
Webサイトにアプリの情報を表示する
Jetbrains IDEのプラグインページに起動中のRiderの情報が表示されていて気になったので仕組みを調べてみた。
ChromeのDevToolsでNetworkを開くと以下のURLにアクセスしていた。
http://localhost:63342/api/installPlugin?action=checkCompatibility&pluginId=com.intellij.ja
ブラウザからここを開くとRiderが反応したのでローカルでWebサーバーを立ち上げてるらしい。
プラグインページからだと以下のレスポンスヘッダーが返されているので問題なくアクセスできている。
access-control-allow-origin: https://plugins.jetbrains.com
アプリ内サーバーはこの辺りにありそう
アプリ内サーバーを起動したくない場合はRiderだとメニューのHelp > Edit Custom VM Optionsを開いて以下の1行を追加して再起動すれば無効化できる
-Didea.builtin.server.disabled=true
conanの既存recipeを更新する手順
-
pipで最新conanをインストールする
-
以下のコマンドでテスト用フックを追加する
conan config install https://github.com/conan-io/hooks.git -sf hooks -tf hooks conan config set hooks.conan-center
-
修正するrecipeのallフォルダへ移動して修正する (sqlcipherの場合)
cd conan-center-index/recipes/sqlcipher/all
-
修正したバージョンのライブラリをビルドする (sqlcipher 4.5.0の場合)
conan create conanfile.py sqlcipher/4.5.0@
-
オプションを指定してビルドする場合
conan create conanfile.py sqlcipher/4.5.0@ -o sqlcipher:shared=True
参考ドキュメント
sqlite-netのプロジェクトにsqlcipher.dllを配置する
https://github.com/praeclarum/sqlite-net のユニットテストを通すためには以下のパスにdllを置く。
プロジェクト毎の環境変数を設定できるならそのパスに置く。
tests/SQLite.Tests/bin/Debug/netcoreapp3.1/sqlite3.dll
sqlite3.dllをプロジェクト内にコピーしておき、SQLite.Testsプロジェクトのプロパティを開き、ビルド イベントのビルド後イベントのコマンドラインで出力フォルダへコピーするとクリーン後に手動コピーしなくてもOK
以下は Library\sqlcipher.dll
にコピーしておく場合
copy $(SolutionDir)Library\sqlcipher.dll $(TargetDir)sqlite3.dll /Y
vimからneovimへ移行した時に追加した設定
" terminal {{{
" https://zenn.dev/ryo_kawamata/articles/improve-neovmi-terminal
tnoremap <Esc> <C-\><C-n>
command! -nargs=* T split | wincmd j | resize 20 | terminal <args>
autocmd TermOpen * startinsert
nnoremap <Leader>tt :<C-u>T pwsh<CR>
" }}}
" https://github.com/neovim/neovim/pull/13268
nnoremap Y yy
" https://github.com/equalsraf/neovim-qt/issues/732
Guifont! UDEV Gothic 35JPDOC:h12
" simaltの最大化と元のサイズの戻すの代わり
nnoremap <Leader>ma :<C-u>call GuiWindowMaximized(1)<CR>
nnoremap <Leader>mi :<C-u>call GuiWindowMaximized(0)<CR>
scoopでマニフェストファイルのcheckverを確認する方法
& (Join-Path $(Resolve-Path(scoop prefix scoop)).Path "bin" "checkver.ps1") -App アプリ名 -Dir マニフェストファイルのパス
-Force
オプションをつけるとマニフェストファイルを更新できる
& (Join-Path $(Resolve-Path(scoop prefix scoop)).Path "bin" "checkver.ps1") -App アプリ名 -Dir マニフェストファイルのパス -Force
checkver.replace
について
scoopのマニフェストファイルのcheckver.regex
を指定するとcheckver.url
の結果に対して特定のパターンを検索できる。
checkver.jsonpath
の場合もcheckver.url
の結果に対して抽出できるが、checkver.regex
を追加すると抽出した値に対して検索および()
でキャプチャできるのでcheckver.replace
で${1}
のように参照できる。
参考
"checkver": {
"url": "https://api.github.com/repos/akiyosi/goneovim/releases/tags/nightly",
"jsonpath": "$.target_commitish",
"regex": "([0-9a-f]{7}).*",
"replace": "nightly-1-g${1}"
},
Windowsでカレントディレクトリをコマンドサーチパスから除外する
set NoDefaultCurrentDirectoryInExePath=1
この設定を有効にするとUnrealEngineでビルドに失敗する。
ビルドスクリプトがカレントフォルダのコマンドを実行するのが原因。
posh-gitが重い時にする事
ファイルステータスを無効化する
$GitPromptSettings.EnableFileStatus = $false
ファイルステータスを無効化するフォルダを指定する
$GitPromptSettings.RepositoriesInWhichToDisableFileStatus += 'C:\Path\To\Project'
Jebraints Toolboxで生成したスクリプトフォルダを環境変数PATHに追加する
Powershellから$profileを開き、以下を追加する
$toolboxBin = Get-ItemPropertyValue -Path "HKCU:\Software\JetBrains\Toolbox" -Name "(default)"
if (Test-Path -Path $toolboxBin -PathType Container)
{
$toolboxPath = Split-Path $toolboxBin
$toolboxSettings = Join-Path $toolboxPath .settings.json
if (Test-Path -Path $toolboxSettings -PathType Leaf)
{
$settingsJson = (Get-Content $toolboxSettings | ConvertFrom-Json)
$toolboxScriptsPath = $settingsJson.shell_scripts.location
$env:Path += ";${toolboxScriptsPath}"
}
}
Remove-Variable toolboxBin,toolboxPath,toolboxSettings,settingsJson,toolboxScriptsPath
WindowsでGoneovimのヘルプをFloating Windowに表示する
Goneovimが使っているQtの制限でコマンドラインから goneovim --help
を実行してもヘルプメッセージが出てこない。同じくQtを使っているnvim-qtではMesseageBoxでヘルプメッセージを表示している。しかしsystemlist
関数やコマンドラインモードで!goneovim --help
を実行するとヘルプメッセージが出力されるのを利用して、以下のvimscriptでフローティングウインドウに表示できる。
if (has('win32') || has('win64')) && exists('g:gonvim_running')
function! GonvimUsage() abort
let pid=nvim_get_proc(nvim_get_proc(nvim_get_proc(getpid()).ppid).ppid).pid
let output = systemlist("wmic process where processid=" . pid . " get executablepath")
let gonvimpath = trim(output[1])
let output = systemlist(gonvimpath . ' --help')
let width = 0
for line in output
let length = strlen(line)
if length > width
let width = length
endif
endfor
let height = len(output)
let opts = {
\ 'width': width + 1,
\ 'height': height,
\ 'anchor': 'NW',
\ 'style': 'minimal',
\ 'external': v:true
\ }
let buf = nvim_create_buf(v:false, v:true)
let win = nvim_open_win(buf, v:true, opts)
call nvim_buf_set_lines(buf, 0, -1, v:true, output)
endfunction
command! GonvimUsage call GonvimUsage()
endif
他にはmoreコマンド、PowerShellのOut-DefaultかOut-Hostに流してもヘルプメッセージが表示される。
goneovim --help | more
# or
goneovim --help | Out-Default
# or
goneovim --help | Out-Host
VSCode Neovimのエラー解消
VSCode Neovimプラグインを入れると起動時に以下のエラーが出ていた。
command line..script c:\\Users\\shiena\\.vscode\\extensions\\asvetliakov.vscode-neovim-0.4.0\runtime\lua\vscode\force_options.lua の処理中にエラーが検出されました:
E5113: Error while calling lua chunk: vim/_meta.lua:491: E474: Invalid argument
stack traceback:
[C]: in function 'nvim_set_option_value'
vim/_meta.lua:491: in function '_set'
vim/_meta.lua:533: in function '__newindex'
...vscode-neovim-0.4.0\runtime\lua\vscode\force_options.lua:39: in function 'forceoptions'
...vscode-neovim-0.4.0\runtime\lua\vscode\force_options.lua:53: in main chunk
force_options.luaの39行目でlistcharsにASCIIコード外の文字を設定していてinit.vimでset ambiwidth=double
を設定していたのがダメだった。そのためinit.vimで以下のように設定すると問題解消できた。
if !exists('g:vscode')
set ambiwidth=double
endif
macOSでzsh-git-promptの設定
if type brew > /dev/null; then
alias python="$(brew --prefix)/bin/python3"
if [ -f "$(brew --prefix)/opt/zsh-git-prompt/zshrc.sh" ]; then
source "$(brew --prefix)/opt/zsh-git-prompt/zshrc.sh"
fi
fi
git_prompt() {
if [ "$(git rev-parse --is-inside-work-tree 2> /dev/null)" = true ]; then
PROMPT='%B%m: %1~%b$(git_super_status) %# '
else
PROMPT='%B%n@%m %1~%b %# '
fi
}
precmd() {
git_prompt
}
macOS 12以降ではpythonコマンドが存在せず動作しないためaliasが必要になる
WezTermの設定
- AquaSKK/macSKK向けにターミナルでCtrl-Jで改行されないようにする
-
¥
と\
を入れ替える -
Ctrl-¥
とCtrl-\
を入れ替える
-- Pull in the wezterm API
local wezterm = require 'wezterm'
-- This will hold the ocnfiguration.
local config = wezterm.config_builder()
-- This is where you actually apply your config choices.
-- For example, changing the color scheme:
config.color_scheme = 'OneHalfDark'
if wezterm.target_triple == 'aarch64-apple-darwin' or wezterm.target_triple == 'x86_64-apple-darwin' then
config.font_size = 16
config.macos_forward_to_ime_modifier_mask = "SHIFT|CTRL"
config.keys = {
{
key = '¥',
mods = 'NONE',
action = wezterm.action.SendKey{ key = '\\', mods = 'NONE' },
},
{
key = '\\',
mods = 'NONE',
action = wezterm.action.SendKey{ key = '¥', mods = 'NONE' },
},
{
key = '¥',
mods = 'CTRL',
action = wezterm.action.SendKey{ key = '\\', mods = 'CTRL' },
},
{
key = '\\',
mods = 'CTRL',
action = wezterm.action.SendKey{ key = '¥', mods = 'CTRL' },
}
}
end
-- and finally, return the configuration to wezterm
return config