Lack of file explorer in Linux vim - linux

In vim 7.3 on OSX, if I type
vim ~/myfiles
vim will put me into the Vim File Explorer for that directory, and I can open or rename files.
In vim 7.4 on Ubuntu, I get the unhelpful error message
"~/myfiles" is a directory
Looking through the compiled options (vim --version) and online documentation, I see no obvious way to activate this functionality through, say, a command-line or compile-time option. It is such a great feature of vim that I'm surprised it is not enabled on the version of vim available in the Linux package.

Use the :E command for the explorer mode.

The ability to edit a directory like this depends on a plugin. Most of the time, that plugin is the "netrw" plugin provided with Vim in the official runtime files. In Ubuntu (and Debian) you install that runtime separately so that every Vim package can use it rather than duplicating functionality. Try installing the vim-runtime package, and maybe a more feature-full Vim while you are at it, if you have not already done so.

To summarize and answer my own question...
File explorer functionality is actually provided by a plug-in, "netrw", which seems not to be installed by default in the two or three versions of vim I tried via apt-get.
Installing NERDTree solved the problem brilliantly - it can do so much more than the default explorer. I have not yet figured out how to rename a file using NERDTree - something that is easy with 'netrw', but that is a minor irritant and there is probably a way to do it.

Related

VIM can't be used after system upgrade to ubuntu18.04

I upgraded my system from ubuntu16.04 to ubuntu18.04,once I updated my system,I fond that my VIM could not be used.Whenever I use my VIM,the following mistakes will occur.
$ vim test.cpp
vim: error while loading shared libraries: libruby-2.3.so.2.3: cannot open shared object file: No such file or directory
What should I do?
Help me slove this problem,thanks!
If this is the default Vim installed via your package manager, that's not supposed to happen. Something's messed up, and I would attempt a complete purge and reinstall of the Vim packages.
If you've compiled Vim yourself (then it's typically installed as /usr/local/bin/vim, or under your home directory), you need to recompile it.
Vim typically isn't a static, standalone binary. Especially for the language interpreters (Perl, Python, Ruby), it links to them via shared libraries. You'll see some of this in the :version output.
On the positive side, this means that any fixes and enhancements automatically get into Vim as well. On the negative side, this means that if one of those dependent libraries get upgraded (as happens during a system upgrade) and the old version is lost, you have to recompile Vim, so that the new dependencies are incorporated into it. The also implies that it's not advisable to copy a self-compiled Vim to another Linux system (unless you're sure it's on the exactly same version), and compile on each system instead.

How to add python support for vim without destroying up all the plugins?

I started using vim earlier this summer and have recently started to add plugins. Todays challenge is to install YouCompleteMe.
Problem: During the installation process I noticed that my vim version (7.4) doesn't have support for python/python3.
Question: How can I fix this without messing up all my plugins/.vimrc file?
Will a clean install even affect my plugins/.vimrc?
I read some where that I should install 'vim-nox'.. Should I?
My setup: Ubuntu 16.04. Vim 7.4. Plugins are installed via Pathogen.
Thanks in advance for your replies!
Kind regards, Edvin
As long as your plugins are installed in $HOME/.vim (or MsWindows equivalent), and not into /etc/vim or /usr/share/vim, there should be no problem: you can upgrade your vim version without impacting what you have already installed.
See :h 'rtp' and :h startup.
Plugins and vimrc are just files. They can't be executed stand alone. Further, they come into power, only when vim is running.
So, your uninstallation/installation of vim doesn't change/affect plugins or vimrc. However, if the plugin or vimrc has code related to specific environment (like OS, terminal, etc,.) or needs specific features of vim and if your new version doesnt support them, you may have problems. Plugins in default folder(where vim is installed) will get deleted when you uninstall. The plugins in HOME directory aren't affected anyway.

Vim YouCompleteMe plugin - don't download clang

I want to install and use the YouCompleteMe Plugin for Vim. However, a part of the installation implies downloading clang 3.7, which is already a part of my current Ubuntu installation. Generally, wasting space on multiple versions of the same application on my file system is something I disregard, but now I'm also running dual-boot and don't have that much space left for a "casual" downloaded copy of clang just to make use of this plugin.
How can I make the YouCompleteMe to make use of the installation/libraries I already have, if possible at all?
Thanks.
Depending on your YCM install method, you will have to specify something like:
--system-libclang --system-boost
…as arguments to the install.py command.
Note that the YCM install docs strongly discourage the usage of system-libclang.

How can I use MacVim like gVim?

I'm trying to get a Mac Vim setup similar to my Windows gVim setup. I downloaded homebrew and installed Macvim with it, but when I run MacVim it comes up in a terminal and looks like regular Vim.
All I did in Windows was download gVim and I got some vimrc settings from a popular github repository so everything looks nicer and plugins were all set up for me. How can I achieve something similar with Mac?
I am relatively new to both Mac and Vim so help is appreciated.
MacVim comes with two executables: one is a regular windowed GUI application and the other is a command-line program. Both are bundled in the MacVim.app that you downloaded and installed in ~/Applications.
Double-clicking on the icon in the finder, clicking on the icon in the dock or choosing MacVim from the "Open with…" contextual menu should start the GUI.
Using someone else's setup is a very bad idea. Don't.

Issue installing vim plugins

So i'm rocking a VIM version 6.3.82 on rhel 4.9... which i'd imagine is the biggest culprit. (no chance of an upgrade any time soon)
I downloaded the latest Rails.vim and have installed this many times on my home machine.
I try the command :Rails! and i Get "e493: Not an editor command."
In my .vimrc i've added
set nocompatible
syntax on
filetype plugin indent on
Am i doomed with a dated vim to use most any plugins? Am i missing something in my .vimrc to enable vim plugins?
Any direction is appreciated. :p-
TIA,
Kirby
You'll need to use an old version of Rails.vim it looks like. The last version that worked with Vim 6 is version 2.1:
http://www.vim.org/scripts/script.php?script_id=1567
You may be able to compile your own version of vim in your home directory if you want to use the latest Vim and Rails.vim.

Resources