Below you will find pages that utilize the taxonomy term “Vim”
Vim, Sublime Text, Visual Studio Code and the multiple cursors.
Article on comparative handling of multiple cursors in Sublime Text, Visual Studio Code and Vim.
- 1. Multiple cursors? Multi-cursors? What are we talking about?
- 2. Who “invented” multiple cursors?
- 3. Multiple cursors in Sublime Text 3 and 4.
- 4. Multiple cursors in Visual Studio Code.
- 5. Comparison of Sublime Text and Visual Studio Code.
- 6. Vim and the built-in multiple editing functions.
- 7. Effective multi cursors also on Vim.
1. Multiple cursors? Multi-cursors? What are we talking about?
What are multiple cursors?
Vim and snippet lists for UltiSnips and other plugins.
Article about the different collections of snippets designed for different plugins of Vim and the possibility of converting from type of format to another.
- 1. Preamble
- 2. Steps for using snippets
- 3. Local custom snippets.
- 4. Honza: Why two different collections of snippets?
- 5. Overview of both collections.
- 6. Is it possible to “mix” the snippets of the two collections?
1. Preamble
In the article “Vim, UltiSnips and Honza vim-snippets: difference and management of the snippets and UltiSnips folders” I have already covered the topic of snippets and UltiSnips for Vim:
Markdown with Vim, Emacs, Sublime Text 4 and Visual Studio Code
How are four generalist editors, i.e., designed to be used with a wide range of programming languages and text files, performing when writing documents in Markdown language? This is the subject of this article based on my personal experiences in using Vim, Emacs, Sublime Text 4 and Visual Studio Code both directly and with extensions dedicated to the above mentioned markup language.
- 1. Introduction.
- 2. Vim and Markdown.
- 3. Emacs and Markdown.
- 4. Sublime Text 4 and Markdown.
- 5. Visual Studio Code and Markdown.
- 6. In summary.
1. Introduction.
Markdown is a simple markup language that is within anyone’s reach, compatible with HTML, and allows very elegant, well-formatted text to be written for both web and print publication.
Automatic generation of hyperlinks in LaTeX environment, using Vim's Regular Expressions, between PDF documents.
Vim is an editor with endless capabilities. It can also generate hyperlinks in LaTeX language to other locally stored documents, thanks to its built-in Regular Expressions. For lawyers, this means linking a legal document with its related evidentiary materials. This is the analysis of the procedure.
- 1. Subject of this article.
- 2. Main document configuration.
- 3. RegEx formula for automatic link generation.
- 4. Explanation of the RegEx formula.
- 5. Management of “underline character”.
- 6. Links within the text
1. Subject of this article.
Sometimes it is necessary to include in a main PDF document a list of documents to be retrieved with specific hyperlinks dedicated to each item in the list.
From Text Objects in Vim to Text Blocks in Gutenberg for WordPress.
About Vim and Gutenberg.
Vim is a command-line editor. Gutenberg for WordPress is a visual editor.
Vim was created in 1987, as an evolution from the earlier Vi. Gutenberg has become the default editor for WordPress since version 5.0 of the CMS, released on November 27, 2018.
They are chronologically and structurally very distant writing tools.
But despite the differences, there are also some similarities.
Vim allows writing by treating text as an “object.” Gutenberg allows writing by treating text as a “block.”
Powerful OCR system under GNU/Linux for PDF documents managed from command line and with refinement by Vim.
Introduction.
The idea came from reading this article about optical character recognition (OCR) in the GNU/Linux environment from images and PDF, managed from the command line.
Obviously, PDF documents are those scanned from paper original, i.e., not obtained by direct saving of document in digital format. For the latter, no OCR is needed.
The article is very well written and the end result is very good.
I wondered if it would be possible to aggregate all the steps into a single text command.
Notes on resolving differences between two documents with the built-in resources of Vim and Emacs
What are we talking about?
In this article, I report my practical experience on how to use the built-in resources of Vim and Emacs to resolve and undo differences between two documents.
In fact, I’ve occasionally updated two documents in such a “messy” way that I could no longer remember which updates to keep on one and the other.
Both Vim and Emacs offer very simple and effective built-in tools for checking and resolving such differences.
Vim and the Markdown preview
Preamble
Vim is an excellent editor for Markdown, both for its own “native” features and for the possibility of adding specific functions via “plugins.”
Previewing documents requires, unless you use the “manual” solution mentioned at the end of this article, using a dedicated “plugin.”
Until a few years ago, my favorite was “iamcco/markdown-preview.vim” because it provided a true real-time live effect while typing text, even before periodic saving.
Unfortunately, that project has been abandoned since February 2020.
Vim - VimTex, Emacs - AucTeX: create environments in empty fields
Subject of this post
This post is a follow-up to my previous one named “Vim, VimTex: environments and commands in LaTeX” in which I described the creation of environment tags in the LaTeX language through Vim’s “surround.vim” plugin.
Specifically, I described how to add environment tags to words and lines objects non-empty, that is, starting from already existing text.
If you need a reminder about the concept of “line” in Vim, you can refer to this article of mine: “What is intended by “line” in Vim? How to configure a dual alternate mode of movement between lines?”
About Vim and the Global Command
Vim and the Global Command: basic structure
This post is not a complete review of Vim’s Global Command but is just a series of personal observations on it.
You can find a good review, written by those who know much more about it than I do, on this page.
With the “Global Command” of Vim (g
) you can replicate various
ex-commands on multiple lines.
The basic structure of the Global Command is very simple:
:g/pattern/command
, meaning:
Vim, VimTex: environments and commands in LaTeX
A smart system for writing
Vim is a great editing tool.
LaTeX is a “State of the Art” typesetting system.
Vim and LaTeX together make a powerful writing system, but an add-on is needed to relate them.
VimTex provides exactly that target by relating Vim to LaTeX, and it does its job very well.
So Vim and VimTex is a smart system for every kind of writer in LaTeX.
The topic is vast and certainly cannot be contained in a short post like this one.
Vim Is Magic or Nomagic?
What’s this joke?
The title is a joke with the name of “V.I.M.” but, at the same time, it’s a real mode of Vim itself: the Magic Mode.
To understand what Magic Mode is, the primary source is the item :help magic
in Vim.
In a few words:
- The Magic Mode refers to the regular expressions
- The Magic Mode is enabled by default in Vim.
- You can explicitly invoke the Magic Mode with the
\m
command in the RegEx search area. - To deactivate it you must set
\M
(capitalized m) in the RegEx search area. - When you use the
\M
command you invoke the Nomagic Mode. - Nomagic Mode turns “almost all special regex symbols into ordinary ones unless they start with a backslash”.
- There is also a Very Nomagic Mode that extends the effect to other characters, not relevant to this article.
When is magic mode (default) better than nomagic?
To analyze the difference between magic and nomagic mode, I resume a formula from a previous article of mine.
Vim, UltiSnips and Honza vim-snippets: difference and management of the snippets and UltiSnips folders
What is the subject of this article?
In this article I will talk about Vim, snippets powered by SirVer UltiSnip: “the ultimate solution for snippets in Vim” and Honza vim-snippets (hereafter also simply referred as “honza”).
For some more information you can refer to this previous article of mine.
SirVer UltiSnip is a plugin to launch and manage snippets in Vim.
The application does not contain snippets but you can create your own by following the plugin syntax or use a collection of ready-made snippets.
Vim: study on transposing lists of names from horizontal to vertical
Primary purpose of the study.
- Initial status: series of inline names, separated by a semicolon followed by a space.
- Objective: Transpose all names into one column by removing both semicolons and spaces.
- Purpose: Creating list for mail-merging with e-mail client (Thunderbird).
- Tools: Vim and built-in RegEx function.
- Example:
Secondary goal
To test the integration between Markdown and css tags.
Vim: replace text in all opened buffers with only one command
Vim: do you need to replace some text in all opened buffers?
Do You need to perform a substitution between two words or text fragments in all opened buffers?
The first option is to open all the buffers and perform a search with substitution in each of them.
The search and replace string will look like the one below, where foo
will be the data element to be replaced and bar
will be the replaced data element.
Comparison of Vim and Emacs for a substitution operation using regular expressions
Preface
This article is a summary of two previous posts that you can read at these pages:
- “Vim: Study on constructing Regular Expressions to delete or reduce blank lines with Global Command”
- “Emacs: Study on constructing Regular Expressions to delete or reduce blank lines”
The topic of “regular expressions” in Vim and Emacs is well suited for a functional comparison across the four different scenarios covered in the above articles to which I refer for a description of the syntax.
Vim: Study on constructing Regular Expressions to delete or reduce blank lines with Global Command
Preface
On the topic of this article you may find interesting the following one: “Vim and Regular Expressions for removing redundant whitespace”.
Unlike the previous article, here the presence of whitespace causes different solutions than blank lines regardless of the number of their occurrences.
The study in this article is focused on both the analysis of “regular expressions” and Vim’s global command.
Vim and the Global Command
The Global Command in Vim is the g
key.
What is intended by "line" in Vim? How to configure a dual alternate mode of movement between lines?
Why is the Vim line definition “special”?
In Vim a “line” is a set of characters that ends with a return line.
Is that all?
It seems obvious, but how does it differ from the definition of “line” in other writing systems?
Simple: in other environments usually “lines” break at the right margin of the monitor. In Vim they don’t.
Nothing changes for short lines, that is, lines that do not exceed the margin right margin.
Vim and Regular Expressions for removing redundant whitespace
Introduction and structure of the article
I wrote this article to practice “in situ” formula construction of Regular Expressions also called RegEx in Vim.
In particular, the goal is to “clean up” documents with excess whitespace at both the beginning and end of each line.
A basic knowledge of Vim and the Regular Expressions built into the editor is sufficient for understanding the article.
The various formulas are applied to whole documents but, since they are very normal search commands in Vim, they can be applied to individual rows or to specific ranges of rows in the context of the document.
Jumping between matching pairs of characters and tags in Vim and Emacs
It is very useful to jump through corresponding pairs of characters, such as parentheses or tags, when coding or writing in a markup language such as HTML, Markdown or LaTeX.
Both Vim and Emacs have dedicated commands for this purpose.
To jump between matching pairs using Vim
Vim uses a “single character” command to jump to the nearest pairs of corresponding characters and to place the cursor into the closing one: %
.
Vim: copy text directly to the operating system clipboard
Cut and copy in Vim: introduction
As an introduction to the topic regarding the Cut, Copy and Paste functions in Vim you can read a previous article of mine.
The subject of the current article is, instead, a Vim functionality I discovered while reading this page and which is closely related to the previous topic.
Vim can directly redirect cut and copy operations performed on texts to the system memory register (clipboard).
Using Vim to write scores in LilyPond
About LilyPond
LilyPond is a language for producing elegant musical scores, structurally similar to LaTeX with which it can integrate to generate documents containing text and music (for the integration between LilyPond and LaTeX you can read to this article of mine.)
Also in LilyPond, as in LaTeX, you can write the content with various editors.
Very useful, especially to learn the syntax, is the editor called Frescobaldi.
For those who have already learned the syntax, it may be useful to use the infinite potential of Emacs and Vim,
Vim: some modalities to open single or multiple documents
Synthesis table
Some Vim commands we’ll talk about:
I write | To get |
---|---|
vim document_name | To run Vim and open a document |
gvim document_name | To run Graphical Vim and open a document |
vim file-1 file-2 file-n | To run Vim and open multiple documents |
vim -p file-1 file-2 file-n | To run Vim and open multiple documents in tabs |
vim -o file-1 file-2 file-n | To run Vim and open multiple documents in separate windows with horizontal rows |
vim -O file-1 file-2 file-n | To run Vim and open multiple documents in separate windows with vertical rows |
sp doc_name | To split a new file while Vim is running |
vs doc_name | To vertical split a new file while Vim is running |
tabe doc_name | To open a new file in a dedicated tab while Vim is running |
Vim offers a lot of options to open or create single or multiple files from the command line or while the application is running.
Vim: searching for text containing a slash or a question mark
Vim: the search command
To activate a text search in Vim, press one of the following trigger keys in your keyboard:
- the slash
"/"
key (do not confuse with the back-slash"\"
key) - the question mark key.
By pressing the slash "/"
key will activate a forward search.
By pressing the question mark "/"
key will activate a backward search.
To move the cursor to the results in your document, press the "n"
key
(mnemonic for “next”). To invert the direction of the cursor, press
the "N"
key, (“upper n”).
Vim, Markdown, Snippets, UltiSnips: how to get a well-formatted link with a single command
Objective of this post
The objective of this post is to get a correctly formatted link in Markdown by merging in a single command a fragment of text and an Internet address previously saved in the Vim clipboard.
Of course I assume that everybody that’s reading this post knows how to create a well formatted link in Markdown, i.e. text in square brackets and URL in round brackets.
Why did I ask myself this question?
Vim: Cut, Copy and Paste to and from the System Clipboard
Cut, Copy and Paste using the computer keyboard
Everybody knows how to use the keyboard combinations Ctrl-c
, Ctrl-x
and Ctrl-v
in Windows and Linux (or Cmd-c
, Cmd-x
and Cmd-v
in macOS) to copy, cut and paste text across applications.
Many think that those combinations are universal and work with any application. But it’s not true.
Vim uses another system to exchange information with other applications.
For example, in Vim under GNU/Linux, the key combination Ctrl-v
corresponds to the visual block function and does not affect the pasting text.
Animated GIFs about basic RegEx in Vim and Emacs
A non-preface about RegEx
In my little experience as a LaTeX writer using Vim and Emacs, I sometimes use the extraordinary efficiency of RegEx, also known as RegExp or “Regular Expressions”.
Vim and Emacs, provide built-in support for RegEx.
I’ll show you in the following clips some elementary uses of regex in both editors.
The software developer community will smile, but the following animated GIFs are intended for writers, not computer programmers.
Vim: delete sentences and paragraphs via Text Objects
Vim reduces the strain on your eyes
An unbelievable feature of Vim is the ability to perform operations within entire blocks of text called “Text Objects”, such as words, sentences and paragraphs, regardless of the cursor position inside the objects.
This means you can place the cursor randomly within the blocks and reduce the strain of your eyes towards the monitor.
The "evolution line" across Ed, Vi and Vim
A little preface about Ed, Vi and Vim
Have you ever heard of Ed and Vi? Maybe you’ve heard of Vim.
They are command line text editors.
Ed was created in 1969 and it was one of the first components of Unix O.S.
Vi dates from 1976 and it was the “de facto” standard editor for Unix until the arrival, in 1984, of Emacs.
Vim was born in 1991 and it’s actually the fastest editor in the univers!
Vim, flash movements between windows with EasyMotion
Quick introduction
Vim can quickly jump through different documents at a lightning speed.
Do you remember when you had to move the cursor using the arrow keys and pressing them continuosly until the final point?
If you use Vim, the above actions will be only bad memories.
You only have to install the EasyMotion plugin and make a miniml configuration.
Installation and configuration of EasyMotion
The EasyMotion plugin installation is really a kid’s joke.