4

For several applications I maintain my personal cheatsheets. I use them mostly for vim, latex, vim latex-suite and bash.

For example, when I forget a key combination in vim, I browse to the directory where I the keep the PDF of my cheatsheet, and then I open it with Acrobat Reader.

I have two monitors. I always work on the left, so I use the mouse to drag Acrobat Reader with the cheatsheet to the right screen. Then I close the file browser.

This I do many times a day. Opening an extra window (the file browser) and dragging the window around is distractive and time consuming.

How can I access my cheatsheets more efficiently? I suppose there are several ways, but I'm not that familiar with the features of GNOME 3. All suggestions are appreciated. Please also provide some clue of how to implement your solution.

3

If you just want to place your PDFs somewhere on the second screen at a fixed position, use a script that call wmctrl after starting Acrobat Reader. Assuming you can start the Acrobat Reader with the commandline command acroread:

#!/bin/bash
acroread vimcheat.pdf
wmctrl -r vimcheat.pdf -e 0,1920,100,500,1100

The wmctrl command works by finding the string vimcheat.pdf in the title of any of your windows (make sure your PDFs are uniquely named). On my 1920x1200 screens it pushes the window to the second screen and resizes it to 500x1100 100 pixels down from the top.

You make links to the script(s) on your desktop, or start these from the ommandline, according to your preference.

BTW contrary to what is stated in other replies, I think using PDF files, with is fine tuned formatting control, makes perfect sense.

2

I use them mostly for vim, latex, vim latex-suite and bash.

Don't use pdf's. Copy them to plain .txt files and place them in one directory, e.g. ~/cheatsheets.

Using plain text makes them easier to modify, expand, and manipulate. Create a new vim command in your .vimrc:

:command -nargs=1 Cheat :!cat ~/cheatsheets/<args>.txt

Now you can glance at your cheatsheet in vim with :Cheat vim (presuming ~/cheatsheets/vim.txt exists).

Create a short script and put it in ~/bin (or somewhere in $PATH):

#!/bin/sh

cat ~/cheatsheet/$1.txt | grep $2

Call that file "cheat". You can now look for something specific with cheat vim "whatever", which you can also do in vim with :!cheat vim "whatever".

Since you have the second monitor, you could make these more elaborate and pipe to a viewer there.

If you really want to keep the pdfs, you could modify the script a bit to open a file from the cheatsheet directory in evince or adobe on a specific desktop.

#!/bin/sh

evince ~/cheatsheet/$1.pdf --find=$2

Evince doesn't take geometry args, but you might be able to configure GNOME to make it use a specific desk.

  • 3
    I highly doubt that LaTeX cheat sheets would work in plain text: you often need to quickly look up a given symbol and its corresponding macro definition. – Joseph R. Nov 6 '13 at 12:40
  • 1
    I guess you could mix and match solutions and use pdfs as necessary (I've added a bit about the pdfs at bottom). – goldilocks Nov 6 '13 at 12:41
1

You can speed up opening your documents using aliases: Open "~/.bashrc" and add a line like alias vimcheat="evince path/to/vimcheat.pdf" or replace evince with the appropriate name for the acrobat reader. After opening a new terminal you can open your pdf with the command "vimcheat". But you still have to use your mouse for moving the window.

Another solution is to use the method of goldilocks and creating a bash script. This can be improved by adding a shortcut to your script so you can open your cheat sheet with a simple keystroke. I don't have the english version of gnome, but you should find the shortcut settings via something like "system settings -> keyboard -> shortcuts".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.