Skip to content

Instantly share code, notes, and snippets.

@killerswan
Created January 20, 2016 01:18
Show Gist options
  • Save killerswan/15a80feb6bd77ae5110b to your computer and use it in GitHub Desktop.
Save killerswan/15a80feb6bd77ae5110b to your computer and use it in GitHub Desktop.
vim CopyURL
C:\Users\kevin.cantu\vimfiles\bundle\copypath.vim>git diff
diff --git a/plugin/copypath.vim b/plugin/copypath.vim
index 07cbd1e..14ba8da 100644
--- a/plugin/copypath.vim
+++ b/plugin/copypath.vim
@@ -64,6 +64,16 @@ if !exists('g:copypath_copy_to_unnamed_register')
let g:copypath_copy_to_unnamed_register = 0
endif
+function CopyURL()
+ let @*=expand('%:p')
+ let @*=substitute(@*, "\\", "/", "g")
+ " copy unnamed register.
+ if g:copypath_copy_to_unnamed_register
+ let @"=expand('%:p')
+ let @"=substitute(@", "\\", "/", "g")
+ endif
+endfunction
+
function CopyPath()
let @*=expand('%:p')
" copy unnamed register.
@@ -81,6 +91,7 @@ function CopyFileName()
endfunction
command! -nargs=0 CopyPath call CopyPath()
+command! -nargs=0 CopyURL call CopyURL()
command! -nargs=0 CopyFileName call CopyFileName()
finish
C:\Users\kevin.cantu\vimfiles\bundle\copypath.vim>git ll -1
* commit b7c5e7f6287105856a6d67dd3a0061f1c6f020be (HEAD -> refs/heads/master, tag: refs/tags/1.0, refs/remotes/origin/master, refs/remotes/origin/HEAD)
| Author: omi taku <[email protected]>
| Date: Wed Dec 16 00:00:00 2009 +0000
|
| Version 1.0
|
| o change script package file format to zip format.
| o unnamed register copy option is added.
C:\Users\kevin.cantu\vimfiles\bundle\copypath.vim>git remote -v
origin https://github.com/killerswan/copypath.vim.git (fetch)
origin https://github.com/killerswan/copypath.vim.git (push)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment