Why is Neovim's init file not working on my Mac? - vim

(Using MacOS) For some reason, the ~/.config/nvim file was not provided by default. So I created that directory and in it, the init.vim file.
The init.vim file has the following:
set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath=&runtimepath
source ~/.vimrc
This is supposed to get Neovim to use the settings I wrote in .vimrc
For some reason, the settings I have wrote in .vimrc are not showing up when I use neovim. What's going on?

Is the $XDG_CONFIG_HOME environment variable defined in your shell? If so, Neovim will look for an init.vim (or init.lua) in $XDG_CONFIG_HOME/nvim instead of ~/.config/nvim.
Here is the pertinent help text from :h init.vim:
The Nvim config file is "init.vim", located at:
Unix ~/.config/nvim/init.vim
Windows ~/AppData/Local/nvim/init.vim
or if |$XDG_CONFIG_HOME| is defined:
$XDG_CONFIG_HOME/nvim/init.vim

On my Mac, it was because of the access permission with the ~/.config folder. There was a red minus sign on the folder when viewed in Finder. I tried to open it and got this message:
The folder “.config” can’t be opened because you don’t have permission to see its contents.
I figured this was the problem because when I ran Neovim with sudo nvim, all the customisations in the init.vim file were applied.
I removed the restriction on the ~/.config folder by running this in the command line (source):
sudo chown [user] ~[user]/.config
and then
chmod 711 ~[user]/.config
Change [user] with the name of your home directory.

Related

How to install twig.vim in the .vimrc file for Vim 8.1

I'm trying to get this installed in my vim for ubuntu:
https://github.com/nelsyeung/twig.vim
I downloaded the files to ~/.vim folder, but there are no instructions on what I need to put into the .vimrc file to get it activated. What steps am I missing?
I downloaded the files to ~/.vim folder,
No. If you want to use Vim new integrated plugins management, first create the pack directory with a dedicated subdirectory of your choice (let's call it git-plugins but it's really own to you and depend how you want to have things organised)
mkdir -p ~/.vim/pack/git-plugins
In that location, create one of these directories:
start for plugins you always want available when you launch Vim
opt for plugins you want to activate and deactivate manually
Last, there will be a directory for the plugin itself. So, here, you have to download the files into let's say ~/.vim/pack/git-plugins/start/twig/
instructions on what I need […] to get it activated.
Now, launch vim and type the following command:
:packloadall
Check the included manual with
:h packl
This plugin has no doc to integrate into that system. But for general cases, put the following in your ~/.vimrc, after all internal setting and before plugins dedicated settings.
packloadall
silent! helptags ALL

How can I tell vim where my _vimrc and plugins are

At work I have gvim installed in C:/Program Files/vim but have no write permission on this folder. I would like vim to use my personal _vimrc and potentially some addins that would be in a bundle directory.
Problem is that vim choose the default _vimrc in C:/...
What can I do to fix my problem, I was thinking of a script but I can't manage in writing one that work... ?
EDIT: Off course I do not have admin rights
Your configuration belongs in %HOME% (or %USERPROFILE% if the former isn't set). You can always override that by setting the %MYVIMRC% environment variable (e.g. in the Windows Control Panel under Advanced System Settings) passing a different configuration script via -u path/to/vimrc. (Defining %VIMINIT% should work, too, but I didn't get it to work on Windows.) See :help startup for details.
The first place Vim looks for initializations (see :h .vimrc) is in your home directory. (If you're not sure where this is, you can use echo %HOMEPATH% from the command prompt to find out.)
Vim will use the _vimrc in your home directory if it exists, so you could just copy it there (%userprofile%_vimrc), or you could set the environment variable $VIM to the directory of your choice. You can set an environment variable on Windows by right-clicking on My Computer -> Properties -> Advanced System Settings. For more info see the vim docs.

I accidently found that I can use vim in git-bash of windows, but how and where to config the vim to better use?

Also, if it is possible to use visual studio command prompt in the git-bash?
The :scriptnames command will tell you the config files (and plugins) that are used.
If you haven't yet created a user configuration ~/.vimrc file, it is placed in your home directory. See :help vimrc for details.

Installing fuzzyfinder vim plugin

I unziped the vim-fuzzyfinder and vim-l9 packages in my ~/.vimrc directory
[shetye#dev03 ~/.vim/vim-fuzzyfinder]$ls
autoload doc plugin
[shetye#dev03 ~/.vim]$cd vim-l9/
[shetye#dev03 ~/.vim/vim-l9]$ls
autoload doc plugin
Also i tried copying the same in my home directory. vim however does not detect this plugin.
:fuf-usage
E492: Not an editor command fuf-usage
:FufBuffer
E492: Not an editor command FufBuffer
I tried adding the directory ~/.vim/vim-fuzzyfinder, ~/.vim/vim-l9 to the $PATH env variable. That did not help either.
Any ideas on how to get fuzzyfinder going ?
You should install it correctly to make it work. This is the file structure you should have:
~/
+-.vim/
+-autoload/
+-doc/
+-plugin/
Once you get to that point, you are supposed to type this command in Vim:
:helptags ~/.vim/doc
The .vim directory structure that you have created is a mix between traditional Vim (where all plugins are mixed together into single .vim/autoload/, .vim/plugin/, etc. directories) and the separation (into .vim/bundle/<pluginname>/autoload/) created by package managers like Pathogen or Vundle.
Either stick to the original layout (even though there are many proponents for the new package structure, the old one works just fine; it's just not as easy to uninstall a plugin), or install one of the mentioned package managers and adhere to their prescribed layout.

VIM installation on OS X 10.8 Mountain Lion can't be found on ~/.vim/

I'm pretty new on OS X and VIM, and I just tried to install MacVim (I downloaded snapshot 66 from github, which is actually build 7.3.754).
The problem is that when I was trying to install Sparkup (https://github.com/rstacruz/sparkup), I found that the installation folder is not on ~/.vim/
I tried this on Terminal:
ls ~/.vim/
but it always returned ls: /Users/andreoentoro/.vim: No such file or directory
Any insights on what I do wrong here? I'm not really used to terminal though I am pretty good at working on DOS command, but it's totally different.
Many thanks in advance.
This folder, its subfolders (like plugin, doc, etc.) and your ~/.vimrc are not created by Vim. You must create them yourself:
$ cd
$ mkdir .vim
$ touch .vimrc
Here is what you should get if you follow the plugin's instructions:
/Users/andreoentoro/.vim
|-after
|---plugin
|-----snipMate.vim
|-autoload
|---snipMate.vim
|-doc
|---snipMate.txt
|-ftplugin
|---html_snip_helper.vim
|-plugin
|---snipMate.vim
|-snippets
|---(many files)
|-syntax
|---snippet.vim
Just copying ftplugin won't be enough.

Resources