How can I test my vim plugin? - macos

Hi guys : I recently (accidentally) removed all folders/files from my .vim folder in mac os x (home directory).
I am trying to add in the Clojure Vim plugin (VimClojure) - its simply a folder which you are supposed to "drop into .vim/plugins".
I have added it, but I don't see any changes to the syntax highlighting when I launch vim. I'm not sure wether vim "sees" the plugin or not.
I'm on OS X .
Any ideas on how to debug the plugin ? In particular
1) How does VIM look for plugins ?
2) Are there files which need to be in $HOME/.vim/ ?
3) Is it sufficient to simply dump the unzip a new plugin file into $HOME/.vim/plugins when installing a standard vim plugin ?
Thanks

About debugging: in order to see whether vim has loaded your plugin you can use :scriptnames and also breakadd file /path/to/your/plugin (or breakadd file *your_plugin_name.vim: I never used absolute paths so I do not know what breakadd will do in this case). Other questions:
Described in :h initialization, precisely :h load-plugins.
Vim does not need any files at all (except vim executable, used shared libraries, dynamic linker and the kernel of course).
Follow installation instructions. Normally plugins are either extracted to ~/.vim or distributed as a singe file that should go to either ~/.vim/plugin (no s!), ~/.vim/colors, ~/.vim/ftplugin or such. I guess you should try to extract it to ~/.vim/plugin, but if archive contains some special directories like plugin/, ftplugin/, colors/, after/ (see /usr/share/vim/vim73 for a list) it is likely that it should go to ~/.vim. Also consider using vim-addon-manager, if plugin was posted on vim.org VAM is likely to be able to install it.

A few points.
How does vim look for plugins? See :help startup so see where and when vim looks for files to load.
Not really. Anything there is just personal customization. Vim will run fine without a .vim folder.
That all depends on the plugin. It sounds to me like the VimClojure plugin may be a little misleading. Do you have a link to the source you are using?
In any case, the first step I always take when attempting to debug a script is check the output of :scriptnames. This command will show you what scripts vim has loaded for the current session. If you see none of the files shipped with VimClojure, you probably made a mistake during the installation.
Another tip is that you really should look in to using a plugin manager such as vundle or vim-addon-manager, or at least the runtimepath manager pathogen. This seems to be the way of the future for vim configuration these days and it makes installing and managing plugins much easier. They also help to keep your .vim folder clean and organized.

The VimClojure directory should either be extraction on top of your .vim folder, or in a bundle folder if your using something like pathogen (which you should!). If you're starting from scratch, consider starting with vimclojure-easy (not to toot my own horn) which is a basic, full install of VimClojure with instructions.

Related

Clarify how installing Bazel on windows works?

So I'm following the install instructions for Bazel 2.0, and basically it seems like all I have to do is download the ".exe" file, add it to the path, and then I can use it from windows powershell (probably bash too, although I haven't tried). What I want to know is - does the ".exe" file do any manipulation of my system (outside of the obvious compiling work) or download anything else under the hood? I ask because I want to try it out while working on a restricted computer system, as I'm sure some of you have encountered before.
It will extract itself into the location where it also (unless configured otherwise) keeps its build output. By default this would be under current user's home directory. The location can be changed with --output_user_root parameter or TEST_TMPDIR environmental variable. You can check out the docs for more detailed description.
Adding to Ondrej K.'s answer:
Yes, you just download the .exe and add it to your PATH. Do not run it from Bash though, because it's broken. (I'm linking to the documentation at master as of 2020-02-28 and as of 2.1.0 being the most recent version. The current master will become the release doc for 2.2.0.)
Yes, Bazel will download stuff. This includes tools for the languages you build (e.g. Java), and also external dependencies of the project.
Yes, Bazel will write to disk even if you just run it once: as Ondrej K. wrote, it will extract itself to a directory.
Do not set TEST_TMPDIR to tell Bazel where to run. Setting this envvar will make Bazel believe it's running inside a test, and it will significantly reduce its resource use and change its behavior in subtle ways you probably don't want. (If you want to limit its resource use, you can do so with several flags, see --jobs and --local_ram_resources, --local_cpu_resources.)

