" Source distribution script in $VIMRUNTIME directory
:runtime mswin.vim
if has('clipboard')
nmap <silent> <C-X> :call CutNonEmptyLineToClipboard()<CR>
" If the current line is non-empty cut it to the clipboard.
" Else do nothing.
function! CutNonEmptyLineToClipboard()
if strlen(getline('.')) != 0
normal 0"*D
endif
endfunction
endif
unten Aktualisierte Version. Musste googeln "black hole register", von dem ich nichts wusste. (Danke!) Ich habe auch einen anderen Leerzeilen-Matcher eingefügt. Wählen Sie die Version, die am besten zu Ihnen passt.
if has('clipboard')
nmap <silent> <C-X> :call CutNonEmptyLineToClipboard()<CR>
" If the current line is non-empty cut it out into the clipboard.
" Else delete it into the black hole register (named _).
function! CutNonEmptyLineToClipboard()
" Test if the current line is non-empty
" if strlen(getline('.')) != 0
if match(getline('.'), '^\s*$') == -1
normal 0"*D
else
normal "_dd
endif
endfunction
endif
Werfen Sie einen Blick auf die mswin.vim, mit der vim ausgeliefert wird. Möglicherweise möchten Sie nur diese Datei bereitstellen und noch mehr Windows-ähnliche Verhaltensweisen erhalten. –
Ja, ich weiß über die Datei. Es enthält diese Mapping 'vnoremap" + x ", die kümmert sich um Punkt Nr. 1 von dem, was ich fragte. –
mihai