How do I create skeleton files, or templates, for MacVim - templates

I have seen instructions about creating a "skeleton" file in vim. This involves creating the file, naming it "tmpl" plus the extension of the file type you are targeting (ex: tmpl.html), saving it to the "skeleton" directory, and then editing the vimrc file.
But, in MacVim, I don't see a "skeleton" directory anywhere. Googling, etc., has returned no helpful information.
Can someone point me to a helpful tutorial/white paper/whatever to walk me through this process for MacVim?
I am determined to develop some skills with Vim/MacVim!
Thanks

I feel dirty giving this as an answer (because I've never done it), but googlin' gave me this: Vim Recipes: Using Templates.
Seems like you make your own skeleton directory and point the line for your .vimrc file to it.

There are a multitude of vim plugins that can handle this task. I use snipMate to perform tasks like this. You can define snippets for each file type or globally. The best part about the snippets is that you can keep hitting tab while it takes you to each "variable" within the snippet so that you can fill in the missing information quickly.

Related

How to organize a R project structure in interaction with using R-markdown

I've been reading everywhere about the need to organize your R projects and also to use Rmarkdown.
I see an incoherence I can't solve.
Suppose I set for the following standard organization:
Project
data
raw-data
code
docs
out
reports
and also home of setwd().
Now I want to use Rmarkdown with my main project file called My_project.Rmd
I create it at the root project level, then I get at every knit rendition 2 directories created My_project_cache and My_project_files on to of every .hml file rendered that conflicts with the above structure.
This is very impractical.
I tried setting the options of output to avoid this, per this tip, but it fails on the cache directory, and I did not succeeded in setting Knit options to bypass it. And no-one seems to be bothered by this question making the solution look like a dead-end.
The other solution is to put My_project.Rmd directly in reports/ but it feels a little awkward and on top of that it breaks the above project structure by imposing ../ paths everywhere.
The third solution is to work with Rmd format, only at the end of a project, but this seems a little defeating the purpose of documenting everything neatly in the first place.
There may be a 4th solution using R Notebook feature, but it works until you decide to try to finalize your "final" document , which of course is never really final.
What am I missing here ?
For reference, I'm using RStudio on a Mac.

.How do you create a new file in Ocaml and where does it store it?

I can't seem to find the answer, how do you create a new file in Ocaml? Do you edit your file in the terminal? Where does the source code appear?
I think you're asking how to write code in OCaml, i.e., how to create an OCaml source file. (This isn't completely clear. You could be asking how to write OCaml code that creates a file.)
The details of creating OCaml source depend on your development environment, not on the language itself. So there is no one answer.
The general answer is that you can use any tool you like that knows how to create a text file. If you like working from the command line (as I do) you can work in a terminal environment and run some kind of vintage text editor from the last millennium (as I do). If you like a GUI environment, you can run some kind of "programmer's editor" from the current millennium, or really any kind of editor that creates basic utf-8 files (or even ASCII files).
Generally the editor will have to be told where to store the files that you edit. You would probably want to make some kind of folder for the project and make sure you store the text files in there.
I hope this helps! If you have any programmers nearby, they can probably get you started a lot faster than asking on StackOverflow.

When a file changes, I'd like to modify one or more different files

I've been scouring the web for hours looking for an approach to solving this problem, and I just can't find one. Hopefully someone can fast-track me. I'd like to cause the following behaviour:
When running ember s and a file of a certain extension is changed, I'd like to analyze the contents of that file and write to several other files in the same directory.
To give a specific example, let's assume I have a file called app/dashboard/dashboard.ember. dashboard.ember consists of 3 concatenated files: app/dashboard/controller.js, .../route.js, and .../template.hbs with a reasonable delimiter between the files. When dashboard.ember is saved, I'd like to call a function (inside an addon, I assume) that reads the file, splits it at the delimiter and writes the corresponding splitted files. ember-cli should then pick up the changed source (.js, .hbs, etc.) files that it knows how to handle, ignoring the .ember file.
I could write this as a standalone application, of course, but I feel like it should be integrated with the ember-cli build environment, but I can't figure out what concoction of hooks and tools I should use to achieve this.

Loading a text file in to memory and analyze its contents

For educational purposes, I would like to build an IDE for PHP coding.
I made a form app and added OpenFileDialog ..(my c# knowledge was useful, because it was easy ... even though without intelisense!)
Loading a file and reading lines from it is basically the same in every language (even PERL).
But my goal is to write homemade intelisense. I don't need info on the richtextBox and the events it generates, endline, EOF, etc, etc.
The problem I have is, how do I handle the data? line for line?
a struct for each line of text file?
looping all the structs in a linked list? ...
while updating the richtextBox?
searching for opening and closing brackets, variables, etc, etc
I think Microsoft stores a SQL type of database in the app project folders.
But how would you keep track of the variables and simulate them in some sort of form?
I would like to know how to handle this efficiently on dynamic text.
Having never thought this through before, it sounds like an interesting challenge.
Personally, I think you'll have to implement a lexical scanner, tokenizing the entire source file into a source tree, with each token also having information about it mapping the token to a line/character inside of the source file.
From there you can see how far you want to go with it - when someone hovers over a token, it can use the context of the code around it to be more intelligent about the "intellisense" you are providing.
Hovering over something would map back to your source tree, which (as you are building it) you would load up with any information that you want to display.
Maybe it's overkill, but it sounds like a fun project.
This sounds to be related to this question:
https://softwareengineering.stackexchange.com/questions/189471/how-do-ide-s-provide-auto-completion-instant-error-checking-and-debugging
The accepted answer of that question recommends this link which I found very interesting:
http://msdn.microsoft.com/en-us/magazine/cc163781.aspx
In a nutshell, most IDEs generate the parse tree from the code and that is what they stores and manage.

Clojure: Marginalia: Multi Page Documentation

Question
(run-marginalia {})
produces a single file, docs/uberdoc.html
I would prefer it to produce many files in docs/*, one per *.clj file
Motivation:
I really like marginalia. I have recently started using it, and it's causing me to want to write documentation, as impossible as that sounds.
However, I have this problem that whenever I write docs, and refresh, and reload uberdoc.html, I lose the part of the doc I was previously looking at. Thus, I would prefer a system where each *.clj file had it's on *.html file for documentation. Is this possible with marginalia 0.7.0?
Thanks!
There was a mutlidoc functionality in a previous version, but it is not at command line in the latest version. However, by running something like (multidoc! "./docs" (find-processable-file-paths "./src" #"\.clj$") {}) you should get directory of individual files.
https://github.com/weavejester/codox is another Clojure documentation tool (which gives separate pages - see http://number23.github.com/commons-lib/)