how do I get -P full in SML "Run in command" in textmate - textmate

How do I include the mosml -P full into "Run in command" textmate for SML?
and is it possible to have a "live" terminal window within textmate to test bits of code sort of like in emacs?
thank you!

Textmate seems not to support REPL(read–eval–print loop). I use the SML/NJ in Sublime Text. It works fine and is easy to set up. You may want a try.

Related

Configure macOS to mimic Emacs C-u

I previously saw a one-line "defaults write..." macOS configuration for setting up a prefix key that can mimic Emacs' universal argument (C-u) so that we can enter "prefix key + 3 + a" and output "aaa". However, after hours searching..., I couldn't find it again... Any suggestions? thanks!
Update:
It appears that defaults write -g NSRepeatCountBinding -string "^u" can achieve what I was asking for. But it's not global and rather limited.
It appears that defaults write -g NSRepeatCountBinding -string "^u" can achieve what I was asking for. Not yet tested.
Tested on Note.app, TextEdit, and safari on macOS. It's working. However, it seems that it is not working on Sublime Text or Chrome. It's probably been overwritten by these apps. I guess it would be better to use a dedicated application to achieve this.

Textmate tutorial terminal mac-osx

I have installed Textmate editor on my terminal and I am looking for some tutorial to discover Textmate's command lines ? Does anyone has a some links ?
Best,
Newben
The textmate bin that is optionally installed for command line access is really nothing but a simple manner to open files in the OSX gui application.
That said, there are a few handy shortcuts. -w issues a "wait" while opening the file, thus following commands in a sequence will wait until the document is closed to execute. For example:
alias bashrc="mate -w ~/.bashrc; source ~/.bashrc"
That said, if you are looking for a good command set for using within the gui itself, let me know and I will fill in a list of handy commands (it has been my default editor for 6 years now).
Edit: Here are the beginnings of my TextMate docs. I currently have the Cheat Sheet in a state that should prove useful. I will be adding to it and writing up some more extensive docs in the near future.
TextMate Cheat Sheet
You can invoke it from the command line with:
mate path/to/file/you/want/to/edit.txt
You can use more than one file, space separated. To see more options do:
mate --help
This if you installed the commandline option. which you can also do from preferences at any time (its just a symlink)

Working on multiple terminals

I am using ubuntu terminal for my project and at times I need more than 5 terminals to be open at the same time and kind of juggle between them to see outputs of multiple programs running simultaneously. I am having hard time toggling between the terminals. Is there something that will hold all terminals together in one window and make my life simpler? I read somewhere that konsole does that for me, but I cannot bring up konsole for some reason and I am getting an error : bash: konsole: command not found.
Any kind of info/help is greatly appreciated.
Use tmux (and eventually, tmuxinator). It may have a slight learning curve but it'll be worth it, once you have it mastered!
Here's what an example session looks like.
If you want to try Konsole, try installing it first. It's part of KDE if that helps.
http://konsole.kde.org/
Ubuntu comes with gnome iirc. It has gnome-terminal as jasonspiro pointed out.
Have you tried using multiple workspaces? I'm using ubuntu 11 and if I find that I have a terminal layout I like to keep intact I simply place all of those terminals on a 2nd workspace. This can me done by right clicking on the terminal and clicking "Move to another workspace".
Use gnome-terminal instead. http://packages.ubuntu.com/ubuntu-desktop indicates to me that it comes with Ubuntu. It lets you open multiple tabs. Press Ctrl+Shift+T or click the appropriate menu command to open a new tab.
First, consider switching to ubuntu classic desktop. In clasic desktop you can move and resize windows like in um, windows, and then have multiple terminals visible at once.
Second, consider creating new terminals in the one terminal window. This can be done with CTRLSHIFTT
Third, alhough not much more useful for your purposes than the previous suggestion, have a look at screen(1), which is old, featureful, and no longer maintained, or tmux(1), which is still maintained. Either one can be run from a terminal. Both are installable from Software Center or synaptic.
You can use gnome-terminal. The script below will open 3 tabs running the respective commands..
tab="--tab"
cmd01="bash -c 'command in 1st terminal';bash"
cmd02="bash -c 'command in 2nd terminal';bash"
cmd03="bash -c 'command in 3rd terminal';bash"
foo=""
foo+=($tab -e "$cmd01")
foo+=($tab -e "$cmd02")
foo+=($tab -e "$cmd03")
gnome-terminal "${foo[#]}"
exit 0

Execute Code in VIM similar to Cmd+R in Textmate or Cmd+B Sublime Text2

Hey is there a way or plugin to execute Code e.g. Ruby in my case, directly from my vim editor. I know this from Textmate, where you can execute Code with Cmd+R or Cmd+B in Sublime Text2. In Sublime Text it is called Build System.
Thanks for advise!
If you just want to execute the current buffer in Ruby, you could do this in normal mode:
:!ruby %
You could also map that to a shortcut with your leader key:
:map <leader>r :!ruby %<cr>
Which would let you do leader+r to run the file.
My vim has a :rubydo command, select the section of code you want to execute (or nothing to execute the whole buffer), and do
:rubydo
"'<,'>" will be added automatically after ":" if something was selected.
that should to the trick
Well, one simple thing you can use is to execute a command in your shell with :!.
# Typing typing typing...
# Oh! Gotta commit.
:!hg ci -m "Add awesome module xyz"
Or you can use :shell to drop into the shell, if you're going to be doing more complex things.
Use the :!<anything want bash or the calling shell of vim to execute>. So if you have a script named foo.rb, to execute it from within the vim editor call :!ruby foo.rb.
ruby-runner is a vim plugin that allows you to run ruby script from within vim, the good part is you can see your code output along with the your code at the same time.
https://github.com/henrik/vim-ruby-runner
IMHO the better option is to use rcodetools.

How to write ruby code easier?(I mean in terminal write and then run it)

When I write a little ruby code, after a little bit, I always need to create a new terminal tab to ruby it, to see if it's correct.
Are there any ways to do it in one window? Like a vim plugin or some other tool?
The following should work in vim, after you've saved the file:
:!ruby %
Or even
:!%
This works under Linux when you have the correct "shebang" as the first line of the ruby file:
#!/usr/bin/env ruby
For extra fun, you can map this to a key in your ~/.vimrc:
map <F8> :!ruby %<CR>
Do you mean you need an interpreter to see what your code does? If so, check out irb.
The way you should check if your code works is using unit tests, not running it in the console or irb. Indeed, irb is a good solution for small fragment of code or to check for specific statements.
However, there are some solutions to your specific question.
You can write the code in a file, save it and run it from the console.
ruby filename.rb
If you use TextMate, you can press ⌘ + R to execute the current code
Do as Simone Carletti said.
And for editing and saving your file suggest you Scite.
http://www.scintilla.org/SciTEDownload.html here you can download it for many different operating systems.
You get syntax highlighting in a very lightweight editor for almost everything (html, ruby, eruby, xml,...).
But you will need to have at least a Window Manager running.
in ~/.vimrc
autocmd FileType ruby imap <F8> <C-o>:w <CR> <C-o> :!ruby % <CR>
this way you can save and execute your file at once within insertion mode
In vim:
:!ruby %
will execute ruby on the current file. Remember to save it first!
If you are the Emacs type you should check out ruby-mode (which IIRC was written by Matz) and inf-ruby. See e.g. http://lathi.net/pages/emacs-ruby
You don't say what OS you're using, so I'm assuming either Linux or Mac-OS.
When you're at a command-line and using vim (not gvim) you can do a <CNTRL>+Z to temporarily halt the editor and return to the command-line. Issue any commands you need, then use "fg" to return to the editor.
There are times I'll use :!ruby % from inside vim (or gvim) but sometimes I need the real command line and if I'm ssh'd into a machine the <CNTRL>+Z trick is nice.
Agreed with #Simone Carletti. If you are learning the language and want to make sure that methods/classes are doing what you want then you can use irb.
There is a gem called interactive_editor which enable you to run vim inside irb (side-by-side actually). Watch this Vimcast for demo.

Resources