Adds sudo writes to nvim
If in nvim and the SUDO_ASKPASS environment variable is set then a WW mapping will expand to :w !sudo -A tee % >/dev/null If in not-neo vim, the -A is omitted. The environment variable is also set. Some unused environment variables were also removed. https://stackoverflow.com/questions/2600783/how-does-the-vim-write-with-sudo-trick-work https://github.com/neovim/neovim/issues/12103
This commit is contained in:
parent
52eb406676
commit
c9d1320b54
2 changed files with 11 additions and 12 deletions
|
@ -81,3 +81,11 @@ nnoremap ]c :cnext<cr>
|
|||
|
||||
" Run proselint and put it in the quickfix list
|
||||
nnoremap <leader>p :call mine#functions#proselint()<CR>
|
||||
|
||||
if has('nvim')
|
||||
if !empty($SUDO_ASKPASS)
|
||||
cnoremap WW w !sudo -A tee % > /dev/null
|
||||
endif
|
||||
else
|
||||
cnoremap WW w !sudo tee % > /dev/null
|
||||
endif
|
||||
|
|
|
@ -52,16 +52,7 @@ export MSSQL_CLI_TELEMETRY_OPTOUT=1
|
|||
export DOTNET_CLI_TELEMETRY_OPTOUT=1
|
||||
export POWERSHELL_CLI_TELEMETRY_OPTOUT=1
|
||||
|
||||
#export GTK_THEME=Adapta-Nokto
|
||||
# Askpass
|
||||
# I will use this for sudo writes in nvim
|
||||
[ -f "/usr/lib/seahorse/ssh-askpass" ] && export SUDO_ASKPASS=/usr/lib/seahorse/ssh-askpass
|
||||
|
||||
if [ -n "$GTK_MODULES" ]
|
||||
then
|
||||
export GTK_MODULES="$GTK_MODULES:unity-gtk-module"
|
||||
else
|
||||
export GTK_MODULES="unity-gtk-module"
|
||||
fi
|
||||
|
||||
if [ -z "$UBUNTU_MENUPROXY" ]
|
||||
then
|
||||
export UBUNTU_MENUPROXY=1
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue