dotwryn/vim/rc.d/39.utility-misc.vim

18 lines
367 B
VimL
Raw Permalink Normal View History

function Sudowrite()
execute 'w !sudo tee "%"'
endfunction
nnoremap <Leader><Leader>w :call Sudowrite()<CR>
2022-08-09 23:56:06 +00:00
function MakeFileExecutable(sudo = 0)
if a:sudo
execute '! sudo chmod +x "%"'
else
execute '! chmod +x "%"'
endif
2022-01-10 13:36:34 +00:00
endfunction
nnoremap <Leader><Leader>x :call MakeFileExecutable(0)<CR>
nnoremap <Leader><Leader>xx :call MakeFileExecutable(1)<CR>