You are not logged in.
Trilby,
interrobang is great and clever, thx a lot.
Only one thing I miss: an interrobang commands history.
Is the an easy way to have one?
Offline
You mean just some sort of log file, or do you want to be able to recall items from the history?
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I've used bashrun2 since I discover interrobang.
So for history, yes I miss a kind of bash history for recall items or search history inside interrobang.
If I can suggest one more thing,
I think about a mechanism to present/call and select between a list of commands define in interrobagrc would be great too
I'm not a programmer only user, so please do not regard this as express requests, I love and appreciate to use interrobang whatever features you integrate ^^
EDIT: fix typo
Last edited by mentat (2013-05-14 12:55:08)
Offline
History is a good idea, I'll tinker with an option for that - but I've never used bash2run, so if there are specific features you'd like you'll have to elaborate.
I think about a mechanism to present/call and select between a list of commands define in interrobagrc would be great too
This is already built in with the custom tab completion mechanism. For example, if you list your preferred programs (one per line) in a file called ~/.myprograms, then in your ~/.interrobangrc you can add a tab-completion with something like the following:
TAB() pre="%s"; grep "%s" ~/.myprograms | while read match; do echo "${pre}${match}; done
You could also use the following if you only wanted to use this mechanism when you select a 'fav' bang:
!fav %s
TAB(fav) pre="%s"; grep "%s" ~/.myprograms | while read match; do echo "${pre}${match}"; done
EDIT: I've just pushed this "fav" bang with tab completion to the default rc on github.
EDIT2: as an aside, this has been one of the things about interrobang that has even really amazed me: a design choice made out of laziness, has opened up the possibility of all sorts of creative uses with just tiny bits of shell code in the rc file.
Last edited by Trilby (2013-05-14 13:22:45)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
History is a good idea, I'll tinker with an option for that - but I've never used bash2run, so if there are specific features you'd like you'll have to elaborate.
bash2run is a terminal is a bash session application launcher based on bash feature for completion and history.
History work :
- with all bash variables: HISTFILE, HISTFILESIZE, HISTIGNORE, HISTSIZE ...
- with bash shortcuts: arrows up and down to recall prev / next command and with ctrl+r for reverse search of history.
So for example.
I launch interrobang and enter my bang command:
!term htop
Next interrrobang call I push arrow up to recall it or use reverse search ctrl+r:
(reverse-i-search)`ht':!term htop
mentat wrote:I think about a mechanism to present/call and select between a list of commands define in interrobagrc would be great too
This is already built in with the custom tab completion mechanism....
Yes it's work like charm for a `fav` bang command.
But sorry I wasn't clear.
The mechanism was _about all bang commands_ inside your rc file.
For example.
I launch interrobang, enter the bangchar:
- hit `TAB` to present the first bang command, hit multiple times to naviguate between all commands define in my rc order (from the beginning to the end).
- write the begining of a command, hit `TAB` to complete the command, hit multiple times to naviguate if multiple commands have the same begining.
EDIT: I've just pushed this "fav" bang with tab completion to the default rc on github.
Cool, just integrate `!fav` in my rc file
EDIT2: as an aside, this has been one of the things about interrobang that has even really amazed me: a design choice made out of laziness, has opened up the possibility of all sorts of creative uses with just tiny bits of shell code in the rc file.
Cleverness inside ^^
Offline
Oh, I see, so you want bang-completion? I've looked at how this might be able to be added, and it would take a good amount of additional code. Bangs are your own creation and are likely quite short, so I don't see much justification in adding all the needed code for that.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Yes for bang-completion, if it's sound an heavy amount of code, it doesn't matter.
Just write this bang command to make part of the job:
!b %s
TAB(b) pre="%s"; cat ~/.interrobangrc | egrep -o "^\![[:alnum:]]+" | while read match; do echo "${pre}${match}"; done
But history mechanism can be great addon.
Offline
Great idea. I just pushed a revision of that bang that saves a cat, and a loop.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Ouch'
you're right about rewrite
TAB(?) ignore="%s%s"; grep -o -E "^\![[:alnum:]]+" ~/.interrobangrc
100x "don't have to grep a file via cat with a pipe !"
Offline
Hi,
Thanks for this great launcher, it is working very well.
Just a remark, completion is not working using hushbang. I don't know if it is wanted or a small bug.
I just write a "patch" (well, 2 lines...) for that. There is no side effect I think.
@@ -282,6 +282,8 @@ static int main_loop() {
if (strncmp(bangs[i].bang,line+1,strlen(bangs[i].bang))==0)
comp = bangs[i].comp;
}
+ if (hushbang > -1)
+ comp = bangs[hushbang].comp;
if (!comp) comp = defaultcomp;
sprintf(cmd,comp,prefix,sp);
Many thanks anyway
PS : first time I try to submit a patch, hope I was right
Offline
Thanks alban, you're exactly right on what the problem was, and that is a great fix.
I revised it only slightly before pushing to git to put the hushbang check before the strncmp check. This way if there is a hushbang the string comparision and loop never have to happen, but if there isn't a hushbang, the only processing cost is a numeric comparison.
For practical purposes it makes no difference whatsoever - but I have a bit of OCD about wasted processor cycles.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I'm not sure if I missed something, but can't see any commands/autosuggestions in interrobang bar. Tab completion doesn't work either.
Offline
Are you using the default rc (did you move it to ~/.interrobangrc)? Is bash your default shell? Do the commands you type in run properly?
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Heh, I had no ~/.interrobangrc. Thanks.
But still, interrobang doesn't display list of commands like dmenu does. Is it even meant to?
Anyway I quite like it.
Last edited by silenc3r (2013-05-18 16:52:36)
Offline
Yeah its not meant to:
This tool does not display options like dmenu, rather you can type whatever letters you want, then hit tab for shell-style tab completion. If there is more than one possible completion for what you've put you can hit tab repeatedly to cycle through the options.
Offline
A few months there was talk about '^u' keybinding to clear the line, I think another good feature would be to provide way to clear only the completion - for example, when I write 'ls ~/foo/', pressing tab completes through ~/foo/{bar,baz} and pressing for example '^c' would delete only {bar,baz}. Basically restoring the line to the state before tab was pressed for the first time.
Offline
That is a good idea. It's done and on git. Let me know if it leads to any unintended issues.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I just added a small feature called "autocomplete" which will essentially simulate a tab-key upon starting up, so a completion list is populated and the first option is filled in. This would likely be a horrible thing to use except when paired with a hushbang. I added this option along with the ability to use up/down arrows to select completion options, so I could replace my dmenu logout tool.
These options allow for a more 'dmenu-like' menu creating option. To see a simple example, this is the logout script I have bound to my laptop's power key:
#!/bin/bash
case $(interrobang logout - <<'EOF'
font -*-terminus-medium-r-normal--12-120-72-72-c-*-*-*
autocomplete
!logout echo %s
TAB() echo -e "cancel\nshutdown\nreboot\nlogout"
EOF
) in
shutdown) sudo shutdown -h now ;;
reboot) sudo reboot ;;
logout) killall xinit ;;
cancel) exit ;;
esac
When I hit the power button, the menu comes up with "shutdown" already there as a default. Hitting up/down arrows (or tab/shift-tab) cycles through the options. Hitting Enter selects the option.
Last edited by Trilby (2013-06-04 16:39:09)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I use interrobang and I love it -- thank you very much for this handy program!
A suggestion: It would be nice if the prompt emulated the text editing behaviour of emacs/vim, just like bash or zsh do. For example moving the cursor to the beginning of the prompt on pressing Ctrl-a or ^.
I guess this is what GNU readline is for, but I don't know if it is considered bloat or contradicts your program's philosophy...
Offline
I use interrobang and I love it -- thank you very much for this handy program!
A suggestion: It would be nice if the prompt emulated the text editing behaviour of emacs/vim, just like bash or zsh do. For example moving the cursor to the beginning of the prompt on pressing Ctrl-a or ^.
I guess this is what GNU readline is for, but I don't know if it is considered bloat or contradicts your program's philosophy...
It would be only like bash, because zsh doesn't use readline... But I agree that it would open many new possibilities, as you can even enable vim-like editing mode
Offline
Adding particular key bindings is easy enough, that's how Ctrl-u and Ctrl-c were added. But if you want to be able to move within the text and insert, that would take a *lot* more code.
I'll have to consider readline, as it would provide all such options, but I'm not sure it could be practical to have it interact well with the completion mechanisms - more importantly, readline may only work in a terminal. I will *not* make interrobang into a full terminal for readline.
Actually, after a very quick review - this last point seems to be the deal breaker. If anyone knows otherwise, feel free to point me to documentation of how readline can be used without a terminal.
Last edited by Trilby (2013-06-10 11:26:48)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I just came across a rather odd problem (and I'm unsure if this is related):
Whenever I want to launch slrn in a terminal window from interrobang, the terminal window immediately disappears, it's only visible for less than a second, like flickering. It seems to make no difference whether I try it with "!slrn" or "urxvt -e slrn". However, the command "urxvt -e slrn" works fine when I try it from an urxvt window. Until now slrn is the only program which behaves like this...
Last edited by ball (2013-06-15 15:49:46)
Offline
I'm trying to replicate this to troubleshoot - but I've never used slrn before and I can't even get it to start in a normal terminal.
EDIT: solved: slrn *requires* an enviornment varibale to be set to specify the news server, otherwise it not only fails to start, it fails in a very ugly way. If this is actively developed, I'd report this failure as a bug. To see this, just UNSET your server environment variable and try to run slrn. In a normal terminal it will just fail to start - fair enough. But if you do "urxvt -e slrn" without that environment variable set it fails in the ugly way: it crashes the terminal, but the window remains present (but invisible) - this may only be notable in a tiling wm.
Point is, though, this is the same problem that came up earlier: using environment variables in this way is just wrong. A work around would be to make sure the environment variable is exported *before* starting X, as interrobang inherits the environment from X, not from any terminal you may have open (you don't need a terminal open to run interrobang).
To confirm this is the issue, run interrobang from a terminal where slrn works: then you should be able to run slrn from interrobang, because the environment is inherited from the original terminal.
The longterm workaround specifics will depend on how you start X. If you use an xinitrc, then export the NNTPSERVER variable there before launching your window manager, then it works fine.
Last edited by Trilby (2013-06-15 16:30:03)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Trilby, just wow! (I am kind of speechless -- how did you come up with the server variable being the culprit? I knew that it required the variable but I was not able to make the connection that the variable is not set when starting interrobang not from my terminal.)
Last edited by ball (2013-06-15 18:07:09)
Offline
I've seen it before is all. Environment variables are often misused. They can be set in one process, but that setting will only then apply to that process and any child processes.
For clarification of my above post, interrobang (like any other program) inherits the environment variables of it's parent process. If it is launched from a terminal emulator then it will have any environment variable that was defined in the shell session. But most often interrobang would be launched from a window manager key binding. Used this way, it inherits only the environment of it's parent process: the window manager. The WM, in turn, inherits from xinit or whatever process starts X.
Last edited by Trilby (2013-06-15 18:32:10)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline