opout script added for opening .pdfs from vim
This commit is contained in:
parent
7805bedbce
commit
e4a64f6527
3 changed files with 18 additions and 1 deletions
|
@ -93,6 +93,11 @@ be paused and the screen will be distorted and locked and screen will soon time
|
||||||
## `musstuff`
|
## `musstuff`
|
||||||
Some old notes and commands on deleted music shortcuts.
|
Some old notes and commands on deleted music shortcuts.
|
||||||
|
|
||||||
|
## `opout`
|
||||||
|
"Open output", opens the corresponding `.pdf` file if run on a `.md`, `.tex` or
|
||||||
|
`.rmd` file, or if given an `.html` file, will open it in the browser.
|
||||||
|
Bound to `<leader>p` in my vim config to reveal typical output.
|
||||||
|
|
||||||
## `pauseallmpv`
|
## `pauseallmpv`
|
||||||
Pauses all mpv instances by sending the `,` key to each. Used by several
|
Pauses all mpv instances by sending the `,` key to each. Used by several
|
||||||
scripts, but can be used alone as well.
|
scripts, but can be used alone as well.
|
||||||
|
|
12
.scripts/opout
Executable file
12
.scripts/opout
Executable file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# opout: "open output": A general handler for opening a file's intended output.
|
||||||
|
# I find this useful especially running from vim.
|
||||||
|
|
||||||
|
filename=$(readlink -f "$1")
|
||||||
|
ext="${filename##*.}"
|
||||||
|
filename="${filename%.*}"
|
||||||
|
|
||||||
|
case "$ext" in
|
||||||
|
tex|md|rmd) zathura $filename.pdf & ;;
|
||||||
|
html) $BROWSER --new-window $filename.html & ;;
|
||||||
|
esac
|
2
.vimrc
2
.vimrc
|
@ -46,7 +46,7 @@ let mapleader =" "
|
||||||
nnoremap S :%s//g<Left><Left>
|
nnoremap S :%s//g<Left><Left>
|
||||||
|
|
||||||
" Open corresponding.pdf
|
" Open corresponding.pdf
|
||||||
map <leader>p :!zathura <c-r>%<backspace><backspace><backspace>pdf &<CR><CR>
|
map <leader>p :!opout <c-r>%<CR><CR>
|
||||||
|
|
||||||
" Compile document
|
" Compile document
|
||||||
map <leader>c :!compiler <c-r>%<CR>
|
map <leader>c :!compiler <c-r>%<CR>
|
||||||
|
|
Loading…
Reference in a new issue