Merge branch 'master' of gitee.com:klesh/dotfiles
This commit is contained in:
commit
dc7559891b
|
@ -71,19 +71,23 @@ if status is-interactive
|
|||
# === auto cd into last activated directory
|
||||
test "$PWD" = "$HOME" && cd $last_pwd
|
||||
|
||||
function loadenv
|
||||
while read -l line
|
||||
set -l line (string trim $line)
|
||||
if [ -z "$line" ]
|
||||
continue
|
||||
end
|
||||
if string match -q '#*' $line
|
||||
continue
|
||||
end
|
||||
set -l kv (string split -m 1 = -- $line)
|
||||
set -gx $kv
|
||||
end < $argv[1]
|
||||
end
|
||||
|
||||
function readenv --on-variable PWD
|
||||
if test -r .env
|
||||
while read -l line
|
||||
set -l line (string trim $line)
|
||||
if [ -z "$line" ]
|
||||
continue
|
||||
end
|
||||
if string match -q '#*' $line
|
||||
continue
|
||||
end
|
||||
set -l kv (string split -m 1 = -- $line)
|
||||
set -gx $kv
|
||||
end < .env
|
||||
loadenv .env
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -69,6 +69,17 @@ nnoremap <leader>l <C-w>l
|
|||
nnoremap <leader>oo <C-w>o
|
||||
nnoremap <leader>q <C-w>q
|
||||
|
||||
|
||||
function! GetXCopyCmd()
|
||||
let l:status = system("command -v termux-clipboard-set")
|
||||
if len(l:status) > 0
|
||||
return "termux-clipboard-set"
|
||||
endif
|
||||
return "xsel -b"
|
||||
endfunction
|
||||
|
||||
let g:xcopy = GetXCopyCmd()
|
||||
|
||||
function! XCopy()
|
||||
" Why is this not a built-in Vim script function?!
|
||||
let [line_start, column_start] = getpos("'<")[1:2]
|
||||
|
@ -79,7 +90,7 @@ function! XCopy()
|
|||
endif
|
||||
let lines[-1] = lines[-1][: column_end - (&selection == 'inclusive' ? 1 : 2)]
|
||||
let lines[0] = lines[0][column_start - 1:]
|
||||
call system('xsel -b', join(lines, "\n"))
|
||||
call system(g:xcopy, join(lines, "\n"))
|
||||
endfunction
|
||||
|
||||
function! YankFileLineNo()
|
||||
|
|
Loading…
Reference in New Issue
Block a user