| 1 |
] Closebracket ] |
|---|
| 2 |
|
|---|
| 3 |
A shell shortcut definer |
|---|
| 4 |
http://www.freaknet.org/alpt/src/utils/closebracket/ |
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
Closebracket lets you define multiple shell actions in a single command to |
|---|
| 8 |
speed up the typing of the most repetitive shell commands. |
|---|
| 9 |
The command name of Closebracket is `]' and `][', that's because these |
|---|
| 10 |
characters are near the "Enter" key and it is easy to type them fast. |
|---|
| 11 |
|
|---|
| 12 |
`]' stands for "primary fire", while `][' is the secondary one. |
|---|
| 13 |
|
|---|
| 14 |
After few days you'll find Closebracket very addictive. |
|---|
| 15 |
|
|---|
| 16 |
Closebracket is dedicated to the God of Laziness, may He bless you (when He |
|---|
| 17 |
feels to do it). |
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
*** Installation |
|---|
| 21 |
|
|---|
| 22 |
Download the latest tarball from |
|---|
| 23 |
http://www.freaknet.org/alpt/src/utils/closebracket/tarball/ |
|---|
| 24 |
|
|---|
| 25 |
Use the ./install.sh script to install it. It will copy the files in |
|---|
| 26 |
~/.closebracket and add some aliases in ~/.bashrc (or ~/.zshrc) |
|---|
| 27 |
|
|---|
| 28 |
*** Updating |
|---|
| 29 |
|
|---|
| 30 |
Just use ./install.sh (or install-rshells.sh). |
|---|
| 31 |
`closebracket.conf' will be overwritten but your `shells' file won't. |
|---|
| 32 |
|
|---|
| 33 |
*** Usage |
|---|
| 34 |
|
|---|
| 35 |
Since too many words are needed to describe all the actions that are included |
|---|
| 36 |
by default, I'll show you them by examples. |
|---|
| 37 |
Keep in mind that you can tune them and define your own actions by editing the |
|---|
| 38 |
~/.closebracket/closebracket.conf file. |
|---|
| 39 |
|
|---|
| 40 |
In the first line closebracket is used to activate an action. The second line |
|---|
| 41 |
is the equivalent of that action. |
|---|
| 42 |
|
|---|
| 43 |
--- |
|---|
| 44 |
|
|---|
| 45 |
] --help or ] -h |
|---|
| 46 |
][ --help or ][ -h |
|---|
| 47 |
|
|---|
| 48 |
## |
|---|
| 49 |
### Basic shell movements |
|---|
| 50 |
## |
|---|
| 51 |
|
|---|
| 52 |
$ ] |
|---|
| 53 |
$ ls # ls current directory |
|---|
| 54 |
|
|---|
| 55 |
$ ][ |
|---|
| 56 |
$ cd # cd to home |
|---|
| 57 |
|
|---|
| 58 |
$ ] dir/ |
|---|
| 59 |
$ cd dir/ |
|---|
| 60 |
|
|---|
| 61 |
$ ][ dir/ |
|---|
| 62 |
$ ls dir/ |
|---|
| 63 |
|
|---|
| 64 |
$ ][ file |
|---|
| 65 |
$ cat file |
|---|
| 66 |
|
|---|
| 67 |
$ ][ non_existent_file |
|---|
| 68 |
$ vim non_existent_file |
|---|
| 69 |
|
|---|
| 70 |
## |
|---|
| 71 |
### Remote shells |
|---|
| 72 |
## |
|---|
| 73 |
|
|---|
| 74 |
$ ] shell # With closebracket you keep the list of the |
|---|
| 75 |
$ ssh shell.expanded.org # name of your remote shells in |
|---|
| 76 |
# ~/.closebracket/shells. In this case we put |
|---|
| 77 |
# "shell.expanded.org" in the list. |
|---|
| 78 |
# Closebracket searches the closest match with |
|---|
| 79 |
# the word you typed and then use that as the |
|---|
| 80 |
# remote shell hostname. |
|---|
| 81 |
$ ] user@shell |
|---|
| 82 |
# ssh user@shell.expanded.org |
|---|
| 83 |
|
|---|
| 84 |
$ ] shell user |
|---|
| 85 |
$ ssh user@shell.expanded.org |
|---|
| 86 |
|
|---|
| 87 |
## |
|---|
| 88 |
### Remote copy (scp/rsync) |
|---|
| 89 |
## |
|---|
| 90 |
|
|---|
| 91 |
$ ] shell:file |
|---|
| 92 |
$ vim scp://shell.expanded.org/file # Beware of the Vim power |
|---|
| 93 |
|
|---|
| 94 |
$ ] user@shell:/path/file |
|---|
| 95 |
$ ] scp://user@shell.expanded.org/path/file |
|---|
| 96 |
|
|---|
| 97 |
$ ][ shell:dir/ |
|---|
| 98 |
$ scp -r shell.expanded.org:dir/ . |
|---|
| 99 |
|
|---|
| 100 |
$ ][ shell:dir/ local_dir/ |
|---|
| 101 |
$ scp -r shell.expanded.org:dir/ local_dir/ |
|---|
| 102 |
|
|---|
| 103 |
$ ][ file1 file3 dir1 dir3 shell:remote_dir/ |
|---|
| 104 |
$ scp -r file1 file3 dir1 dir3 shell.expanded.org:remote_dir/ |
|---|
| 105 |
|
|---|
| 106 |
|
|---|
| 107 |
## |
|---|
| 108 |
### URLs, mail addresses |
|---|
| 109 |
## |
|---|
| 110 |
|
|---|
| 111 |
$ ] http://URL |
|---|
| 112 |
$ firefox http://URL |
|---|
| 113 |
|
|---|
| 114 |
$ ][ http://URL |
|---|
| 115 |
$ wget http://URL |
|---|
| 116 |
|
|---|
| 117 |
$ ] email@address.org |
|---|
| 118 |
$ mutt email@address.org |
|---|
| 119 |
|
|---|
| 120 |
|
|---|
| 121 |
## |
|---|
| 122 |
### File type based on extension |
|---|
| 123 |
## |
|---|
| 124 |
|
|---|
| 125 |
It is possible to associate multiple extensions to a program or a |
|---|
| 126 |
function. Ex: associate ".jpg .bmp" to gqview and to the gimp, using |
|---|
| 127 |
respectively the former as primary action and the latter as secondary. |
|---|
| 128 |
|
|---|
| 129 |
The extensions list is kept in ~/.closebracket/file_extensions |
|---|
| 130 |
|
|---|
| 131 |
|
|---|
| 132 |
$ ] pack.tar.gz # This works for .tar, .tar.bz2, |
|---|
| 133 |
$ tar xfz pack.tar.gz; cd pack/ # .tar.gz, .tgz, .zip, .rar |
|---|
| 134 |
# If the directory unpacked isn't the |
|---|
| 135 |
# same of the filename of the tarball |
|---|
| 136 |
# it understands that ^_- |
|---|
| 137 |
|
|---|
| 138 |
$ ] file.pdf |
|---|
| 139 |
$ xpdf file.pdf # If you are in tty, it converts the pdf file |
|---|
| 140 |
# to html and opens it with links |
|---|
| 141 |
|
|---|
| 142 |
$ ] movie_or_mp3.ogg # .avi, .mp3, .wav, .wmv, ... |
|---|
| 143 |
$ mplayer movie_or_mp3.ogg |
|---|
| 144 |
|
|---|
| 145 |
$ ] image.jpg # .jpg, .png, .gif, ... |
|---|
| 146 |
$ gqview image.jpg # if you are in tty it launches `seejpeg' |
|---|
| 147 |
|
|---|
| 148 |
$ ][ image.jpg |
|---|
| 149 |
$ gimp image.jpg |
|---|
| 150 |
|
|---|
| 151 |
$ ] file.htm # .htm, .html, .php, ... |
|---|
| 152 |
$ firefox file.htm # if you are in tty it launches `links' instead |
|---|
| 153 |
|
|---|
| 154 |
$ ] file.torrent |
|---|
| 155 |
$ bittorrent file.torrent # if you are in tty, it launches |
|---|
| 156 |
# bittorrent-curses |
|---|
| 157 |
|
|---|
| 158 |
$ ] file.abw |
|---|
| 159 |
$ abiword file.abw |
|---|
| 160 |
|
|---|
| 161 |
You can also pass options to it: |
|---|
| 162 |
|
|---|
| 163 |
$ ] video.avi -nosound |
|---|
| 164 |
$ mplayer video.avi -nosound |
|---|
| 165 |
|
|---|
| 166 |
|
|---|
| 167 |
Enjoy the speed ^_^' |
|---|
| 168 |
|
|---|
| 169 |
AlpT (@freaknet.org) |
|---|