MobaXTerm how to create your own plugin?

Problem
I see all these plugins from MobaXTerm, but I don't know how to make my own. I see no links to any tutorials or whatever. Is there even a way to do it?
What I really want (XY problem)
I want to create my own commands. I want these to be available on each server I go to and I don't want to add each of these to my bin and .bash_profile etc. I think plugin is the way to go.
Even more background
I am not that good in shell programming, but I can program java. I created a jar which handles my commands. So I have created my own linux script on my local environment to test all these things. They work, but I dont want to 'export' them to other servers. Seems like a bad idea to do.
MobaXterm plugins are just Windows or Cygwin executables packaged in a .mxt3 file which is just a standard ZIP archive with a specific structure.
Read this from the MobaXterm FAQ:
I would like to create a new plugin for MobaXterm. How can I do that?
Download an existing plugin file (for instance "Midnight commander")
Rename plugin extension from ".mxt3" to ".zip"
Open the ".zip" file You will notice that creating MobaXterm plugins only consists in putting the required commands (executables, libraries
and configuration files) into a ZIP file, keeping the same folders
tree than in MobaXterm ("/bin", "/lib", "/usr", "/etc").
If you want to add a simple Windows program (exe file), you will just have to copy the executable file into the "/bin" directory,
create the ZIP archive, rename it to ".mxt3" and put it in the same
directory than MobaXterm executable.
If you want to add a Linux program, you will have to get it from the Cygwin project or to recompile it using make, gcc, g++ or other
compilers that are available from the MobaXterm "Development" plugin.
Remember MobaXterm's terminal is just Cygwin, so you may be able to cross compile some packages within Moba by simply installing the necessary compiler tools.

Two vimfiles directories. Where do I install my plugins?

I'm using Windows 10.
I want to give Vim another shot after having some troubles with it in the past. I'm eager to learn it, but I'm confused. I gave a pretty thorough search to find my answer before I resorted to posting this here, but what is the proper way to install my vim plugins. I see two vimfiles folders in two different directories.
One in the $HOME directory.
C:\User\[USERNAME]\vimfiles
And one in the installation directory.
C:\Program Files (x86)\Vim\vimfiles
Is there a reason for there being two of these ? What's the best directory to install my plugins ?
It is related to 'runtimepath' param. Read :help 'runtimepath' for more info . C:\Program Files (x86)\Vim\vimfiles is system folder with default plugins which are shipped with vim itself. C:\User\[USERNAME]\vimfiles is your local runtimepath. And there you should put your plugins. This way if you have multiple users they all will have own vim environment to work in. If you want you can even set different runtimepath but this is whole another question))
C:\User\[USERNAME]\vimfiles is your vim runtime files and C:\Program Files (x86)\Vim\vimfiles is Vim's runtime files. As long as a feature is present in your vim runtime files and vim request it, it will load them and if its not present there, then it will fallback to his runtime path to find it (i.e. C:\Program Files (x86)\Vim\vimfiles ). So you should always install your plugins, colorschemes, syntaxes, ... in your vim runtime files and also back it up in a safe place and never touch vim's runtime files.

After much reading, I still can't get Pathogen to load a plugin under Windows

