Command - R like functionality in MacVim - ruby-on-rails

I'm on a Mac and when I am in TextMate editing a ruby file I can simply hit Command-R to execute the file and see the results in a new window. Is there something similar to this using MacVim?
It's really important that I be able to open up a NEW window. Reason is because in the current window I might have more than one full page of info. If that happens I can't scroll through it.

You could create your own mapping to do it:
map <D-r> :w<CR>:!ruby %<CR>
% is the current file. If your file starts with #!/path/to/ruby you can omit the explicit call to ruby in your mapping.
Haven't tested the <D-r> mapping - no mac here. It's likely configuration dependent.

The following question has the answer to exactly what I was looking for
https://superuser.com/questions/133886/vim-displaying-code-output-in-a-new-window-a-la-textmate

Related

How to run FSharp.Plotly (charts) non interactive?

I want to create a console application that makes use of FSharp.Plotly (charts) to show statistics. However, FSharp.Plotly seems only able to run in a .fsx file (documentation didn't mentioned .fs) I tried it in a .fsx file and it was a success, i was able to load a chart.
However, I want to be able to call the graphs (so a pop up appears) with a console application, how to achieve this?
I needed to use: open Fsharp.Plotly (it needs first to be seen in the references list).

How to disable Notepad++ Auto-open previous files without opening Notepad++?

How do I stop Notepad++ from loading all files from the past session?
I know how to do that settings in Notepad++, but the problem is that I once opened a very large file (>10GB) and made the Notepad++ hang up. Notepad++ has already marked that big file in the session and therefore hang up everytime I start the Notepad++. Is there a way I can stop it from loading the past session so it won't hang up every time?
P.S. I have received a report on possible duplicate with this question. This is obviously a different case. At least in that question the notepad++ still starts up normally while in my case I cannot even change the settings normally because the notepad++ just hang while loading the stored version. The answer to this question also provide a good way to change the settings without starting Notepad++, which will be useful in fixing problems caused by settings when the Notepad++ cannot starts normally.
Yes, you can change that setting by modifying the config file.
go to %appdata%\Notepad++
and open config.xml
You should find the following line in there:
<GUIConfig name="RememberLastSession">yes</GUIConfig>
just change it to no and that should do the trick.
Start from command line:
notepad++ -nosession
"Auto-open previous files" then should be disabled
This is for those who do not want to modify the XML config filess, and this will also work without having the Notepad++ in PATH.
As I do not have enough reputation to comment on other answers, I'll add on Jacques Hubart's comment, all credits should still be for him.
Open Windows Run (Windows + R)
Type in the full path to the Notepad++ EXE.
This would normally be C:\Program Files\Notepad++\notepad++.exe
Add the nosession parameter
Run
Preview:
If, like me, you left a huge file in the last session, you can also remove just the offending file from the session and keep the rest.
go to %appdata%\Notepad++ and open session.xml
Scroll to the right to see the filename. Be careful to keep the integrety of the XML by removing the entire "file" node. It should be on a single line.
There is also another way from GUI
In Settings/Preferences/Backup uncheck the "Remember current session for next launch"
As suggested use notepad++ -nosession from run to open notepad++. Then go to preferences --> Backup --> Uncheck Remember current session before next launch
Close notepadd++ and open it normally without run. It worked for me.
another possibility is that the window is on an other screen not visible anymore due to starting it in a new multimonitor setup.
in that case, you have to bring the windows in the visible area by:
select the window by Alt+Tab
Alt+Space opens a small menu in the top left corner
Arrow-Down and Enter selects ' Move'
Arrows brings it back

Migrating to Vim from RubyMine - Interpreted Auto completion

Up until last week, I had been using RubyMine for my Rails development. I know it has a vim plugin but I have been working on migrating my development to vim and tmux. I don't want to keep using the mouse and VIM gives me a lot more flexibility. I have found plugins and workarounds for almost all the features I care about except the "interpreted auto complete" functionality in my first screenshot below. RubyMine interprets the whole rails application and offers sorted-by-relevance suggestions (as you can see, it's showing me instance variables and methods for the class in question and the modules it includes) THEN it shows (less relevant) methods available on the Object class. It also shows the method signature when there's one.
Also, in my second screenshot, you can see how RubyMine offers autocompletion for core Ruby classes.
Compare this to the bottommost screenshot. I do have completion but there's no way to find what I'm looking for. I'm using ctags , YouCompleteMe, vim-rails, vim-ruby and I also tried installing eclim to see if it makes a difference.
Is there a plugin I've missed that can enhance my auto completion? It doesn't look like RubyMine is doing something super crazy. pry can give me the same 'power' if it were running in the same 'context'.
First Screenshot (RubyMine interpreted auto complete):
Second Screenshot (RubyMine core Ruby classes auto complete):
Third Screenshot (vim omnifunc + ctags):
Important Note
This solution only works for Ruby 1.9+
I forked 'vim-ruby' at https://github.com/zxiest/vim-ruby and modified it as such:
Method signatures now appear in completion.
I disabled sorting by name for methods.
Plugins and Settings
vim-rails
I'm using vim-rails https://github.com/tpope/vim-rails
supertab
I'm using supertab https://github.com/ervandew/supertab instead of YouCompleteMe (mentioned in my question) although YouCompleteMe is super fast and automatic but there are currently some compatibility issues between my it and my vim-ruby fork.
vim-easytags
I'm using vim-easytags https://github.com/xolox/vim-easytags
Add this to your ~/.vimrc
:set tags=./tags;
:let g:easytags_dynamic_files = 1
Make sure to touch ./tags in your project directory.
Issue :UpdateTags -R **/*.* from vim in order for easytags to generate your tags file.
Remap omnicomplete
In order for omnicomplete to pop up, by default, we have to hit <C-X><C-O>. I remapped this to <C-Space> by inserting the following in my ~/.vimrc:
inoremap <C-#> <C-x><C-o>
I now press tab when I want supertab to complete my code and Ctrl+Space when I want omnicomplete to trigger and show method signatures for me. There's definitely a better way to integrate this (i.e. getting supertab to call omnicomplete after a dot)
And here goes the screenshot! Notice that method sorting being off allowed my custom resize method to appear on top and the signatures now appear in the completion (as well as in the editor when enter is pressed!)

How do I set a Notepad++ variable?

Printing code with Notepad++ is very handy because of the syntax-highlighting.
Unfortunately I'm experiencing a problem with printing.
Now at the left top of the page $(FULL_CURRENT_PATH) is printed, which is, D:\cppWorkspace\project1\display\GUI\main.cpp
I don't want the whole path, to the project, to be printed. However it also should not only print the file name.
In this case it should be, display\GUI\main.cpp. (which are packages inside the project and the file itself)
I tried to edit or set a Notepad++ variable, but I couldn't find a way to do this.
Hopefully someone knows how this can be fixed.
Thanks in advance,
Dennis
Unfortunately the variables are fixed, and cannot be "set" - at least as of the current version (6.3.1). They are simple replacements, handled in the expandNppEnvironmentStrs method in RunDlg.cpp
You're welcome to suggest an idea on IdeaTorrent (see the hosted apps menu on the Sourceforge project), or vote a similar idea up if one exists.

How to make RSense autocomplete and jump to definitions of a rails project?

I switched from netbeans to emacs and I am pretty happy with the change. The thing I am missing the most is autocompletion and jump to definitions. In order to get this I have installed Rsense. It works fine for the gems code, though, I cannot jump-to-definitions of my Rails project nor autocomplete according to the methods I defined.
I tried to add my project's load path to Rsense's load_path configuration, though, it still doesn't work.
Does anyone know how to get this working?
You can use tags for browsing through files and jumping directly to function definitions.
I use Exuberant Ctags (its got Ruby support). You can download it from here.
I am assuming that you are working on windows. Getting the tags to work initially on windows is a pain especially if you are using emacs for the first time.
These are the steps I followed:
Install Cygwin from here.
Include the cygwin\bin\ folder in your environment variable PATH. E.g. here
Install exhuberant ctags. Note that emacs may sometime have a built in ctags. Later on you will have to use the ctags command in cygwin to create tags. At that time you may encounter some errors in case it uses the ctags in emacs instead of exuberant ctag.
Once you have installed ctags, add that to the environmental variable PATH as well.
If you have a small project with relatively lesser number of files (<500). So you just need a single global TAGS file. For that open cygwin, change your directory to the root directory of your project and type in the command ctags -R -e Check this out for other approaches
Your tags file will be created. It will be named "TAGS" and will be present in the root directory of your project.
Next open emacs, and browse through the code. In case you come across a function and want to jump to its definition, put your cursor on the function name and press M-. your minibuffer should then show something like Find tag (default <function-name>): Press Enter and voila!!! you are magically transported to the function definition!!!
Note: You may have to specify the TAGS file the first time you use the M-. This needs to be done only once after emacs startup. You can also modify your .emacs file to take in the TAGS file automatically on startup.
Refer to this and this for more info for tags related commands in emacs.
Until now, I have been using rtags to jump to definitions. It's not perfect, but it does the trick in many cases.

Resources