Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Sometimes when I have text files open I want to be able to run command line tools against them. I know I can go write a shell script but sometimes I want to write grep against my inbox or against all the windows I have open at the time. I want to be able to high lite some text (possibly in more than one window) and then have a transparent shell appear that lets me write expressions to work with that text, like sort it in place. Often I have to move things into and out of text files, spreadsheets,databases to be able to apply all the tricks that I like. I wish those tricks could just appear and work with what I'm looking at.


Emacs (and Vim as well IIRC) can run shell commands against selections of text so just read the files in there.

http://www.masteringemacs.org/articles/2011/10/19/executing-...


I have used emacs before and I did like having multiple shells open and the ability to copy many text fragments into the buffer. I use windows for my day to day work so I'm thinking about something more geared to that.

I want to be able to take the the best features from the command line, and the gui programs and package them up into something that just floats at the OS level. So that I use a keyboard shortcut to pull up a buffer that can grab text (or entire files) work on them and push the results back to whatever app/file I pulled it from.


I think DTerm (http://decimus.net/DTerm) is a step in the direction that you're describing...


That looks really interesting. I'm going to install it when I get home. If I'm able to be looking at a text file, launch DTerm with a keyboard shortcut, run something that modifies the file in place, and then have DTerm fade away then that will definitely be useful.


> and Vim as well IIRC

Yup, via `!` and `r!`. See, for example, http://www.oualline.com/vim-cook.html#format_para.


You also execute a selection with ":w !sh". For example, if I have a line that says 'echo "Hello, world!"' I can select the line with Shift-V and then ":w !sh" to execute the line in the shell. Works with other interpreters too so ":w !perl" would execute it in perl. The vim command should show "'<,'>" between the ':' and 'w'. Using it without selecting something first sends the whole buffer to the interpreter.


> The vim command should show "'<,'>" between the ':' and 'w'.

I've always wondered about this; I sometimes get it (but don't know how to reproduce it) when trying to navigate. What does it mean?


It's a motion command that means from the beginning of the selected area to the end. It's really two different commands ("'<" and "'>") and there is a good description of them in the vim help (":help '<" will bring you there).





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: