fix(vim-italics): rewrite

This commit is contained in:
AJ ONeal
2023-06-01 05:59:28 +00:00
parent 3383c1e322
commit 7c717d994f
4 changed files with 57 additions and 13 deletions

View File

@@ -2,22 +2,69 @@
title: vim-italics
homepage: https://webinstall.dev/vim-italics
tagline: |
vim-italics is refactors the text to italics.
vim-italics sets vim to use underlines for italics
---
To update (replacing the current version) run `webi vim-italics`.
### Files
These are the files / directories that are created and/or modified with this
install:
```text
~/.vimrc
~/.vim/plugins/italics.vim
```
## Cheat Sheet
Vim-italics turns text to italics.
`vim` uses background highlighting for italics by default.
Many Terminal color themes use the same color for background highlighting as for
the cursor, which makes tracking the cursor difficult.
This swaps to italics to use underlines instead, which works in all themes.
### How to install manually
```ruby
Create the file `~/.vim/plugins/spell.vim`. Add the same contents as
<https://github.com/webinstall/webi-installers/blob/master/vim-italics/italics.vim>.
That will look something like this:
```vim
" use underlines for italics
" (keeps the cursor visible while moving over italic text in all themes)
highlight htmlItalic gui=italic ctermfg=214
```
You'll need a font with an italic set and a terminal capable of displaying italics. Also, if you're using a color scheme other than the default, the above line should come after the color scheme is loaded in your ```~/.vimrc``` so that the color scheme doesn't override it.
You'll then need to update `~/.vimrc` to source that plugin:
The cterm makes it work in the terminal and the gui is for graphical Vim clients.
```vim
" Vim Italics: underlines for italics from webinstall.dev/vim-italics
source ~/.vim/plugins/italics.vim
```
### Troubleshooting
If you still can't see your cursor on italics, or things otherwise look wrong,
try moving the `source ~/.vim/plugins/italics.vim` closer to the top of your
config - above other things that may also be modifying the italics behavior.
#### Example
`~/.vimrc`:
```diff
+ " Vim Italics: underlines for italics from webinstall.dev/vim-italics
+ source ~/.vim/plugins/italics.vim
" ALE: reasonable defaults from webinstall.dev/vim-ale
source ~/.vim/plugins/ale.vim
- " Vim Italics: underlines for italics from webinstall.dev/vim-italics
- source ~/.vim/plugins/italics.vim
```
Or, in some cases, moving it closer to the bottom may help.

View File

@@ -22,7 +22,7 @@ __init_vim_italics() {
if ! grep 'source.*plugins.italics.vim' -r ~/.vimrc > /dev/null 2> /dev/null; then
set +e
mkdir -p ~/.vim/plugins
printf '\n" italics Check: reasonable defaults from webinstall.dev/vim-italics\n' >> ~/.vimrc
printf '\n" Vim Italics: underlines for italics from webinstall.dev/vim-italics\n' >> ~/.vimrc
printf 'source ~/.vim/plugins/italics.vim\n' >> ~/.vimrc
set -e
echo "added ~/.vim/plugins/italics.vim"
@@ -30,7 +30,7 @@ __init_vim_italics() {
echo ""
fi
echo "vim-italics enabled with reasonable defaults"
echo "vim-italics enabled"
}
__init_vim_italics

3
vim-italics/italics.vim Normal file
View File

@@ -0,0 +1,3 @@
" use underlines for italics
" (keeps the cursor visible while moving over italic text in all themes)
highlight htmlItalic gui=italic cterm=underline ctermfg=214

View File

@@ -1,6 +0,0 @@
" turn on spellcheck
set spell
" set spellcheck highlight to underline
hi clear SpellBad
hi SpellBad cterm=underline