syntax-check a VimL script - syntax

I have a sizable vim script (a .vim file, in viml syntax). I'd like to check (but not execute!) the file for simple syntax errors.
How do I accomplish this?
I just want a very rough syntax check. Something along the lines of perl -c or pyflakes.

Here is a syntax checker for VimL.
https://github.com/syngan/vim-vimlint/

I don't think (I'm relatively sure, as much as one can be) one exists. VimL is an internal language of Vim (and only Vim), and there aren't many tools developed for it.
I tried searching on vim.org and several other places, with no luck. Not suprising, because I've never heard of one either.
So you're either stuck with running the script, or switching to an outside language like Python, Perl or Ruby.

https://github.com/osyo-manga/vim-watchdogs
vim-watchdogs, apparently, is a syntax checker for vim, it says that it supports many languages, including vimL
if you use vundle, you can just drop this into your vimrc:
Plugin 'git://github.com/osyo-manga/vim-watchdogs.git'
..and then run:
:PluginInstall
..to set it up (vundle is a very nifty plugin manager) If you have syntastic, you might want to be careful and disable it first, and then see if it is an adequate replacement (since it says it supports all those languages anyway).
It is a safe bet that when you have multiple syntax checkers going, you will need to put your "dogs on a leash", so to speak; by configuring one to check languages that the other one does not, and vice-versa. If you do not, there will be at best collisions, duplications, or misdirections. At worst, you will have all of the above and more.
Make sure that you always backup your ~/.vim directory (or your VIMRUNTIME directory if you install things on a global level), you will be glad you did. Hope that helped you or someone else out, good luck! Sorry you had to wait 7.5 months for a response, heh :)

There's now a second option: vim-lint (as opposed to vimlint)

Related

How to change the default shortcuts for copy/paste in urxvt?

I'm trying to set up copy/paste actions using ctrl+shift+c/p like it is done in GNOME terminal but for urxvt. I didn't find any simple solution - it seems like it always requires scripts, hacks etc which gets me annoyed when it comes to such a basic things. That's why I'm wondering if it is possible to just change/add some entries in ~/.Xresource to move the default behavior from ctrl+alt+c/p to ctrl+shift+c/p - since the former already works as expected.
Also, there is a lot of notions regarding clipboard itself: X calls them "selections" rather than "clipboards"; there are PRIMARY and CLIPBOARD selections; etc. I don't really understand all these subtleties - so feel free to be verbose!
I use Xorg server with i3 WM if it makes sense and rxvt-unicode v9.22 - released: 2016-01-23
Contrary to Thomas' answer, it looks like you can. In the same question he referenced Spencer and Enno both mention that you can bind the native eval extensions in your .Xresources file. This would look like the following:
URxvt.keysym.Shift-Control-V: eval:paste_clipboard
URxvt.keysym.Shift-Control-C: eval:selection_to_clipboard
To disable the previous keybindings, you'll also need:
URxvt.keysym.Control-Meta-c: builtin-string:
URxvt.keysym.Control-Meta-v: builtin-string:
You can reload the file with:
xrdb -load .Xresources
You'll need to restart rxvt for the changes to take effect.
short: no, you can't
longer: I pointed out in Rebinding CTRL-ALT-[C|V] to CTRL-SHIFT-[C|V] in URxvt >= 9.20 that the binding for these is essentially hardcoded in urxvt without an easy way to change them (aside from external scripts or modifying the program itself).

Vim and Ruby - matching "do"s and "end"s?

