forked from Archives/vimux
Added VimuxRunCommandInDir + doc
This commit is contained in:
parent
be6b83cfa4
commit
01c0679223
@ -15,6 +15,7 @@ CONTENTS *vimux-contents*
|
||||
2.5 .............................. |VimuxInterruptRunner|
|
||||
2.6 .............................. |VimuxClearRunnerHistory|
|
||||
2.7 .............................. |VimuxZoomRunner|
|
||||
2.8 .............................. |VimuxRunCommandInDir|
|
||||
3. Misc ............................ |VimuxMisc|
|
||||
3.1 Example Keybinding............ |VimuxExampleKeybinding|
|
||||
3.2 Tslime Replacement............ |VimuxTslimeReplacement|
|
||||
@ -71,6 +72,7 @@ Furthermore there are several handy commands all starting with 'Vimux':
|
||||
- |VimuxPromptCommand|
|
||||
- |VimuxClearRunnerHistory|
|
||||
- |VimuxZoomRunner|
|
||||
- |VimuxRunCommandInDir|
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*VimuxRunCommand*
|
||||
@ -193,6 +195,23 @@ Zoom requires tmux version >= 1.8
|
||||
map <Leader>vz :VimuxZoomRunner<CR>
|
||||
<
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*VimuxRunCommandInDir*
|
||||
VimuxRunCommandInDir~
|
||||
|
||||
Runs the specified command inside the directory of
|
||||
the currently opened file. Takes two arguments. command and inFile
|
||||
|
||||
command: The command to run
|
||||
inFile: If 1 the filename will be appended to the command
|
||||
>
|
||||
|
||||
" Compile currently opened latex file to pdf
|
||||
autocmd Filetype tex nnoremap <buffer> <Leader>rr :update<Bar>:call VimuxRunCommandInDir('latexmk -pdf', 1)<CR>
|
||||
" Push the repository of the currently opened file
|
||||
nnoremap <leader>gp :call VimuxRunCommandInDir("git push", 0)<CR>
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
MISC (3) *VimuxMisc*
|
||||
|
||||
@ -325,7 +344,7 @@ The type of view object Vimux should use for the runner. For reference, a
|
||||
tmux session is a group of windows, and a window is a layout of panes.
|
||||
|
||||
let g:VimuxRunnerType = "window"
|
||||
|
||||
|
||||
Options:
|
||||
"pane": for panes
|
||||
"window": for windows
|
||||
|
@ -15,6 +15,14 @@ command -nargs=? VimuxPromptCommand :call VimuxPromptCommand(<args>)
|
||||
command VimuxClearRunnerHistory :call VimuxClearRunnerHistory()
|
||||
command VimuxTogglePane :call VimuxTogglePane()
|
||||
|
||||
function! VimuxRunCommandInDir(command, useFile)
|
||||
let l:file = ""
|
||||
if a:useFile ==# 1
|
||||
let l:file = shellescape(expand('%:t'), 1)
|
||||
endif
|
||||
call VimuxRunCommand("cd ".shellescape(expand('%:p:h'), 1)." && ".a:command." ".l:file)
|
||||
endfunction
|
||||
|
||||
function! VimuxRunLastCommand()
|
||||
if exists("g:VimuxRunnerIndex")
|
||||
call VimuxRunCommand(g:VimuxLastCommand)
|
||||
|
Loading…
Reference in New Issue
Block a user