Running R inside a buffer in Vim - vim

I have used Stata and gVim on Windows for a while now. Recently I have switched to Linux, and I am planning to also change from Stata to R.
A friend of mine is using R and Emacs ESS which seems to work perfect, however i'd rather like to keep using vim. I have installed the vim-r-plugin2, however, i can only send code to a seperate terminal running R. I would much rather split my screen into a buffer running R and one buffer with my .R file, and then send code from one to the other. With ESS in Emacs this seems to work, you can run a terminal/R in a buffer without a problem. I haven't found a way to make this work. The R plugin for vim uses screen, and the only way to open a buffer running a shell I could find is the Conque Shell plugin.
I know that unlike Emacs, Vim is designed to be a simple text editor. However, having R run in a buffer seems just so much more practical.
I hope my problem is understandable, please bear with me I only recently switched to Linux and know virtually nothing about programming besides statistics. Thanks!

If you do not need to input unicode, you can consider using ConqueShell plugin.

In the meanwhile, the 'evil' (extensible vi emulation layer) mode has matured. This is a vim emulator running in Emacs and works quite well for me.

Another option, and forgive me for pointing you back to EMACS,
viper-mode
http://www.informatik.uni-hamburg.de/RZ/software/emacs/viper/viper_3.html
It's an EMACS mode that makes EMACS feel more like Vim, while giving you full access to the wonderful, mind-boggling complexity of EMACS if you ever want it.

Related

Using console as tab

I have several cpp source files in tabs in vim. I would like to have another tab with command prompt in order to run make. I open net tab , run sh and now I have console. But how to move from this console to other tabs? If I press ctrl+page up I have garbage in console and no tab change. How to move to another text tab when staying in console tab?
As I said, vim 8 or neovim both have an terminal emulator in it.
Since you are using vim 7 here are some other ways:
Tmux as #wizzup mentioned is perfect for this use-case. I think it is the most used Terminal-Multiplexer and extremly mighty. It is complex in comparison but since you are using vim, a steep learning curve should not be a killer point. However there are a few cavehats but you will find thousands of articles to solve them.
GNU Screen is an alternative to tmux, I have no experience with it, but should be usable pretty good with vim too.
With them you can use something like this Plugin which allows you to use the terminal in vim itself. However I haven't tested it but it seems to be rather groomed.

Linux Utility to `Go to definition`s

I'm starting to develop a fairly large app and am beginning to want some of the IDE features I've used in the past, such as 'right-click->go to definition' of a function. Does any kind of parallel in developing on the command line exist? This is on an Ubuntu Desktop VM. Is recommended to move to using Sublime?
It depends on your preferred editor, but options definitely exist.
I've used c-tags for vim.
Similar options must exist for emacs; a quick search turned this up.
In my experience though, nothing beats a full-fledged IDE (more full-fledged than Sublime, even) for these kinds of introspective utilities.
If you're using VIM, check VIM Taglist plugin. It has a command that takes you to a ctag definition.
You can create a VIM keymap to go to the word/function under the cursor which would solve your problem.

Interface texshop with vim

Any advice on how you would interface texshop on mac osx with vim? I'm using vim quite a lot lately for coding. I find myself now trying to use vim-commands (replace, search, pattern matching, move, etc) when writing documents for latex with texshop and they obviously don't work. However, I don't want to leave texshop altogether, because it has some pretty nice tools I use very often (maybe the most important one is the ability to click the compliled .pdf file while pressing the CMD key on my macbook to jump immediately to the corresponding place in the .tex file).
Thanks in advance!
Can't really help with the question but if you want to use vim I would highly recommend vim-latex suite. It has a lot of mappings and other latex goodness including completion of references/citations (it loads them from the bib file and gives prompts based on what you've already typed). Also it supports pdfsync forward/backward searching - I use that with Skim. There is some information here on how to get that working (and see other posts on that blog).
Are there any other texshop features you would like to reproduce in Vim?

