You are not logged in.
Pages: 1
Not sure if this is the right section for this but it seems like a noob question so i'l post it here. I am using a dmenu script called snippy, works great for most things but i cant seem to figure out how to paste stuff from snippy into vim. The script looks like this:
DIR=${HOME}/.snippy
#DMENU_ARGS="-b"
DMENU_ARGS="-p kalixyz$ -fn 10x20"
XSEL_ARGS="--clipboard --input"
cd ${DIR}
# Use the filenames in the snippy directory as menu entries.
# Get the menu selection from the user.
FILE=`find . -type f | grep -v '^\.$' | sed 's!\.\/!!' | /usr/local/bin/dmenu ${DMENU_ARGS}`
if [ -f ${DIR}/${FILE} ]; then
# Put the contents of the selected file into the paste buffer.
xsel ${XSEL_ARGS} < ${DIR}/${FILE}
# Paste into the current application.
xdotool key ctrl+v #gui paste
# xdotool key ctrl+shift+v #cli
fiSo simply put is there a way i can make this work for both vim and gui paste? Because atm it just starts visual block in vim the way it is set up. Im not super good at scripting so some help would be much appreciated ![]()
I know about ultisnips but it dont really help me alot since i'm dealing with python flask atm, and these {{% %}} tags are about to drive me nuts
. If there is a better way dealing with this using ultisnips i would be very much interested in that aswell ![]()
Last edited by Kalixyz (2019-02-28 14:21:11)
Offline
Why use that at all. Just do ":r ~/.snippy/" in vim then use tab completion to find the snip file you want. If you use it regularly, you can map that sequence to a single key, e.g.
noremap # :r ~/.snippy/Then just hit # and start tabbing through the options.
The (main) problem in that script is that it's assuming Ctrl-V means something universal. It doesn't. You could also map Ctrl-V in vim to ":r !xsel -b" but then you'd lose vim's block selections.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Thanks alot! Worked like a charm! ![]()
Last edited by Kalixyz (2019-02-28 14:22:10)
Offline
Pages: 1