Skip to content

Commit

Permalink
Update the Readme again
Browse files Browse the repository at this point in the history
  • Loading branch information
brennier committed Feb 20, 2017
1 parent 8c0f8cd commit 92e1cd6
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions README.md
@@ -1,14 +1,22 @@
## Vimtexer is a template expander for quickly writing LaTeX

Basically, Vimtexer allows you to set keywords to activate arbitrary Vim code whenever they are typed in insert mode. These expansions are filetype specifc. For example, if you using the default dictionaries, then typing 'prf' in a tex file will expand into:
Basically, Vimtexer allows you to set keywords to activate arbitrary Vim code whenever they are typed in insert mode. These expansions are filetype specifc. For example, if you are using the default dictionaries, then typing 'prf' in a tex file will expand into:

```tex
\begin{proof}
*
\end{proof}
```

After an expansion, your cursor is placed in the place of the `*` and you will remain in insert mode so that you can continue to seamlessly type. All expansions are triggered automatically after typing a space.
where `*` represents your cursor position over expansion. You will remain in insert mode the entire time, allowing you to seamlessly continue typing. All expansions are triggered automatically after typing a space.

## Why should I use Vimtexer instead of another plugin?

1. Vimtexer has a separate namespace for math mode expansions. This truly is the best feature. It will help you type math in Latex faster than you ever thought possible.

2. Vimtexer is small and simple. There are literally only two functions in the entire source. Altogether, the source code a little over 100 lines, well over half of which are just comments and blank lines. If you have any experience with writing a vim plugin, then you'll probably understand this plugin. Setting new keywords is as easy as making a dictionary in your vimrc.

3. Vimtexer is FAST. Since the code is so small and written completely in Vimscript, Vimtexer expands keywords instanteously. Programming similar functionality into a snippets plugin would be significantly slower, especially when you include the context dependence for math mode.

## Configuration

Expand All @@ -18,7 +26,7 @@ When you make a dictionary, the variable name should be `g:vimtexer_<filetype>`.

Keywords can be any string without whitespace. Expansions can either be a literal string (using single quotes) or a string with keypress expansions (using double quotes). Keypress expansions are things like `\<CR>`, `\<BS>`, or `\<Right>` that one would find in vim remappings. Keep in mind that `\`'s need to be escaped (i.e. `\\`) when using double quoted strings.

If the expansion string has a `<+++>` in it, then your cursor will be placed there after the expansion. This plugin also features a jump function support (only for latex files at the moment). That is, every time you hit double space, you will jump to the next `<++>` (note that this is different from `<+++>`). This feature can be turned off by adding `let g:vimtexer_jumpfunc = 0` in your vimrc. Thus, you can add `<++>`'s to keyword expansions in order to easily jump around afterwards.
If the expansion string has a `<+++>` in it, then your cursor will be placed there after the expansion. This plugin also features a jump function support (only for latex files at the moment). This allows you to jump to the next `<++>` (note that this is different from `<+++>`) whenever you type double space. This feature can be turned off by adding `let g:vimtexer_jumpfunc = 0` in your vimrc. This feature is extremely useful as you can add `<++>`'s to keyword expansions in order to easily jump around afterwards.

An example dictionary:
```vim
Expand All @@ -28,18 +36,9 @@ let g:vimtexer_tex = {
\'frac' : "\\(\\frac{<+++>}{<++>}\\) <++>"
\}
```
This dictionary would expand `alpha` as `\(\alpha\)` and would expand `prf` in the manner shown in the first section of this readme. `frac` would be expanded as `\(\frac{*}{<++>} <++>\)` (where `*` is your cursor position), allowing you to easily jump to the next argument and then jump out of math mode altogether. As you can see, this can significantly speed up your Latex typing speed. Keep in mind that you need backslashs at the beginning of each line when you do muiti-line definitions in Vimscript.
This dictionary would expand `alpha` as `\(\alpha\)` and would expand `prf` in the manner shown in the first section of this readme. `frac` would be expanded as `\(\frac{*}{<++>}\) <++>` (where `*` is your cursor position), allowing you to easily jump to the next argument and then jump out of math mode altogether. As you can see, this can significantly speed up your Latex typing speed. Keep in mind that you need backslashs at the beginning of each line when you do muiti-line definitions in Vimscript.

For more information, see the heavily documented source code.
For more information, see the source code, add a bug report, or contact me via e-mail.

## Why should I use Vimtexer instead of another plugin?

1. Vimtexer has a separate namespace for math mode expansions. This truly is the best feature. It will help you type math in Latex faster than you ever thought possible.

2. Vimtexer is small and simple. There are literally only two functions in the entire source. Altogether, the source code a little over 100 lines, well over half of which are just comments and blank lines. If you have any experience with writing a vim plugin, then you'll probably understand this plugin. Setting new keywords is as easy as making a dictionary in your vimrc.

3. Vimtexer is FAST. Since the code is so small and written completely in Vimscript, Vimtexer expands keywords instanteously. Programming similar functionality into a snippets plugin would be significantly slower, especially when you include the context dependence for math mode.

For a video demonstration of what it's like to use vimtexer, click the image below:
###For a video demonstration, click the image below:
[![https://www.youtube.com/watch?v=z03-e8zCkl8](https://img.youtube.com/vi/z03-e8zCkl8/0.jpg)](https://www.youtube.com/watch?v=z03-e8zCkl8)

0 comments on commit 92e1cd6

Please sign in to comment.