Ruby prompt environment not connecting to gvim text editor - ruby

I am a Rails newbie and in following a video tutorial got to a point where I have to open Ruby command prompt environment.
The problem is I want to use gvim as as my text editor, but I can't seem to get it to work. It gives an error message that reads
gvim is not a recognizable internal or external command, operable programme or batch file

gvim may not be installed in your system. gvim is a popular open-source text editor.
You didn't mention which operating system you are using.
You can install gvim from http://www.vim.org/download.php
If you are on Linux, you can work on vim instead of gvim to check if you are doing the things properly.
Good luck.

What OS do you use?
i think you use win or mac. on linux you may use vim out of the box. if it's mac or win you need to install vim or gvim from vim official site.
after you need to customize you vim to work fine with ruby.
for example
good luck.

When you install gvim in Windows, you have to click a checkbox to install command-line binaries. Try reinstalling gvim and clicking that checkbox.

Related

vim Mac OS X install with gui-support

I have Mac Pro, with OS X 10.9.4 (can't upgrade to Yosemite yet), and I'm trying to build vim7.4 with gui-support, or get any kind of gui-support. My current vim is version 7.3, I'm guessing, that's the default vim that ships with macs. I have the Terminal.app and iTerm2.app, my vim rc has the default
set term=xterm-256colors
or what have you.
What I have so far:
macvim
The colors look great, basically it's the same setup I had on my ubuntu system, but it's really annoying that it opens a new window. Is there a way to get it to open within my terminal? (not launch it from the terminal, open inside of it)
As I've said I have the regular vim7.3
And while I can use color-schemes, they look like garbage compared to my ubuntu system. I suppose this must be due to gui-support option? I tried, CSApprox but that gives me a weird error.
So I decided to simply build vim 7.4 and enable gui support, but I get random errors.
My basic config make looks like:
./configure --enable-gui=yes
make
At which point it complains about missing header file etc. , I figured this should not be that hard.
Any tips?
The basics of what I'm trying to do is:
Have a vim version installed with gui-support, or a work-around where my colors are all screwed up.
Thanks!
Building Vim on Mac OS X is a waste of time.
Step 1: Download the appropriate MacVim build from here.
Step 2: Put MacVim.app into the /Applications/ directory.
Step 3: Put the bundled mvim script somewhere in your PATH.
Done.
To run MacVim in your shell:
$ mvim -v filename
To run MacVim from your shell:
$ mvim filename
Building Vim with GUI on macOS using Homebrew:
brew edit vim.
Add a new line with option for GUI:
option "enable-gui", "Enable GUI mode"
Change from no to yes in the following line:
opts << "--enable-gui=no"
Install or re-install vim:
brew reinstall vim --enable-gui
Troubleshooting:
If you've errors related to Python 3, see: vim's GH-2754.
Checkout new Homebrew PR at GH-25785 with above patch.

How do I open the MacVim GUI?

I feel like an idiot asking this because I have it working on my iMac at work but can't get it working on my Air.
I have installed the latest version but can only get it to run in a terminal window, not the GUI which I prefer.
Google has plenty of "how to run MacVim in terminal" results but I'm not finding how to do it the other way round and can't remember what I did on the work machine.
If you can get to it in the terminal:
:h mvim
If you are able to double-click the MacVim.app Application Bundle and launch as per a normal Mac Application, but you are not able to run
mvim
in a terminal, it seems like mvim may not be in your $PATH. However, if you are not able to open the MacVim.app at all, then it sounds like a bad compile.
mvim -g should open a GUI window, if that's possible. (It might not be if something is wonky with your bootstrap namespaces, which is where reattach-to-user-namespace comes in handy.)
mvim decides whether or not to call vim with -g or not based on whether there's a non-empty SSH_CONNECTION environment variable. If that variable has content, then it assumes you're ssh'd into a server, and the GUI window wouldn't do you any good, so it doesn't provide the -g argument.
You can preemptively pass -g yourself, and then mvim's antics won't matter.
I folowed your guide, but ran into a problem in vi, after installation the statusbar was only visible in the help window of macvim.
I found a solution in the official documentation;
https://powerline.readthedocs.io/en/latest/troubleshooting.html#vim-issues
I had to add the following to my .vimrc
set laststatus=2

How to open a window from mac terminal

this is the first time I ask on stackoverflow because I can't find the answer anywhere. I use emacs to write all my code and I just switched from ubuntu to mac os. One problem has been bothering me: How could you open emacs window from mac terminal just like you would open firefox window from terminal on Linux system? I know the way it works for Linux system is that, whenever you type a command from terminal, the terminal search for the binary in you PATH and execute it. Is it the case for Mac that you can only open applicaiton in window form under "/Application" directory and all binaries opened from terminal are in non-window form? Big thanks!!
The pre-installed Emacs that comes with OS X is built without the GUI. Hence
$ emacs # in the shell/terminal
will NOT open a graphical window, and instead will open up the text/terminal version instead. Note that this version (installed at /usr/bin/emacs) is also old, and is at 22.1.1 in Mountain Lion.
To get the behavior you desire (and also get the latest version of Emacs as a bonus), you can download the latest Emacs build. This is available at various places, including http://emacsforosx.com/.
Most of these pre-built Emacs are installed under /Applications, and in order to invoke from the terminal, you will need to specify the full path to the binary, which usually is:
/Applications/Emacs.app/Contents/MacOS/Emacs
You can create a simple alias to this binary in your .bashrc as:
alias emacs=/Applications/Emacs.app/Contents/MacOS/Emacs
and then invoke emacs in its full glory from the command line.
I just tried
/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal &
and it did open a new window just fine.
OS X 10.7.4 here.
EDIT: Indeed if I try:
open /Applications/Utilities/Terminal.app
No new terminal window is opened
But,
open --new /Applications/Utilities/Terminal.app
works also, and is probably better than my first option because the job is not tied to the terminal you started the new terminal with.
First, download a Mac OS/X emacs build from here: http://emacsformacosx.com/
Second, once it's installed, you can:
Open it from the command line with open -a emacs
Set it to run server mode in your .emacs init, and then at the
command line type emacsclient foo for file foo.
I'd recommend either getting emacs via fink, or going to here: http://emacsformacosx.com/
This will allow you to install a local version of emacs that runs through the X server, and thus has the full GUI interface.
not sure if u're looking for something like this
open /path/to/some.app

How to develop in Linux-Like Shell (bash) on Windows?

I'm Windows user. But according to my project requirements, I need to write Linux Shell Script(Bash shell). How to develop Linux Shell on Windows?
Is there any IDE for writing Linux Shell Scripting? Please share me some ideas and resource links.
You have quite a number of options:
cygwin
Install cygwin. It will give you a bash.
mingw
The minimal GNU for windows. Comes with set of commands, compilers. This came with my Git on Windows and now the default shell for small scripts
VM, such as VirtualBox
There are tons on VMs, VirtualBox being easy to use(it powers the Boot2Docker). You can do development and test on real Linux distros.
Ubuntu on Windows 10
There is new kid on the block. This allows you to run User Space Ubuntu using Windows Subsystem for Linux (WSL). see more on it at Microsoft blog
Other notes/IDE support
Shell scripts should be small, requires less IDE etc. I use VIM with syntax highligthing. But it seems ShellED may be useful in your case. I got the link from answer for this question - Bash script plugin for Eclipse?
IntelliJ has couple of plugins too for Bash..
I prefer Gow (Gnu on Windows) over Cygwin. Both will give you bash on Windows, but Cygwin has unnatural conventions for filesystem access (/cygdive/c/some/path instead of c:\some\path).
The native windows command terminal is pretty lame, take a look at Conemu.
I'm not aware of any bash IDE, but there are a plethora of windows text editors with decent syntax highlight for bash scripts. I like Notepad++ and Sublime text (the multiple cursor feature from Sublime rocks!). I don't recommend bash for anything with more than 30 lines, if you ever feel the need for an IDE, perhaps the task is more suited for Python, Ruby or Perl (IMHO Python is more maintainable).
The Bash shell is coming to Windows 10 in the upcoming Anniversary Update (Redstone).
The Bash shell is coming to Windows. Yes, the real Bash is coming to Windows, said Microsoft's Kevin Gallo at Build 2016 keynote. This is not a VM [Virtual Machine]. This is not cross-compiled tools. This is native."
Here's the steps to run Bash on Windows 10 OS:
Open the Windows Start menu
Type "bash" [hit enter]
Which opens a console running Ubuntu's /bin/bash with full access to all of Ubuntu user space
Yes, you are right, that means apt, set, ssh, rsync, find, ls, grep, awk, sed, sort, xargs, md5sum, gpg, curl, wget, apache, mysql, python, perl, ruby, ruby gem, php, gcc, tar, vim, emacs, diff, patch, nano...and most of the tens of thousands binary packages available in the Ubuntu archives!
Reference
Step-vise Guide to Enable Windows 10’s Ubuntu Bash Shell (Windows Subsystem for Linux)
The Bash shell is coming to Windows 10 in the upcoming Anniversary Update (Redstone).
Run native Bash on Ubuntu on Windows
Since you need to write linux shell scripts, you are learning Linux. So you should install Linux on your machine (preferably on its own partition and boot from it, otherwise in a VM).
Using cygwin or whatever imitation of Linux shell is not using Linux. You'll learn a lot more by installing and using Linux (and by developing on it with an editor like emacs or gedit or gvim ....). Also, take advantage that Linux is almost entirely free software, so you can study its source code and improve it.
Not installing Linux is not doing yourself a favor.
I believe cygwin is for those who love Linux but have to use Windows. It cannot give you the entire Linux feeling (e.g. you won't be able to write shell scripts looking into /proc which does not exist in Windows, even with cygwin).
If you want to use a simple environment emulating all Linux environment as alternative to cygwin (more lightweight) you can try mingw and you can use notepad++ or emacs or vim to provide some syntax highlight on sh scripts.
Everyone has said to go full Linux or use various mocks.
Cloud9.io is a good option if you don't need that much.
You can set up a "workspace" which can be accessed online, lets you write in literally any language similar to np++, but the best part is, it's an online Linux, so you have a terminal, with all your shell commands - no mock up, no dual boot.
The downside to this is that the free users aren't given that much power, so if you wanted to execute some high-level maths or output a large image, it will crash as you will be using too much memory. But it is still really worth getting into, it's only ever crashed once on me, and I do some pretty memory-intensive things.
There is cygwin , that's a linux console for windows.. so you can execute all the linux command with it.
Install Cygwin to execute the commands. However you can use NotePad++ as editor which has native windows binaries.
http://www.cygwin.com/
http://notepad-plus-plus.org/
For Eclipse Luna Should use this one old version fails on UI error
Help > Install New Software… > Add…
Name: ShellEd
Location: http://sourceforge.net/projects/shelled/files/shelled/update/
I had a similar problem.
I like both Linux and Windows, and I am working on both systems, but for programming (and generally, for text editing) I use Windows, for different reasons. For example, I write C/C++ code on Windows, using the Windows DevC++ IDE, then I can compile this project on Linux, by sharing the files on LAN. Now I have to write long scripts, and I would like to do it in a similar way. Ok, maybe its a special request, but maybe I am not the only one who works in such a mixed environment.
First, I tried notepad++ (it is suggested by others as well), but does it support syntax highlight for Linux scripts? I didn't found this feature...
Then I tried gedit compiled for Windows. It requires the GTK library installed (actually it was already on my Windows). Gedit has syntax highlight for scripts!
So I suggest using gedit for Windows for this case. The edited script can not directly be started/tested with it, but for editing, it is fine!

Emacs in Windows

How do you run Emacs in Windows?
What is the best flavor of Emacs to use in Windows, and where can I download it? And where is the .emacs file located?
I use EmacsW32, it works great. EDIT: I now use regular GNU Emacs 24, see below.
See its EmacsWiki page for details.
To me, the biggest advantage is that:
it has a version of emacsclient that starts the Emacs server if no server is running (open all your files in the same Emacs window)
it includes several useful packages such as Nxml
it has a Windows installer or you can build it from sources
And concerning XEmacs, according to this post by Steve Yegge:
To summarize, I've argued that XEmacs has a much lower market share, poorer performance, more bugs, much lower stability, and at this point probably fewer features than GNU Emacs. When you add it all up, it's the weaker candidate by a large margin.
EDIT: I now use regular GNU Emacs 24. It also contains Nxml, can be installed or built from sources, and with this wrapper, the Emacs server starts if no server is running. Cheers!
Note that GNU Emacs for Windows comes with two executables to start Emacs: "emacs.exe" and "runemacs.exe". The former keeps a DOS-Prompt window in the background, while the latter does not, so when if you choose that distribution and want to create a shortcut, be sure to launch "runemacs.exe".
Carl
Easiest way to find where the user init file is:
C-h v user-init-file
Easiest way to open it is (in the scratch buffer):
(find-file user-init-file)
and hit C-j to eval
Well, I personally really like what I have been using since I started with Emacs, which is GNU Emacs. It looks like it is built for windows too. That link also answers your .emacs file question. Here is a place you can download it. You should probably get version 22.2 (the latest).
If this is your first time, I hope you enjoy it! I know I absolutely love emacs!
I run it under cygwin. That also gives me a Unix-ish environment for shelling out commands with meta-!
I use a vanilla version of emacs. In my experience, this is very stable, simple, does everything I need, and doesn't add a bunch of bloat that I don't need. The .emacs file can be placed in C:\Users\YourName if the HOME environment variable is set. This is a great way to handle it because it works on a user basis and mimics emacs behavior on Linux. You can download the zip from any gnu software repository mirror in the emacs/windows folder. You want the file that is named emacs-xx.x-bin-i686-pc-mingw32.zip.
There are some great instructions for configuring emacs for windows here. Basically, "installation" boils down to:
Download emacs from a gnu mirror at emacs/windows/emacs-version-bin-i686-pc-mingw32.zip, and extract the zip to an appropriate folder. Preferably C:\emacs to avoid spaces in the filename.
Set the HOME environment variable to C:\Users\username (or whatever you want). Make it a user-only variable (if it is username-specific). This is where your .emacs file goes.
If you want a start menu or desktop shortcut, create a shortcut to bin/runemacs.exe.
Add c:\emacs\emacs-xx.x\bin\ to your path (user or system), so that you can run it from the command line.
Also, you can consider emacs-w64 for 64bit windows systems:
emacs-w64: http://sourceforge.net/projects/emacsbinw64/
See http://www.gnu.org/software/emacs/windows/ntemacs.html. Section 2.1 describes where to get it, and section 3.5 describes where the .emacs file goes (by default, in your home directory, as specified by the HOME environment variable).
I've run both GNU emacs and Xemacs on windows. I used to use it as my primary editor, email client etc, but not it's "just" an editor.
When I recently reinstalled to Vista I installed the latest GNU version. It works fine. So does Xemacs, but it does look like GNU have got their sh*t together so Xemacs isn't as compelling anymore.
I suggest you to use development version of GNU Emacs 23, which is pretty stable and to be released relatively soon. You can get weekly binary builds from the link below.
Latest GNU Emacs as a zip archive
I have a portable version with .emacs configure ready, which setup org mode, I-do, etc. It also included org sample file. I think that is a better start point for new comers.
Basically run with runemacs.bat and everything is ready.
http://nd.edu/~gsong/portable_emacs.html
I've encountered this problem, and discovered the fault (at least in my case) to be the existence of c:\site-lisp\site-start.el, a file that was created when EmacsW32 was installed, and which was not removed when I uninstalled it. (Vanilla GNU Emacs for Windows has c:\site-lisp in its load-path, and will try to load this file, which somehow winds up triggering that error.)
Solution: removing that whole directory (c:\site-lisp) worked for me, but you should just be able to remove the site-start.el file.
The best place to start, to get an MS Windows binary for GNU Emacs is ... GNU Emacs:
http://www.gnu.org/software/emacs/
(Oh, and how did I find that URL? From the Emacs manual, node Distribution. If you have access to Emacs anywhere, that's the place to go for such information.)
On that page you will see everything you need to know about obtaining Emacs. In particular, you will find a section called Obtaining/Downloading GNU Emacs, which links to a nearby GNU mirror. Clicking that link takes you to a page of links that download all Emacs releases since release 21.
More imporantly here, on that page of links you will also see a directory link named windows. Click that to get a page of links to Emacs binaries (executables) for MS Windows. That is the page you want.
Knowing the above information can help when you need to find the page again, if you haven't bookmarked it. But here is the final URL, directly: http://mirror.anl.gov/pub/gnu/emacs/windows/
When forced to use Windows, I ...
Download "Emacs for windows", and save it in some directory (henceforth referred to as EMACS_SOMEWHERE)
Drop a .cmd file in "Startup" to map, "My Documents" to H: drive with subst, or if "My Documents" resides on a remote server, I use the "Map Network Drive" thing in Explorer to have "My Documents" named H:. Then I create an environment variable named HOME in Windows and give it the name of "H:\". Now I can drop my .emacs file in "My Documents" and it will be read by emacs when it launches.
Then I create the H:\bin directory. Then I add "H:\bin" to my Windows "Path" environment variable.
Then I create a H:\bin\emacs.cmd file. It contains one line:
#call drive:\EMACS_SOMEWHERE\emacs-23.2\bin\emacsclientw.exe --alternate-editor=c:\programs\emacs-23.2\bin\runemacs.exe -n -c %*
This is a fair bit of work, but it will enable me to run the one and same emacs from either a windows command prompt or from a cygwin command prompt, provided that /cygdrive/h/bin is added to my cygwin PATH variable. Haven't used this setup for a while but as I recall, when I call the emacs.cmd with a new file over and over, they all end up being buffers in the one and same emacs session.
There was https://bitbucket.org/Haroogan/emacs-for-windows with the latest Emacs 25, but the whole page has been removed.
The benefit of this build and the emacs-w64 above is that they come with jpg, png, tiff DLLs as well as lxml DLL, which is needed for the new eww web browser.
I prefer to run Windows 10 + VcXsrv + Emacs 25 client in WSL. Emacs is my shell.
To access the .emacs file for your profile the easiest way is to open up emacs. Then do C-x C-, type in ~USERNAME/.emacs (or you can use init.el or one of the other flavours). Type your stuff into the file and C-x C-s (I think) to save it.
The actual file is located (in Windows XP) in c:\Documents and Settings\USERNAME.emacs.d(whatever you named the file), or the equivalent spelling/location on your system.
You can download GNU Emacs NT from here direct. It works fine in windows, make sure you create a shortcut to the runemacs.exe file rather than the emacs.exe file so it doesn't show a command prompt before opening!
XEmacs is less stable than GNU Emacs, and a lot of extensions are specifically written for GNU. I would recommend GNU > X.
You can place the .emacs file in the root of the drive it's installed on. Not sure whether you can add it elsewhere too...
Im using emacs32, I only have one problem with it really:
https://stackoverflow.com/questions/3625738/comint-previous-matching-input-in-emacsw32-is-not-interactive
If You Mean Emacs as Latex Editor for Windows 7.
Emacs4LS (Emacs 4 Latex Support under Windows 7) for newcomer for Emacs.
http://chunqishi.github.io/emacs4ls/
Easy Steps to Install.
Plugins Built-In.

Resources