My path is something like /home/me/projects/project_name/the_part/i_wanna/keep.yestheextensiontoo
I wrote this fuction:
function! CurrentPath()
let filepath = expand("%")
let spl = split(filepath, '/')
let short = spl[4:-1]
let newpath = join(short, '/')
return newpath
endfunction
I want to pass the resulting trimmed path the_part/i_wanna/keep.yestheextensiontoo
to a sudo command
I would like to have something like this working:
nnoremap <F4> :w !sudo bin/test CurrentPath()<CR>
Ideally similar to how rspec-vim works where you run the command in a console (that replaces your vim session) and then when you hit enter (after the command is executed) you go back to your vim session.