Skip to content

Instantly share code, notes, and snippets.

@takoeight0821
Last active May 29, 2025 02:03
Show Gist options
  • Select an option

  • Save takoeight0821/1f54a5c1d5c53ae07ed792be9eae1dc6 to your computer and use it in GitHub Desktop.

Select an option

Save takoeight0821/1f54a5c1d5c53ae07ed792be9eae1dc6 to your computer and use it in GitHub Desktop.
ripgrepの結果を下にVSCodeを開くコマンドと、shift shiftでターミナルにフォーカスするショートカット
function fzf-code() {
local file
local line
local query="${LBUFFER:-.}"
read -r file line <<<"$(rg --no-heading --line-number $query | fzf -0 -1 | awk -F: '{print $1, $2}')"
if [[ -n $file ]]
then
BUFFER="code --goto '$file:$line'"
zle accept-line
fi
zle -R -c
}
zle -N fzf-code
bindkey -M viins '^f' fzf-code
{
{
"key": "shift shift",
"command": "terminal.focus",
"when": "editorTextFocus"
},
{
"key": "shift shift",
"command": "workbench.action.focusActiveEditorGroup",
"when": "terminalFocus"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment