Xu Xiaodong avatar Xu Xiaodong committed cdf7015

add vimpager

Comments (0)

Files changed (4)

+#!/bin/sh
+#
+# author:    Xu Xiaodong <xxdlhy@gmail.com>
+# created:   2009 Dec 21
+# modified:  2011 May 02
+#
+
+shntool split -f *.cue -t '%p - %t' -o flac *.ape
+#!/bin/sh
+#
+# author:    Xu Xiaodong <xxdlhy@gmail.com>
+# modified:  2011 May 10
+#
+
+cat .ssh/id_rsa.pub | ssh root@00.000.00.000 'cat - >> ~/.ssh/authorized_keys'
+#!/usr/bin/env perl
+#
+# author:    Xu Xiaodong <xxdlhy@gmail.com>
+# modified:  2011 May 10
+#
+
+use strict;
+use warnings;
+
+my $pid = `pgrep -x ssh`;
+
+if ( $pid eq '' ) {
+  exec 'ssh -qTfnN -D 9988 user@000.008.000.0';
+}
+#!/bin/sh
+
+# Script for using ViM as a PAGER.
+# Based on Bram's less.sh.
+# Perlified by Magnus Woldrich.
+
+# Removed unwanted 'features' in the original vimpager, including:
+# · python support
+# · system type checks
+# · GPM
+# If perldoc is called, we use the specialized perldoc.vim syntax file,
+# included in this distribution.
+
+file="$@"
+if [ -z "$file" ]; then file="-"; fi
+
+linux=1
+
+less_vim() {
+  /usr/bin/vim -R -X --noplugins \
+    -c 'let no_plugin_maps=1'      \
+    -c 'set scrolloff=999'         \
+    -c 'set foldlevel=999'         \
+    -c 'runtime! macros/less.vim'  \
+    -c 'set cc=0 tw=78 cursorline nonu norelativenumber nolist cmdheight=1' \
+    "$@"
+}
+
+do_ps() {
+  /bin/ps fuxw
+}
+
+pproc() {
+  /bin/ps -p $1 -o comm=
+}
+
+ppid() {
+  /bin/ps -p $1 -o ppid=
+}
+
+# Check if called from man, perldoc or pydoc
+if do_ps | grep -q '\man\|godoc\|perl\(doc\)\?\([0-9.]*\)\?\\>'; then
+  proc=$$
+  while next_parent=`ppid $proc` && [ $next_parent != 1 ]; do
+    if pproc $next_parent | grep -q 'man\>'; then
+      cat $file | sed -e 's/\[[^m]*m//g' | sed -e 's/.//g' | less_vim -c 'set ft=man' -; exit
+    elif pproc $next_parent | grep -q 'perl\(doc\)\?\([0-9.]*\)\?\>'; then
+      cat $file | sed -e 's/.//g' | less_vim -c 'set ft=perldoc' -; exit
+    elif pproc $next_parent | grep -q 'godoc'; then
+      cat $file | sed -e 's/.//g' | less_vim -c 'set ft=go' -; exit
+    fi
+    proc=$next_parent
+  done
+else
+  echo "Could not spawn vimpager."
+fi
+
+less_vim "$file"
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.