"subl" command not found - terminal

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.)

Related

-bash: emacs.profile: command not found

I am trying to resolve this issue and trying to get it work. What are all the steps of the solution? I really don't know what to do on my Mac terminal
-bash: emacs.profile: command not found
What are you trying to accomplish? If you're trying to open a file named .profile with emacs you'll want to add a space between the command emacs and the file .profile:
$ emacs .profile
If you are typing emacs.profile you will get an error because you are mixing together the command emacs and the file you are trying to edit: .profile. Therefore the solution would be to add a space between them like someone suggested: $ emacs .profile.
On the other hand, if you are typing emacs .profile and you are still getting: -bash: emacs: command not found, this means that you haven't installed emacs yet and your system doesn't recognize that instruction.
Emacs is a very popular text editor and is widely used by technical users, but it is not installed by default.
Solution 1:
If you want to edit a file (in this case ~/.profile) you don't need emacs to do so, you could just use a normal text editor or a pre-installed text editor using your terminal like:
$ vi ~/.profile or $ nano ~/.profile
(Guide to use Vi/Vim text editors) (Guide to use Nano).
Solution 2:
If you want to install emacs to edit that file, you can do so using brew:
$ brew update
$ brew install emacs
And after that you can use:
$ emacs ~/.profile
You can find other ways to install emacs here.
Important Note:
One important thing to consider in this example, is that if you are trying to edit the .profile file (i.e. to set an exported environment variable) you should know that the name of the .profile file might vary from one Mac system to another. The name of this profile configuration file depends on the shell of your system, if you are using bash the name of this profile will be .bashrc or .bash_profile.
Before editing your profile file make sure what is the name of the profile file you are trying to edit. To do so, you can use:
$ cd $HOME
to go to the Home folder and then use:
$ ls -al
to see hidden files (These files starting with . are hidden files). You will find the profile file of your system there.

sublime text VS os terminal

I am an absolute beginner using (actually trying to) Mac High Sierra with Sublime3 and Python2.7. Just installed them.
When I test Sublime on terminal, here's what I get:
pc37:desktop flop$ one
-bash: one: command not found
I setup Sublime to write in Python and saved the file "one.py" on my desktop.
Does it come from Sublime or the OS?
I read a few debugging articles on the subject but didn't understand half of it... Didn't want to make the situation worst using wrong command lines.
Could someone help please? Thank you! Flo
You need to use valid Bash command syntax for executing Python scripts in Terminal:
python one.py
...or...
./one.py
Of course this requires you cd to ~/Desktop first.

Vim copy to system clipboard using register not working (Mac computer)

I have been spending some time looking for the solution. I have reinstalled Vim on my mac for several times using MacPorts. The vim --version command show that +clipboard and +xterm_clipboard, so I should be good to go. However, when I type "+yy or "*yy inside vim, the :reg command show that the register changed to the current line, but when I do paste outside vim, the content still did not change. Everything in vim I can tolerate to trade off its super flexibility, however, this copy/paste which is frequently used but extremely difficult in vim really driving me crazy...
I've found that if I add set clipboard=unnamed to my .vimrc, then pasting outside of vim will paste the contents of the * register. For + you might try set clipboard=unnamedplus.
Problem solved. I am always using system vim, which is /opt/local/bin/vim. I think there was some glitch going on there. So I installed MacVim, and link vim to MacVim by adding the following code to my bash profile (~/.bash_profile)
alias vim='/Applications/MacVim.app/Contents/MacOS/Vim'
Registers work perfectly with MacVim. Even though vim --version reveals that it is +clipboard but -xterm_clipboard.
For me, it was a matter of updating the vim that ships with OS X (7.3) via homebrew to 7.4.

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)

How to set my GVim to be feel like IDE?

Currently, I'm using GEdit as my text editor for editing Ruby and Javascript source codes. I would like to give GVim a try to be my editor choice. I have tried to follow https://github.com/akitaonrails/vimfiles and few others instructions, but I don't get any luck, when I source ~/.vimrc, then I always get:
bash: /home/samnang/.vimrc: line 5: syntax error near unexpected token ('
bash: /home/samnang/.vimrc: line 5:call pathogen#runtime_append_all_bundles()'
Could you point me somewhere to get the instruction or configuration?
Environment: Ubuntu 10.10
Edit: If I don't source it, when I type vim or gvim, then I got:
Vim: Caught deadly signal SEGV
Vim: Finished.
Segmentation fault
You need to run source ~/.vimrc as an Ex mode command. That is, inside Vim itself, hit : and enter the command:
:source ~/.vimrc
Right now, you're running Bash's source command, which is entirely not what you want to do.
~/.vimrc is the configuration file for vim, and will automatically be read by vim when it launches in order to know how you want it set up. You can add your non-graphical vim commands, such as key mappings, abbreviations to ~/.vimrc/. In ~/.gvimrc you can add commands to set your colorscheme, the default number of columns and rows displayed at startup, etc.
If you aren't familiar with vim itself type vimtutor at the command-line and go through the tutorial.
To start gvim, type gvim at the command-line. To edit a file you can either open gvim, then use :e file/to/load in comman-mode, or do gvim file/to/load at the command-line. gvim supports multiple windows and tabs as does vim, so study those things to make the most use of them.
You can also try integrating Vim with eclipse if you want to bring IDE functionality to Vim (like projects, error highlighting, code completion, etc).
If you're interested check out the eclim project. It supports most of the modern languages, including Ruby, and I highly recommend it.
Try adding a .vim or vimfiles in your $HOME directory. If it still fails, add a file to the .vim directory. I did a
cd
mkdir .vim
cd .vim
touch .netrwhist
chmod g+w .netrwhist
I discovered this while learning about building your own syntax files at vim wikia creating your own syntax files

Resources