I'm sure we're all familiar with the "unexpected kEnd" problem. They are always (to me) a lot of trouble to track down, because Vim doesn't match "do"s and "end"s. (And, obviously, other elements that end with "end", like "if")
Is there a way to configure Vim to show these matches to help make debugging easier?
If you are using a recent vim (I'm using 7.4), the built-in matchit macro works well with ruby code.
Simply enable it by adding the following to your .vimrc
runtime macros/matchit.vim
Hit % to match do/end combos and many others in ruby files.
I use this macro and then add this to my vimrc to enable it:
" % to bounce from do to end etc.
runtime! macros/matchit.vim
When I want to find the matching end for a do, I cursor over the do and hit %.
"endwise" is a pretty nice vim extension that adds them automatically, which I found greatly reduces the amount of missing ends. etc:
http://www.vim.org/scripts/script.php?script_id=2386
I use this matchit clone, that can be installed easily with vundle.

Get rid of Hungarian notation in C# code in automated manner?

I have a large codebase that uses Systems Hungarian for most variable names, which basically means I have lots of objQueue's, objCommon's, dtDataSet's et cetera.
Is there any way to convert most of them? Especially, I want to get rid of irritating obj ones that have absolutely no sense, make variable names seem similar and the code completely unreadable.
There was a similar question but it was asking whether it's worth to do the replace.
Answers like “leave it as is” are not of any use to me because I'm definitely sure I need to do this.
The codebase is really large, and I don't want to rename variables one by one. Neither do I want to run Find & Replace because I'll get false hits and mess up code even further.
Is there any automated tool to make such replacements in Visual Studio? Some addin for Resharper, whatever?
Alas, but it seems like there is no bulk rename tool for C#.
Please correct me if I am wrong.
One solution would be to use something like Visual Assist's rename feature.
Other than that, a very careful search'n'replace (with a build between each modification followed by a check-in into source-control).

SWeave with non-R code chunks?

I often use Sweave to produce LaTeX documents where certain chunks are produced dynamically by executing R code. This works well - but is it also possible to have code chunks that are executed in different ways, e.g. by executing the code in the shell, or by running Perl, and so on? It would be helpful to be able to mix things up, so I could do things like run some shell commands to fetch some data, run some perl commands to pre-process it, and then run R commands to analyze it.
Of course I could use all R chunks and use system() as a poor-man's substitute, but that doesn't make for very pleasant reading in the document.
The new new thing (for multi-language, multi-format) docs may be dexy.it which for example these guys at opengamma.org use as the backend.
Ana, who is behind dexy, is also giving a lot of talks about it so also look at the dexy blog.
It's not directly related to Sweave, but org-babel, which is part of Emacs org-mode, allows to mix code chunks of different languages in one file, pass data from one chunk to another, execute them, and generate LaTeX or HTML export from the output.
You can find more informations about org-mode here :
http://www.orgmode.org/
And to see how org-babel works :
http://orgmode.org/worg/org-contrib/babel/
There is certainly no easy way to do this other than through either foreign language interfaces from R (maybe through inline if it's supported), or system(). For what it's worth, I would just use system(); that should be easy enough.
You can see this previous question about having a Sweave equivalent for Python, where one of the respondents actually creates a separate interface. This can give you a sense what what it would take to embed other languages which may not already be supported. At a minimum, you have to do major hacking on the Sweave driver.
Do you know emacs" org-mode and, more specifically, Babel? If you already know Emacs or are willing to switch to Emacs, then org-mode and Babel are the answer to your question(s).
For instance, I am currently working on a document which contains some shell-scripts, does computations with R and creates flow charts with dot (graphviz). Org-mode can export a variety of formats, e.g. LaTeX (that's what I use).
There is the StatWeave project which uses java rather than R to do the weaving, but will run multiple programs instead of just R. I don't know how hard it would be to get it to do Perl or other programs like that, but the homepage indicates that it already works with R, SAS, Stata, and others:
http://www.cs.uiowa.edu/~rlenth/StatWeave/

What are the things you would like improved in the Ruby language?

What are the things you wish Ruby (and more generally the Ruby community) would improve?
I read somewhere that Ruby is the love-child of Smalltalk and LISP, with Miss Perl as the Nanny.
I have a lot of respect for Ruby's parents, but I'm not sure I like the influence Miss Perl had on the child. Specifically, I don't like the predefined variables: I need a cheat sheet to know what they mean. You could say "just don't use them". Well, I don't... but other people do. And when I download a plugin on the Web, I have no choice but to fetch my cheat-sheet if I ever need to go and touch the source code. I just wish they would remove those from the language itself.
Also, I think that Ruby is too much of a moving target. My code breaks on every new Ruby upgrade, even on minor releases. This is true also of Ruby on Rails and most Rails plugins I have worked with: they just change all the time, and nobody seems to care whether the changes break everything or not. IMHO, although I love a lot of things in Ruby, this lack of stability is almost a show-stopper.
I wish people would consider backward compatibility between minor releases as an unbreakable rule when releasing a new language (or library or framework) version.
I wish that some of the lesser used modules of the standard library were documented.
Make require-ing files less painful. Don't ask me how, but maybe have one file dedicated to knowing the paths involved and just get rid of the relative path crud from everything else.
Getting rid of the artificial distinction between Modules and Classes would be nice.
Both Modules and Classes are Namespaces. Modules are also Mixins, while Classes aren't. Classes can also be instantiated while Modules can't. This distinction is unnecessary. Just get rid of Modules and allow Classes to be used as Mixins.
An example of a language where this works is Newspeak.
I'd appreciate being able to install ruby 1.9 as an RPM rather than having to use the source.
Make Ruby completely Message Sending based, get rid of everything that is not a message send: local variables, global variables, instance variables, class hierarchy variables, constants, magic globals, magic constants, builtin operators, builtin keywords, even literals. See Self, Ioke or Newspeak for the incredible power and elegance this gains.
I wish they would get rid of the predefined variables: $!, $&, $+, etc.
I would like to have support for static compile-time metaprogramming. The Converge Programming Language might be a good starting point.
Replace the Mixin system with a Traits system.
Replace Exceptions with a Common Lisp style Conditions system.

Resources