Quickly enter data in legal documents with bookmarks in Vim
A working scenario: legal acts with preset data
In a legal act there are standard data used in many documents: name of the lawyer, name of the claimant, place of the court of justice, date of the hearing, etc.
So, to save time, it is useful to have a system to upload data into the document once and to use them whenever you need during the preparation of the document.
LaTeX is an excellent system to write legal acts.
And one of the most effective tools for writing LaTeX code is Vim.
Create a Vim document with bookmarks
Vim has a native command to set bookmarks: the mark
command.
In the simplest way you can set a bookmark in Vim by pressing, in Normal Mode, the key m
followed by a letter.
An elementary example could be the combination: ma
that create the a
bookmark.
You can put this bookmark wherever you want in the document.
So you can put a bookmark, for example, where you need to enter data in a legal act: ma
for the name of the defendant, mb
for the name or the claimant, mc
for the place of che court, and so on.
Bookmarks and LaTeX variables
To write your act faster and more precise, you can place bookmarks in LaTeX variables so that you can enter data only once and have them available for the rest of the act.
To use LaTeX variables in a legal act you can see this post of mine.
Where bookmarks are stored?
Normally all bookmarks are deleted on exit from Vim.
But there’s a way to save them permanently: you can add a set information in viminfo. And to add configuration information in viminfo you have to insert a set
command in vimrc like this: set viminfo='n,f1
where n
is a number of your choice.
A possibile configurazione could be set viminfo='100,f1
What’s the f1
option?
The f1
option tells Vim to save bookmarks in uppercase e lowercase letters.
The uppercase letter bookmarks are used to jump between different documents in the stack.
The lowercase letter bookmarks remain within the document where they are marked.
You can choose whether to make uppercase bookmarks permanent as well.
I prefer to have only lowercase bookmarks as permanent.
If you agree with me, you can limit the length of bookmarks to lower case only, as follows: set viminfo='n,f0
.
How to jump through bookmarks
And now you have some bookmarks but how to use them?
You can simply cycle through them forward by using ]
` or backward by using [
` or jump directly to the specific bookmark using `x
where x
is the bookmark letter.
If you need to see all bookmarks use: :marks
.
Pay attention to the backtick
In non-US keyboards, as for example in the Italian keyboard, the backtick (`) could be not immediately available.
In Linux e MacOS you can use native shortcuts to get the backtick.
But in Windows there is no shortcut and you have to create it by using the ASCII code.
However, this system is time-consuming and does not work for commands.
The best solution for non-US keyboards in Windows is to remap the keys by introducing the same shortcuts as in other operating systems.
Perhaps I will talk about this in another article in the future.
Bookmarks and different documents
One final point: I would suggest that you create a bookmark form and start filling it before saving it with a different document name.
Remember, in fact, that the function of permanence of bookmarks is strictly related to the name of the document in which you have inserted them.
Thank You for Your attention!
Originally posted on my Tumblr blog
Comments
Post a Comment