Skip to content

Instantly share code, notes, and snippets.

@pinzolo
Last active May 28, 2020 01:41
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pinzolo/8168337 to your computer and use it in GitHub Desktop.
Save pinzolo/8168337 to your computer and use it in GitHub Desktop.
現在開いているファイルのパスなどをレジスタやクリップボードへ登録する
" 指定のデータをレジスタに登録する
function! s:Clip(data)
let @*=a:data
echo "clipped: " . a:data
endfunction
" 現在開いているファイルのパスをレジスタへ
command! -nargs=0 ClipPath call s:Clip(expand('%:p'))
" 現在開いているファイルのファイル名をレジスタへ
command! -nargs=0 ClipFile call s:Clip(expand('%:t'))
" 現在開いているファイルのディレクトリパスをレジスタへ
command! -nargs=0 ClipDir call s:Clip(expand('%:p:h'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment