vim: alias Sw to save by root
This commit is contained in:
parent
b5d7b831c9
commit
5627bbb420
1
Makefile
1
Makefile
@ -44,6 +44,7 @@ vim:
|
||||
ln -s $(PWD)/light/.vimrc ~/.vimrc
|
||||
mkdir -p ~/.config/nvim/lua
|
||||
ln -s ~/.vim/vimrc ~/.config/nvim/init.vim
|
||||
ln -s $(PWD)/functions/vim_askpass_helper ~/.local/bin
|
||||
ln -s $(PWD)/sub/vim/init.lua ~/.config/nvim/lua/init.lua
|
||||
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
|
||||
nvim +PluginInstall +qall
|
||||
|
||||
2
functions/vim_askpass_helper
Executable file
2
functions/vim_askpass_helper
Executable file
@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
echo -e "OPTION title=vim\nOPTION default-prompt=[sudo] password for $USER:\nGETPIN" | pinentry-qt --display :0 2>/dev/null | grep ^D | cut -d" " -f2
|
||||
@ -282,3 +282,8 @@ nnoremap <silent> <Leader>qa :qa!<CR>
|
||||
|
||||
" expand %% to dirname of cur file in commandline
|
||||
cnoremap <expr> %% getcmdtype() == ':' ? expand('%:h').'/' : '%%'
|
||||
|
||||
|
||||
|
||||
# :Sw to save file by root
|
||||
command Sw execute 'silent! write !SUDO_ASKPASS=$(which vim_askpass_helper) sudo -A tee % >/dev/null'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user