How to see vimrc files used during startup - startup

I've moved my vimrc file out of the home directory to pathogenize the setup, but it looks like my vim is still picking up a redundant vimrc file that I made somewhere. Is there some variable in vim that I can echo that'll show what files were used during startup?

:scriptnames lists all sourced script names, in the order they were first sourced.

Look for the $MYVIMRC variable:
:echo $MYVIMRC

After starting vim, you can type
:set runtimepath
See the docs here: http://vimdoc.sourceforge.net/htmldoc/options.html#'runtimepath'
I don't think #skinp's answer is necessarily sufficient. the runtimepath variable is the very definition of all places vim looks

Additionaly, you can launch Vim with
$ vim --startuptime filename
which should write a list of loaded scripts (including vimrc) and their respective processing time to file filename.

Related

How do I name the .bowerrc file?

This MEAN-stack tutorial describes using Bower to install AngularJS in your public folder. One of the steps describes creating a file called ".bowerrc" in your test-app folder. However, Windows won't let you create a file without a name. How do I accomplish this on a Windows system?
on the command line (make sure to cd into your working directory), issue this command:
touch .bowerrc
This will also work for other files common to webdev like .htaccess and .gitignore
Note: If you haven't installed git bash for windows, you may not have support for the touch command. In that case (as mentioned in one of the comments here), the easiest way to accomplish this is via the cli with:
echo "" > .bowerrc
To create a file that starts with a "." in Windows, you just need to add a trailing ".".
So, simply name your file ".bowerrc." instead of ".bowerrc".
See https://superuser.com/questions/64471/create-rename-a-file-folder-that-begins-with-a-dot-in-windows for more information and more detailed solution if this doesn't work for you.
Another way to accomplish this is through Notepad++.
Create the file in Notepad++
Set the encoding to "Encoding in ANSI" (click "Encoding" in the menu bar)
Save the file as .bowerrc (change the "Save as type:" to . which is one list item up from *.txt)
Simply rename the file you created:
C:\project> ren bowerrc .bowerrc

Opening a db/migrate/* file more effectively? Wildcard to complete the beginning of the name of the file?

Working from a bash shell and utilizing vim, I generally have a pretty effective workflow. However, when I attempt to access files in the db/migrate directory of a rails project, it becomes very tedious to access the files as the each contain a long integer at the being of their file names. I've tried vim db/migrate/*name_of_migration.rb but to no avail.
Is there a way to access files via wildcard of in this manor?
If you're using vim-7.3, then you can do this from inside vim:
:set path=/path/to/your/project/root/**
:find migrate/*cr<tab>
and vim will show you the possible candidates for completion.
If you're typing the name of the migration correctly, I assure you that the * will match the leading digits.
For example, from the root of your project,
$ vim db/migrate/*create_users.rb
will open 20111123142812_create_users.rb.
Otherwise, my preferred method is to use
$ vim db/migrate
to "open" the directory in vim, and use the in-vim navigator to select the migration you're interested in from the list of files.

Setting LD_LIBRARY_PATH in Cygwin

I am following the tutorial : http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jniexamp.html
when I reach the part where I am supposed to set the library path :
Unix or Linux:
LD_LIBRARY_PATH=`pwd`
export LD_LIBRARY_PATH
Windows NT/2000/95:
set PATH=%path%;
Neither of these work in cygwin. I keep getting an error when trying to run my program.
Cygwin doesn't use LD_LIBRARY_PATH, it looks for shared libraries in PATH, so try:
export PATH=`pwd`:$PATH
That will add the current directory to the front of the PATH.
Is that
LD_LIBRARY_PATH=$(pwd)
and you just messed up the html, or are you really running:
LD_LIBRARY_PATH=pwd
If the latter, try adding the $() to get the current working directory into the path. Also, you can
echo $LD_LIBRARY_PATH
to ensure it contains what you want. You might consider doing
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)
to avoid discarding previous contents of the path.

vimrc - current working directory

I would like to be able to access the current working directory in my vimrc.
For example, I can access the current file by using %.
Specifically,
I have the following line in my vimrc:
map ,l :!latex %
When it runs everything works fine, except the resulting dvi and other files are stored in my home directory instead of my current working directory.
Any suggestions?
See :help autochdir. Vim can automatically change the current working directory to the directory where the file you are editing lives.
Otherwise, if you want to do this manually, see :help cd and :help lcd.
see :he filename-modifiers
:!latex % -output-directory %:h
Most likely, you're running vim from your home directory, so it is the current for him. The latex command, being invoked from vim, also therefore has the home directory as current.
You probably know this, and want just to extract path from the filename and supply it as an argument to -o option of the latex command. Just use the shell capabilities:
:!latex % -output-directory `dirname "%"`
I am not sure that it's -output-directory option, but you get what you asked for--a directory name of the file you're editing.

To get the current $USER in LaTeX

My friend has the following in his computer in a LaTeX document
\includegraphics[width=13.0cm]{/Users/max/Dropbox/2_user_cases.png}
I would like to have a variable for the username such that we can collaborate faster.
Pseudo-code about what I wont
\includegraphics[width=13.0cm]{/Users/`echo $USER`/Dropbox/2_user_cases.png}
How can you have such an command inside LaTeX?
I'm not sure you can access envvars from LaTeX. As Rutger Nijlunsing has said, you can try "~/" since it is an alias to "/Users/<username>".
If there are other envvars that you need to access, my suggestion is using Makefile to 'compile' the .tex (or a shell script) calling sed to replace such word.
sed -i "s/max/$USER/" file.tex
latex file.tex
bibtex ...
latex ...
in the graphicx package, you can define a folder for latex to look for all your images in, like this:
\graphicspath{{images/}}
In this particular configuration, latex looks for a folder in the same directory as your file called "images."
I don't see why you'd want to use a full path just to get image in...
Make a folder, put your .tex source file in there, create a folder for your images.
Stick you work in some sort of revision control system (git, SVN, etc etc.)
Commit often, and you're on your way.
use ~ for your homedirectory (which is probably /Users/$USER):
\includegraphics[width=13.0cm]{~/Dropbox/2_user_cases.png}

Resources