Reasons for using command line Vim versus GUI Vim [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
Background
I'm building an application where it detects what documents you're using from the file system. To do this it must access the AXDocument attribute of the active window. MacVim provides this. Running Vim in the Terminal wouldn't provide this.
I've just put out a survey to ask what editor coders who are interested in my app use. A significant number of the folk using Vim used it directly from the command line.
Why not use a GUI Vim?
Why do some people prefer to run Vim this way versus a GUI implementation like MacVim?
What advantages does this offer? As I understand it, you can send files to MacVim from the command line just as easily as command line Vim.
These reasons may be different for each specific developer but my guess would be:
vim is pretty much vim on any platform. GUI implementations can
vary.
Familiarity - being familiar with vim does not nessecarily mean
being familar with vim wrapped ina
GUI - espectially given #1.
"Elite Complex" ;-)
No definite avantages to the users over cli vim.
One might not have access to a gui (think ssh) or simply force of habit.
Although I don't use any feature exclusive to the GUI version (never touch the mouse while editing) I find GVIM more pleasing to the eye for fonts rendering and color management. So the only reason to use the cli version is not having access to a graphic environment (like when accessing a remote machine via ssh). Using GVIM also allows reuse of the terminal it was called from without having to use screen.
being able to run vim under screen provides
reliability: it will stay alive if X or the terminal app crashes. not sure how applicable this is to the Mac.
the option to multiplex sessions within terminal tabs. I actually end up rarely using terminal tabs because of this. It's possible (albeit a bit confusing) to set up heirarchical screen sessions and move branches of them around. screen is super awesome. This also provides an additional layer of text buffering in which you can search by regexp — this is useful if you spawn a shell command that is pages long and you're looking for a particular word in there.
the ability to connect to an existing session from another computer or reconnect after a network outage
and friends
in addition to making it possible to use screen, the console vim provides better shell integration. Although it's possible to run shell commands from within gvim (again, I'm not sure how this applies to the Mac, I'm a linux guy), there are limitations. I rarely use a gui vim so I'm not sure about the exact limits. For example, ANSI color codes are removed. I find this annoying because I tend to interact with SCM that way, for example running :!git diff --cached to check the changes in the index before committing. It makes for a somewhat quicker and more satisfying (mmm, diffy!) read if it's colourized.
I used to feel that gvim was a big improvement for viewing diffs, but I've changed the background colour of my terminal to a dark non-black shade, and set
:highlight DiffAdd ctermbg=Black
:highlight DiffChange ctermbg=Black
:highlight DiffDelete ctermbg=Black
:highlight DiffText cterm=Bold ctermbg=None
The result of this is that in diff mode, differing text shows up with a black background, and unchanged text is coloured with the terminal background colour. For side-by-side diffs, this works wonderfully, since you can tell immediately based on the other side whether a given line is a change or add; for non-side-by-side you will be able to see an unchanged part in a changed line.
This means that you can leave syntax colouring on and still be able to see diffs. Again, you do need to be able to set the background colour of the terminal to a unique, dark, non-black shade. This facility is available in the terminal emulators that I use (yakuake/konsole and roxterm) and many others.^[?Mac^M"mya)^O^Op
This also assumes that you're using a colourscheme meant for use with a dark background colour; I use a modified delek.
Although I haven't tried this, there is also the option to run console vim in 256-colour mode on terminals which support that mode — which I believe includes most or all modern ones. This can serve to make much of the subtlety of GUI colorschemes available to console vim.^["mp
I also like it that it lives in the place where it was started, and starts up quick. So if I'm navigating around in the shell, as per my wont, I can edit a file without interrupting that flow or having to farm that operation out to a different piece of conceptual real estate. Having less things to keep track of is a big plus. Being able to background it is helpful, too, for example if I need to grab the contents of an unexported shell variable via xclip. If I'd spawned a GUI window instead I might have some trouble remembering where that shell was, or might have already closed it.
My main reason for using a gui vim at all is that it makes somewhat more sense as something spawned from a gui app, eg a browser. In practice I never do this, and I suspect that it's fairly equivalent to just have a new terminal window pop up with a new console vim in it. Though there is likely some (window manager) window management functionality that is exclusive to gui implementations. This is pretty similar to the use case you're discussing.
gvim is actually just a basic terminal emulator with vim running in it, and some menus and toolbar buttons up the top.
So if you have a good, full-featured terminal emulator already, you may as well use that instead, since you'll be using the same type of terminal window that you are familiar with across all your terminal sessions.
Another benefit is that it makes it easy to switch to a shell inside vim and then switch out seamlessly.
On Windows I prefer gvim. On Linux it's vim inside gnome-terminal, which is nice and configurable thankyou.
To avoid (or at least minimize) the use of the mouse.
some gvim variations can't handle
some of my hotkeys
some spawn separate window when i try
to compile program
sometimes they simply can't use fonts
like fixed or terminus correctly
(think about "terminus bold" - some
gvim variations simply stretch
"terminus normal" instead of
rendering with the separate font)
cli generally works faster than gui,
especially if running in real
textmode console (not possible on a
mac though)
there are almost no benefits in using
GUI version, and i'd loose ability to
run in screen, ssh, to suspend
process with ctrl+z, and many more.
The main reason I use the command line is that I spend most of my day in a terminal already, and my use of vim reflects this. I do not open up vim for a long while just editing different files then opening others without closing it; I usually open a file or two do a few edits then do some command line tasks, maybe change a directory, and open up vim somewhere else. When using the a gui there is substantial lag when opening the editor. This wouldn't bother me if I opened it once and left it open but I tend to not work that way. So the command line works better for my workflow. Furthermore since there is no real benefit feature-wise of the GUI over the command line and vise-versa, I've always just stuck with the command line since it suited me better.
vim is way more performant with huge files (100-500MB .csv or .xml files in my case).
gvim beats vim hands-down when used to compare files (gvimdiff): setting the font (want more content on the screen?), dragging the window split line (want to see more of one file rather than the other) etc.
Other than that, I haven't seen other mayor differences and use gvim except when working with large files because I find it more handy in a graphical environment (gnome).
Speed of rendering
proper shell integration with
suspend (C-z),
alternate terminal,
uniform copy/paste
nicer quickfix integration (all external programs run inside your terminal, instead of popup windows... )
network agnostic: can run over ssh
using GNU screen, can detach/attach session over internet;
To the sometimes mentioned 'downside':
mouse support is up to par with :se mouse +=a; this enables selection, window border dragging with the mouse, even over GNU screen over ssh
Pair coding via vim + gnu screen is the selling point for me. I work in screen/vim all day, it allows people to remote into my screen session and we can both edit files fluidly. It's so hot right now.
As a big vim user myself, although I know about GUI vims, I don't use them just out of habit.
I've been using vi since 1990, switched to vim a few years ago but still call it through an alias (alias vi=vim).
For me its just habit. vim works well as it is. Perhaps the gui offers more and I should explore it, but vim works just the way I expect it to and want it to.

Text Editor For Linux (Besides Vi)? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
Let me preface this question by saying I use TextMate on Mac OSX for my text needs and I am in love with it. Anything comparable on the Linux platform? I'll mostly use it for coding python/ruby.
Doing a google search yielded outdated answers.
Edit: Since there has been some concern about the 'merit' of this question. I am about to start a new Ruby Programming Project in Linux and before I got started I wanted to make sure I had the right tools to do the job.
Edit #2: I use VIM on a daily basis -- all . the . time. I enjoy using it. I was just looking for some alternatives.
http://xkcd.com/378/
Emacs is a wonderful text editor. It has huge power once you become a power user. You can access a shell, have as many files open as you want in as many sub-windows and an extremely powerful scripting support that lets you add all kinds of neat features.
I have been using a ruby-mode which adds syntax highlighting and whatnot to ruby, and the same exists for every major language.
If you keep at it, you can use exclusively the keyboard and never touch the mouse, which increases your editing speed by a significant margin.
If you want to start with something a lot more basic though, gedit is nice... it has built in syntax highlighting as well for most languages based on the filename extension. It comes with the OS as well (though emacs you can easily install with apt-get or some similar package finder utility).
UPDATE: I think gedit is exclusively GUI based though, so it would be useful to learn emacs in case you are stuck with just a shell (it is fully featured in both shell and graphical mode).
FURTHER UPDATE: Just FYI, I am not trying to push Emacs over Vim, it's just what I use, and it's a great editor (as I'm sure Vim is too). It is daunting at first (as I'm sure Vim is too), but the question was about text editors on Linux besides vi... Emacs seems the logical choice to me, but gedit is a great simple text editor with some nice features if that's all you are looking for.
Kate, the KDE Advanced Text Editor is quite good. It has syntax highlighting, block selection mode, terminal/console, sessions, window splitting both horizontal and vertical etc.
I use sublime Text on linux.
Try Scribes . It tries to be a TextMate replacement for Linux
2020 edit: forgotten in the mists of history
I use SciTE
very small and simple text editor.
I like the versatility of jEdit (http://www.jedit.org), its got a lot of plugins, crossplatform and has also stuff like block selection which I use all the time.
The downside is, because it is written in java, it is not the fastest one.
I find Geany (http://geany.uvena.de/) quite good.
I use pico or nano as my "casual" text editor in Linux/Solaris/etc. It's easy to come to grips with, and whilst you lose a couple of rows of text to the menu, at least it's easy to see how to exit, etc.
You can even extend nano, I think, and add syntax highlighting.
Alternative text editors? Try Diakonos, "a Linux editor for the masses". The default keyboard mapping is as expected for cut, copy, paste, undo, open, save, etc.
When I searched for TextMate alternative for Linux, I ended up using Geany. It's not as powerfull, but still nice to work with. Great replacement for Kate.
On Mac OS X, I have used BBEdit since the early 1990's, so I use that as my reference for all other editors. I sometimes use BBEdit to edit files on a Linux box using ftp mode, and that works very well if you have a fast network connection to the Linux box.
I learned emacs two years ago because the rest of the programming team I joined uses it. I find emacs powerful but annoyingly old-fashioned in many ways, but once you have learned emacs, you can use it on any platform (Linux, OS X, Windows). This is the editor I use almost exclusively at work now. It is going to take me years to master all its features, though.
I have also used gedit on Linux and found it very usable, but I haven't tried to use it as my primary editor for any project.
I have a colleague at work who uses Komodo Edit 4.4 (free from activestate.com), running it on a Windows computer but using it in ftp mode so she can edit files on our Linux server. Komodo Edit has many nice features, but it takes a looonnnggg time to launch the first time.
Don't forget NEdit! Small and light, but with syntax highlighting and macro record/replay.
Best one besides Vi? Vim.
SciTE
http://www.scintilla.org/SciTE.html
The best I've found is gedit unfortunately. Spend a few hours with it and you'll discover it's not so bad, with plugins and themes. You can use the command line to open documents in it.
+1 for pico/nano -- lightweight, gets the job done, good help
Friend of mine swears by jed, http://www.jedsoft.org/jed/
First I don't want to start a war..
I haven't used TextMate but I have used its Windows equivalent, e-TextEditor and I could understand why people love it.
I've also tried many text editors and IDEs in my quest in finding the perfect text editor on Linux. I've tried jEdit, vim, emacs (although I used to love when I was at uni) and various others.
On Linux I've settled with gEdit. Although I do use Komodo Edit from time to time. When I'm in a hurry I use gEdit purely because it is quicker than Komodo Edit.
gEdit has plenty of plugins and comes with some nice colour schemes. I reckon once gEdit has a proper code-tidy facility it'll be cool.
I think the only reason I use Komodo Edit is the project file facility.
I have a friend who donated his 'Vi Improved' book in the hope that he can convert me to Vim. The book is over an inch thick and completely put me off in investing time in learning Vim..
Everytime I find an editor - I always find myself going back to gEdit. It is a frills-in-the-right-places editor. Give gEdit a go, it is the default text editor in Ubuntu and Linux Mint.
Here is a link to an excellent guide on how to get gEdit to look and behave (somewhat) like TextMate:
http://grigio.org/pimp_my_gedit_was_textmate_linux
Hope that helps.
I agree with Mike, though I'm a Vim die-hard. I've been using GEdit quite frequently lately when I'm doing lightweight Ruby scripting. The standard editor (plus Ruby code snippets) is extremely usable and polished, and can provide a nice reprieve from full-strength, always-on programming editors.
I've just started using OSX. Free editors of note that I've discovered:
Komodo by ActiveState. No debugger or regex editor (although one comes with Python, i.e. redemo.py) in free version but perfectly usable.
ERIC, written in PyQT.
Eclipse with PyDev is my preferred option for editing Python on all platforms. Nice clean GUI, decent debugger. Good syntax parsing etc.
I've used Emacs for 20 years. It's great and it works everywhere. I also have TextMate, which I use for some things on the Mac (HTML mode is great). If you want to do Ruby development, Netbeans supports Ruby and it also runs on all platforms.
http://www.netbeans.org/features/ruby/index.html
I've seen some blogs, etc claiming that it's the best Ruby environment available.
I use joe for simple (and not so simple) editing when I'm away from Eclipse.
It uses the classic Wordstar keybindings- although I've never used Wordstar, it's a selling point for many people.
It's easy, well-supported, light-weight and it has binaries available for everything.
I love Kate because it has several interesting features (already cited) usually found in (heavier) IDEs. My favorite feature, however, is its terminal window that is very practical for quickly performing the save-compile-execute combo.
Nedit is another valid option, packed with lots of features (and it hasn't lots of dependencies: that's a huge plus IMHO).
For editing in a shell, when I cannot use VIM, I look immediately for pico or nano (but I would not recommend them for continuous development: for rapid editing they are perfect).
If it's just you? Use what you want to use today; switch in mid-stream if you want.
Is it a team? Try to be editor-agnostic. Set standards for white-space (are tabs allowed? How many spaces does a tab represent?), but otherwise allow anyone to use whichever editor they want.
Is it a team doing pair-programming? That's where you may need a team-standard editor, just so that programmers can easily pass the keyboard.
To help implement a standard white-space policy in a shop where one or more coders is using Emacs: You can tell Emacs about your white-space policy with some comments stuck at the bottom of every file source file. For example,
# Local Variables:
# tab-width: 2
# ruby-indent-level: 2
# indent-tabs-mode: nil
# End:
Anyone using emacs (or xemacs) on that file will automatically get the group standard indentation.
Sublime Text 2 is my favorite.
Intuitively understandable and quite powerful.
You can try Emacs with ruby-mode, Rinari (for Rails) and yasnippet which provides automatic snippets like Textmate.
TextMate is a great editor, and there is a way to replicate some of the functionality in GEdit. Check the article out here: http://rubymm.blogspot.com/2007/08/make-gedit-behave-roughly-like-textmate.html to modify GEdit to behave like TextMate.
Vim is a nice upgrade for Vi, offering decent features and a more usable set of keybindings and default behaviour. However, graphical versions like GVim, KVim and even Cream are extremely lacking in my opinion. I've been using Geany a lot lately, but it also has its shortcomings.
I just can't find something in the league of Programmers Notepad, Smultron or TextMate on Linux. A shame, since I want to live in an all open source cyberworld, I'm stuck hopping from one almost-right editor to another.
I personally use MacVim which is basically a GVim for Mac OSx. However I have been reading alot about Redcar, which is a text editor for Linux, which shares a lot of the Textmate functionality. Checkout the links below.
Redcar
LURG Lecture on Redcar

Resources