Tuesday, December 3, 2019

Vim commands

Python class commands (with vim-pythontextobj):
  • >ic to outdent a class
  • <ic to indent a class
  • cic to change a class
  • dic to delete a class
  • vic to visually select a class
  • yic to yank a class
Paragraph commands:
  • >ip to indent the current paragraph
  • <ip to outdent the current paragraph
  • dip to delete the current paragraph
  • yip to yank the current paragraph
Paragraph commands:
  • 6J to join six lines
Paragraph commands (visual mode):
  • vapJ to join all lines in a paragraph (version of {visual}J)
Line commands:
  • Y to yank the current line
  • yj to yank two lines (starting with the current line)
  • 3yy to yank three lines (starting with the current line)
  • 4yy to yank four lines (starting with the current line)
Matchfix commands:
  • % to jump between delimiters
  • %x``x to delete matching delimiters
Word commands:
  • guw to lowercase the current word
  • gUw to uppercase the current word
Character commands (current character):
  • r to replace the current character
  • x to delete the current character
  • yl to yank the current character
  • ylp to duplicate the current character
Character commands:
  • p to paste one character
Delete commands:
  • "_d to delete into Vim's "_ black hole register.
  • "_dG to black-hole-delete to end of file.
  • dt" to delete until (but not including) quotes:
    • abjad.label(leaves).color_leaves(color="red")
    • dt"
    • abjad.label(leaves).color_leaves("red")       

Friday, November 29, 2019

Compiling Vim 8.1 with +python3

Clone the Vim repository on GitHub:

$ git clone https://github.com/vim/vim.git

Change to the source directory, configure and make:

$ cd vim/src
$ ./configure \
   --enable-python3interp \
   --with-features=huge \
   --prefix=$HOME/opt/vim
$ make; make install

Check that +python3 is set:

$ ./vim --version

Link:

$ mkdir -p $HOME/bin
$ cd $HOME/bin
$ ln -s $HOME/opt/vim/bin/vim

Saturday, June 28, 2014

Installing and using pdfdiff.py

The pdfdiff.py script is hosted at Oxford:

http://www.cs.ox.ac.uk/people/cas.cremers/misc/pdfdiff.html

The page there gives install instructions.

You'll need the xpdf tools. Prebuilt binaries are available for the three major operating systems:

http://www.foolabs.com/xpdf/download.html

Download xpdfbin-mac-3.04.tar.gz and double click the to untar.

Inside the resulting xpdfbin-mac-3.04 folder there will be no package installer. Instead there are just two different folders that house a collection of binaries: bin32 and bin64. Modern MacBooks are probably 64-bit. The INSTALL file explains how to copy the binary files, man files and example file.

Building Poppler under OS X

Went to the Popper project page:

http://poppler.freedesktop.org/

First erroneously cloned the Git repository; don't do this.

Then clicked to download the archive: poppler-0.26.2.tar.xz.

This was a pain. You can't handle tar.xz archives using any native commands under OS X.

Had to insall the small xz application:


The link downloads XZ.pkg and installs just by ctrl-clicking the icon and choosing "open" from the context menu.

You can check that the xz command is available with which xz.

Then you're in a position to open the Poppler archive:

   xz -d poppler-0.26.2.tar.xz

The file poppler-0.26.2.tar will result.

You can then double click on poppler-0.26.2.tar or untar from the command line.

The folder poppler-0.26.2 results.

This folder contains a configure file. Which is great because my clone of the Git repository did not contain a configure file.

Change into the poppler-0.26.2 folder.

Then ./configure and in the usual way.

But this fails in a check for FONTCONFIG:

checking for FONTCONFIG... no
configure: error: in `/Users/trevorbaca/Desktop/poppler-0.26.2':
configure: error: The pkg-config script could not be found or is too old.  Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.

Alternatively, you may set the environment variables FONTCONFIG_CFLAGS
and FONTCONFIG_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

To get pkg-config, see .
See `config.log' for more details

Which is annoying.

So Poppler hasn't built successfully yet. Documentation left here for later.
















Building wxWidgets from source

Installing wxWidgets under OS X involves building from source.

The wxWidgets folks host a wiki with the following call to configure:

../configure --with-osx_cocoa --with-macosx-version-min=10.7 --with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk --prefix="$(pwd)"


I had to change both 10.7 references to 10.8 because I'm running Mountain Lion (10.8). So this worked correctly:

../configure --with-osx_cocoa --with-macosx-version-min=10.7 --with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk --prefix="$(pwd)"


The rest of install was completed with make.

The command was taken from here:

http://wiki.wxwidgets.org/Compiling_wxWidgets_using_the_command-line_(Terminal)

Installing autoconf, automake and aclocal under Mountain Lion

Mountain Lion's XCode doesn't include autotools.

Jean-Sebastian Delfino hosts a script that works perfectly under Mountain Lion 10.8.5:

http://jsdelfino.blogspot.com/2012/08/autoconf-and-automake-on-mac-os-x.html

After executing the script you have to make sure that ~/devtools/autotools-bin/bin (or equivalent) appears in your path.

Friday, May 9, 2014

Removing untracked files in a Git working copy

Use ...

git clean -f -n

... to see which files Git would remove if you actually ran the command.

Then use ...

git clean -f

... to permanently remove the files.