Editing How to copy path to current file/directory to system clipboard

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 9: Line 9:
 
<source lang="vim">
 
<source lang="vim">
 
" yank current directory path into the clipboard
 
" yank current directory path into the clipboard
nnoremap yd :!echo -n %d | xclip %i<cr>:echo expand('%"d') "is yanked to clipboard"<cr>
+
nnoremap yd :!echo -n %d | xclip %i<cr>
  
 
" yank current file path into the clipboard
 
" yank current file path into the clipboard
nnoremap yf :!echo -n %c:p | xclip %i<cr>:echo expand('%"c:p') "is yanked to clipboard"<cr>
+
nnoremap yf :!echo -n %c:p | xclip %i<cr>
  
 
" yank current filename without path into the clipboard
 
" yank current filename without path into the clipboard
nnoremap yn :!echo -n %c | xclip %i<cr>:echo expand('%"c') "is yanked to clipboard"<cr>
+
nnoremap yn :!echo -n %c | xclip %i<cr>
  
 
" yank root of current file's name into the clipboard
 
" yank root of current file's name into the clipboard
nnoremap yr :!echo -n %c:r | xclip %i<cr>:echo expand('%"c:r') "is yanked to clipboard"<cr>
+
nnoremap yr :!echo -n %c:r | xclip %i<cr>
 
</source>
 
</source>
  
Line 29: Line 29:
 
" yank current directory path into primary and selection clipboards
 
" yank current directory path into primary and selection clipboards
 
nnoremap yd :!echo -n %d | xsel --input --primary %i &&
 
nnoremap yd :!echo -n %d | xsel --input --primary %i &&
             \ echo -n %d | xsel --clipboard --input %i<cr>:echo expand('%"d') "is yanked to clipboard"<cr>
+
             \ echo -n %d | xsel --clipboard --input %i<cr>
  
 
" yank current file path into primary and selection clipboards
 
" yank current file path into primary and selection clipboards
 
nnoremap yf :!echo -n %c:p | xsel --input --primary %i &&
 
nnoremap yf :!echo -n %c:p | xsel --input --primary %i &&
             \ echo -n %c:p | xsel --clipboard --input %i<cr>:echo expand('%"c:p') "is yanked to clipboard"<cr>
+
             \ echo -n %c:p | xsel --clipboard --input %i<cr>
  
 
" yank current filename without path into primary and selection clipboards
 
" yank current filename without path into primary and selection clipboards
 
nnoremap yn :!echo -n %c | xsel --input --primary %i &&
 
nnoremap yn :!echo -n %c | xsel --input --primary %i &&
             \ echo -n %c | xsel --clipboard --input %i<cr>:echo expand('%"c') "is yanked to clipboard"<cr>
+
             \ echo -n %c | xsel --clipboard --input %i<cr>
  
 
" yank root of current file's name into primary and selection clipboards
 
" yank root of current file's name into primary and selection clipboards
 
nnoremap yr :!echo -n %c:r | xsel --input --primary %i &&
 
nnoremap yr :!echo -n %c:r | xsel --input --primary %i &&
             \ echo -n %c:r | xsel --clipboard --input %i<cr>:echo expand('%"c:r') "is yanked to clipboard"<cr>
+
             \ echo -n %c:r | xsel --clipboard --input %i<cr>
 
</source>
 
</source>
  
Line 51: Line 51:
 
<source lang="vim">
 
<source lang="vim">
 
" yank current directory path into the clipboard
 
" yank current directory path into the clipboard
nnoremap yd :!echo -n %d | pbcopy %i<cr>:echo expand('%"d') "is yanked to clipboard"<cr>
+
nnoremap yd :!echo -n %d | pbcopy %i<cr>
  
 
" yank current file path into the clipboard
 
" yank current file path into the clipboard
nnoremap yf :!echo -n %c:p | pbcopy %i<cr>:echo expand('%"c:p') "is yanked to clipboard"<cr>
+
nnoremap yf :!echo -n %c:p | pbcopy %i<cr>
  
 
" yank current filename without path into the clipboard
 
" yank current filename without path into the clipboard
nnoremap yn :!echo -n %c | pbcopy %i<cr>:echo expand('%"c') "is yanked to clipboard"<cr>
+
nnoremap yn :!echo -n %c | pbcopy %i<cr>
  
 
" yank root of current file's name into the clipboard
 
" yank root of current file's name into the clipboard
nnoremap yr :!echo -n %c:r | pbcopy %i<cr>:echo expand('%"c:r') "is yanked to clipboard"<cr>
+
nnoremap yr :!echo -n %c:r | pbcopy %i<cr>
 
</source>
 
</source>
  

Please note that all contributions to Vifm Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Vifm:Copyrights for details). Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)