How does one enter (and view) italic text in vim?
I am interested in a keymap by which I can toggle to "italic mode" and back.
Example from the infopage of a certain vim plugin: see the text under the heading Text Styles
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.
Sign up to join this communityHow does one enter (and view) italic text in vim?
I am interested in a keymap by which I can toggle to "italic mode" and back.
Example from the infopage of a certain vim plugin: see the text under the heading Text Styles
TLDR: There is no such thing. Vim edits plain text, and there is no "italic mode" or anything like that.
To be more specific: Vim is not a word processor. You are confusing file formats and how they render in typical WYSIWYG interfaces (like Microsoft Word) with a text editor, like Vim, Emacs, Notepad, etc. The latter, including Vim, only edits plain text regardless of the file format.
To be more nuanced: There are different file formats, and in some file formats, Vim uses syntax highlighting to show formatted text in e.g. italics. As an example, if you use Vim to edit a file in the Markdown format, you could (with the right setup) make text between pairs of *
appear italized.
The question was updated with an example that indicates more about what is wanted. Here is a general remark: With a plugin like vim-notes, syntax highlighting is used to provide italics in Vim. To make this work, one either has to use a terminal that supports italics (and bold font and so on), or to use a gui variant such as gvim. Further, one has to have the conceal
feature. Most Vim's tend to have this nowadays. Finally, to get the italized font, you need to use the specified syntax, which is _text in italics_
for this particular plugin.
*
does vim then automatically highlight it?
Jan 20, 2018 at 21:53
_
or *
will render in italics. Since this is a nonstandard escape sequence, you likely have to sort it out yourself. For instance, my .vimrc
for iTerm2 terminals includes set t_ZH=<1b>[3m \n set t_ZR=<1b>[23m
(<1b>
being a literal escape).
_text_
for the notes plugin. But your terminal has to support it. And if one wants to conceal the _
s you need to have a "modern" Vim (which most people have today anyways).
Jan 21, 2018 at 9:00
:h syntax
.
Jan 21, 2018 at 16:25