For gVim 7.3.46 on Windows 7 64-bit fully updated (I run gVim 7.3.46 because it adds a reliable instance of "Edit with Vim" to the Windows context menu.)
Despite having read an abundance of articles (many of them which repeat the others) I can't get Pathogen to load a vim plugin that already works fine if I don't use Pathogen.
The problem seems to be the location of Pathogen's "bundle" folder as follows:
· IF I place the mru.vim (Most Recently Used Files) plugin in "D:\Program Files (x86)\Vim\vim73\plugin", THEN MRU works just fine — typing :MRU returns a list of recently used files
. IF I place mru.vim in a folder named "bundle", then place the bundle folder in "D:\Program Files (x86)\Vim\vimfiles", or other locations listed below, typing MRU returns "E492 : Not an editor command : MRU"
MY ENVIRONMENT:
· In Windows 7 64-bit, Vim / gVim 7.3.46 is installed in "D:\Program Files (x86)\Vim\vim73\gvim.exe" (Yes, "D", not "C").
· In gVIM, typing :e $VIM returns the following four-lines:
../
vim73/
vimfiles/
_vimrc
· In "D:\Program Files (x86)\Vim\vimfiles\autoload\", I have pathogen.vim. In this location gVim starts without error, and typing :pathogen#helptags() returns no error (one article I read indicated that command was one way to tell if Pathogen was installed correctly).
· My _vimrc file includes the lines:
syntax on
execute pathogen#infect()
filetype plugin indent on
MY PROBLEM:
I've tried copying the bundle folder containing mru.vim to:
· D:\Program Files (x86)\Vim\vimfiles (reputedly the "correct" location for Windows)
· D:\Program Files (x86)\Vim
· D:\Program Files (x86)\Vim\vim73
Multiple articles identify the first entry in that list as the correct location for the bundle folder in a Windows system. That is to say, that in Windows unlike *ix, one evidently does NOT "bury" the bundle folder somewhere down in the *ix .vim folder, or Windows ..\users[userName] folder, or the like(?)
All of those locations for "bundle" produce the same response to typing :MRU — "E492 : Not an editor command : MRU".
I'm at wits end. Any ideas anyone?
(By the by, thanks but I do NOT want to use Vundle / Github / Curl or any other network related solution. I don't use all that many gVim plugins, and the ones I do use I want to download and copy into the bundle folder myself rather than have an unwanted network process involved in that.)
Cheers & thanks for your help,
Riley
SFO
mru.vim should be placed in the bundle folder such that the path is
D:\Program Files (x86)\Vim\vimfiles\bundle\mru\plugin\mru.vim
Although it should really be placed inside vimfiles in your home directory not Program Files
$HOME\vimfiles\bundle\mru\plugin\mru.vim
Pathogen makes it so that every folder in bundle is part of the vim runtime path. This allows every plugin in the bundle folder to have a clean environment for it to store all related files.
For example if you had two plugins that had more than one file (for example they both came with documentation).
Then the file structure of the vimfiles folder would look something like this.
vimfiles/
plugin/
plugin1.vim
plugin2.vim
doc/
plugin1.txt
plugin2.txt
But what happens when you want to remove one of the plugins you need to go find each and everyone of the files (and you might miss some).
With Pathogen installed your directory structure would probably look something like this.
vimfiles/
bundle/
plugin1/
plugin/
plugin1.vim
doc/
plugin1.txt
plugin2/
plugin/
plugin2.vim
doc/
plugin2.txt
Pathogen appends all of the folders under the bundle folder to the vim runtime path. This allows vim to find the files and vim is none the wiser that its not in the usual place.
This also allows for easier removal of plugins. You don't have to go searching for all the files that came with the plugin you just need to remove the relevant folder from the bundle folder.
Just for completion sake. (You don't need to do this if you don't want to)
Installation.
If you used git you can now go to the github page for vim-scripts and find the plugin you want. Since you were interested in using mru the link to the mru plugin is https://github.com/vim-scripts/mru.vim
Now to install the plugin you just need to go into the bundle folder and run
git clone https://github.com/vim-scripts/mru.vim
All the scripts in the vim scripts repository have the proper structure that pathogen is expecting so after running that one command you are done installing the plugin.

Emacs in Windows

How do you run Emacs in Windows?
What is the best flavor of Emacs to use in Windows, and where can I download it? And where is the .emacs file located?
I use EmacsW32, it works great. EDIT: I now use regular GNU Emacs 24, see below.
See its EmacsWiki page for details.
To me, the biggest advantage is that:
it has a version of emacsclient that starts the Emacs server if no server is running (open all your files in the same Emacs window)
it includes several useful packages such as Nxml
it has a Windows installer or you can build it from sources
And concerning XEmacs, according to this post by Steve Yegge:
To summarize, I've argued that XEmacs has a much lower market share, poorer performance, more bugs, much lower stability, and at this point probably fewer features than GNU Emacs. When you add it all up, it's the weaker candidate by a large margin.
EDIT: I now use regular GNU Emacs 24. It also contains Nxml, can be installed or built from sources, and with this wrapper, the Emacs server starts if no server is running. Cheers!
Note that GNU Emacs for Windows comes with two executables to start Emacs: "emacs.exe" and "runemacs.exe". The former keeps a DOS-Prompt window in the background, while the latter does not, so when if you choose that distribution and want to create a shortcut, be sure to launch "runemacs.exe".
Carl
Easiest way to find where the user init file is:
C-h v user-init-file
Easiest way to open it is (in the scratch buffer):
(find-file user-init-file)
and hit C-j to eval
Well, I personally really like what I have been using since I started with Emacs, which is GNU Emacs. It looks like it is built for windows too. That link also answers your .emacs file question. Here is a place you can download it. You should probably get version 22.2 (the latest).
If this is your first time, I hope you enjoy it! I know I absolutely love emacs!
I run it under cygwin. That also gives me a Unix-ish environment for shelling out commands with meta-!
I use a vanilla version of emacs. In my experience, this is very stable, simple, does everything I need, and doesn't add a bunch of bloat that I don't need. The .emacs file can be placed in C:\Users\YourName if the HOME environment variable is set. This is a great way to handle it because it works on a user basis and mimics emacs behavior on Linux. You can download the zip from any gnu software repository mirror in the emacs/windows folder. You want the file that is named emacs-xx.x-bin-i686-pc-mingw32.zip.
There are some great instructions for configuring emacs for windows here. Basically, "installation" boils down to:
Download emacs from a gnu mirror at emacs/windows/emacs-version-bin-i686-pc-mingw32.zip, and extract the zip to an appropriate folder. Preferably C:\emacs to avoid spaces in the filename.
Set the HOME environment variable to C:\Users\username (or whatever you want). Make it a user-only variable (if it is username-specific). This is where your .emacs file goes.
If you want a start menu or desktop shortcut, create a shortcut to bin/runemacs.exe.
Add c:\emacs\emacs-xx.x\bin\ to your path (user or system), so that you can run it from the command line.
Also, you can consider emacs-w64 for 64bit windows systems:
emacs-w64: http://sourceforge.net/projects/emacsbinw64/
See http://www.gnu.org/software/emacs/windows/ntemacs.html. Section 2.1 describes where to get it, and section 3.5 describes where the .emacs file goes (by default, in your home directory, as specified by the HOME environment variable).
I've run both GNU emacs and Xemacs on windows. I used to use it as my primary editor, email client etc, but not it's "just" an editor.
When I recently reinstalled to Vista I installed the latest GNU version. It works fine. So does Xemacs, but it does look like GNU have got their sh*t together so Xemacs isn't as compelling anymore.
I suggest you to use development version of GNU Emacs 23, which is pretty stable and to be released relatively soon. You can get weekly binary builds from the link below.
Latest GNU Emacs as a zip archive
I have a portable version with .emacs configure ready, which setup org mode, I-do, etc. It also included org sample file. I think that is a better start point for new comers.
Basically run with runemacs.bat and everything is ready.
http://nd.edu/~gsong/portable_emacs.html
I've encountered this problem, and discovered the fault (at least in my case) to be the existence of c:\site-lisp\site-start.el, a file that was created when EmacsW32 was installed, and which was not removed when I uninstalled it. (Vanilla GNU Emacs for Windows has c:\site-lisp in its load-path, and will try to load this file, which somehow winds up triggering that error.)
Solution: removing that whole directory (c:\site-lisp) worked for me, but you should just be able to remove the site-start.el file.
The best place to start, to get an MS Windows binary for GNU Emacs is ... GNU Emacs:
http://www.gnu.org/software/emacs/
(Oh, and how did I find that URL? From the Emacs manual, node Distribution. If you have access to Emacs anywhere, that's the place to go for such information.)
On that page you will see everything you need to know about obtaining Emacs. In particular, you will find a section called Obtaining/Downloading GNU Emacs, which links to a nearby GNU mirror. Clicking that link takes you to a page of links that download all Emacs releases since release 21.
More imporantly here, on that page of links you will also see a directory link named windows. Click that to get a page of links to Emacs binaries (executables) for MS Windows. That is the page you want.
Knowing the above information can help when you need to find the page again, if you haven't bookmarked it. But here is the final URL, directly: http://mirror.anl.gov/pub/gnu/emacs/windows/
When forced to use Windows, I ...
Download "Emacs for windows", and save it in some directory (henceforth referred to as EMACS_SOMEWHERE)
Drop a .cmd file in "Startup" to map, "My Documents" to H: drive with subst, or if "My Documents" resides on a remote server, I use the "Map Network Drive" thing in Explorer to have "My Documents" named H:. Then I create an environment variable named HOME in Windows and give it the name of "H:\". Now I can drop my .emacs file in "My Documents" and it will be read by emacs when it launches.
Then I create the H:\bin directory. Then I add "H:\bin" to my Windows "Path" environment variable.
Then I create a H:\bin\emacs.cmd file. It contains one line:
#call drive:\EMACS_SOMEWHERE\emacs-23.2\bin\emacsclientw.exe --alternate-editor=c:\programs\emacs-23.2\bin\runemacs.exe -n -c %*
This is a fair bit of work, but it will enable me to run the one and same emacs from either a windows command prompt or from a cygwin command prompt, provided that /cygdrive/h/bin is added to my cygwin PATH variable. Haven't used this setup for a while but as I recall, when I call the emacs.cmd with a new file over and over, they all end up being buffers in the one and same emacs session.
There was https://bitbucket.org/Haroogan/emacs-for-windows with the latest Emacs 25, but the whole page has been removed.
The benefit of this build and the emacs-w64 above is that they come with jpg, png, tiff DLLs as well as lxml DLL, which is needed for the new eww web browser.
I prefer to run Windows 10 + VcXsrv + Emacs 25 client in WSL. Emacs is my shell.
To access the .emacs file for your profile the easiest way is to open up emacs. Then do C-x C-, type in ~USERNAME/.emacs (or you can use init.el or one of the other flavours). Type your stuff into the file and C-x C-s (I think) to save it.
The actual file is located (in Windows XP) in c:\Documents and Settings\USERNAME.emacs.d(whatever you named the file), or the equivalent spelling/location on your system.
You can download GNU Emacs NT from here direct. It works fine in windows, make sure you create a shortcut to the runemacs.exe file rather than the emacs.exe file so it doesn't show a command prompt before opening!
XEmacs is less stable than GNU Emacs, and a lot of extensions are specifically written for GNU. I would recommend GNU > X.
You can place the .emacs file in the root of the drive it's installed on. Not sure whether you can add it elsewhere too...
Im using emacs32, I only have one problem with it really:
https://stackoverflow.com/questions/3625738/comint-previous-matching-input-in-emacsw32-is-not-interactive
If You Mean Emacs as Latex Editor for Windows 7.
Emacs4LS (Emacs 4 Latex Support under Windows 7) for newcomer for Emacs.
http://chunqishi.github.io/emacs4ls/
Easy Steps to Install.
Plugins Built-In.

Resources