Created
January 28, 2019 04:10
-
-
Save llinfeng/18844f4033350cc777bee3dfbe926265 to your computer and use it in GitHub Desktop.
For Xming-illustrated-Gvim-from-WSL on Windows 10, pressing `<c-c>` writes to registry `+` and `<c-v>` shall past from registry `+`. This is different from Win-Gvim's behavior, where `*`-registry is used.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Snippet from my ~/.vimrc, where I use `Y` for fetching the absolute path, and use `<leader><leader>n` to fetch the name of the file. | |
" Other mappings were done a while ago. Kept for potential audience as they do demonstrate a wide variety of flags applicable for the expand() function. | |
if has('win32') | |
"Copy the full file path to windows clipboard. | |
nnoremap Y :let @* = expand("%:p")<CR> | |
"Copy the file name to windows clipboard. | |
nnoremap yyy :let @* = expand("%:p:t")<CR> | |
"Now using leaders: | |
" Full path | |
nnoremap <leader><leader>f :let @* = expand("%:p")<CR> | |
" Parent directory, full. | |
nnoremap <leader><leader>p :let @* = expand("%:p:h")<CR> | |
" File Name only, without extension | |
nnoremap <leader><leader>n :let @* = expand("%:t:r")<CR> | |
" Extension. | |
nnoremap <leader><leader>e :let @* = expand("%:t:e")<CR> | |
" Copy the line number with file name | |
nnoremap <leader><leader>l :let @* = expand("%:p").":".line(".")<CR> | |
else | |
"Copy the full file path to windows clipboard. | |
nnoremap Y :let @+ = expand("%:p")<CR> | |
"Copy the file name to windows clipboard. | |
nnoremap yyy :let @+ = expand("%:p:t")<CR> | |
"Now using leaders: | |
" Full path | |
nnoremap <leader><leader>f :let @+ = expand("%:p")<CR> | |
" Parent directory, full. | |
nnoremap <leader><leader>p :let @+ = expand("%:p:h")<CR> | |
" File Name only, without extension | |
nnoremap <leader><leader>n :let @+ = expand("%:t:r")<CR> | |
" Extension. | |
nnoremap <leader><leader>e :let @+ = expand("%:t:e")<CR> | |
" Copy the line number with file name | |
nnoremap <leader><leader>l :let @+ = expand("%:p").":".line(".")<CR> | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment