Textmate tutorial terminal mac-osx - macos

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)

Related

Need to update shell in PyCharm to zsh

Started taking the 'Programming for everyone' course on Coursera to learn python. Ive downloaded 2 text editors. Atom and Pycharm. When I open the terminal both say, "The default interactive shell is now zsh. To update your account to use zsh, please run chsh -s /bin/zsh."
Please understand I'm totally new. This is the first time I've ever used a text editor or terminal so don't know where to run this or how to straighten this out. Im using a 2015 MacBook Pro running 10.15.7Image is screenshot of editor and terminal in pycahrm im in.
Yeah, it sucks. I had the same problem with Pycharm, but this solution worked for me.
1- Change zsh to bash
$ /bin/bash
2 - Get the commands back like (cd, ls, clear ...)
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
3 - Get the profile back
. /etc/profile
After that your porfile will look like this "username:" instead of this "%n#%m %1~ %#"
One more thing, if you using mac, open your terminal and check preference. In the preferences go to General -> Shells open with -> if it is Default Login shell which means you are using zsh, you should change to Command (complete path): and add /bin/bash in the space below so that your default change to bash.
I hope it was useful for you, and for the people looking for answers. Cause, I wasted an hour looking for solution that JetBrain Pycharm and Apple couldn't provide.

Globally Map "Escape Key" to "jj" in vim (mac)

I have been using vim for awhile but I have not been able to figure out how to map the escape globally - every time I open a file, I have to map the escape key to jj like this:
:imap jj <Esc>
Is there a way to change the runtime defaults so that Esc is already mapped to jj?
I found the default.vim file, but you cannot edit it on a mac (with standard mac software). Should I download something to edit this file? Is there another easier way?
Any help is much appreciated!
The place for your local changes is called .vimrc and you typically create one in your home directory with the commands you want to execute on startup.
Run vimtutor on the (system) command line and spend a few minutes learning how to use this editor. Then dig into the facilities provided by :help in Vim. E.g. run :help vimrc in Vim.

how do you enable command line editing with vim keys using mac terminal?

I'm reading this book and I really do not understand what this author is talking about. It appears that you can program your mac to go forward one character by either hitting l or ^F. I do not understand the difference between emac key stroke and vim keystroke. He also says run this command and 'place it in your $HOME/.bash_profile but I cannot figure out how to place the command in the bas_profile.
The Author is talking about make you terminal console behaves like vi, this means typing set -o vi in your terminal, the console will work similar vi. So you will be able to navigate using the motion keys of vi, use INSERT mode, x to delete, etc.
You can set that permanently if you include this command in your ~/.bash_profile file.
If you are not sure what it does, I don't recommend so.

"subl" command not found

When I try to edit a file, like ~/.gemrc, in the terminal, I get this error:
$ subl ~/.gemrc
-bash: subl: command not found
Follow the instructions here.
If that doesn't work and you are using RVM, run: ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/.rvm/bin/subl
Note that in both of these commands, it's assumed that Sublime Text 2 is installed in your Applications directory. If its installed elsewhere change your command accordingly.
Then, enter export EDITOR='subl -w' to enable editing with the subl command.
Do you have "Sublime Text 2" installed? It's a text editor and is what the subl command would launch.
Since you don't have Sublime, you could use vim, which is installed on Mac OS, and is a very powerful text editor, but it does have a learning curve.
There's also nano, which will do for simple text editing purposes Try entering man nano at the command-line for more information. Try entering nano ~/.gemrc to create the file in question.
It sounds like you're not really familiar with your computer or its operating system. Trying to learn to program without understanding it is going to put you at a disadvantage, because languages like Ruby, Python and Perl tend to be used for a lot of OS-level code plus web and communications, which is a "heap of learning".
I'd recommend spending some time learning about the basic commands of your command-line, and get familiar with either vim or download Sublime and try it. (And, if you use Sublime or vim regularly, encourage the author by purchasing a copy -- they're very good editors and we want to keep those sort of tools around.)

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

Resources