mirror of
https://github.com/webinstall/webi-installers.git
synced 2026-02-14 09:39:51 +00:00
fix(vim-italics): rewrite
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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
3
vim-italics/italics.vim
Normal 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
|
||||
@@ -1,6 +0,0 @@
|
||||
" turn on spellcheck
|
||||
set spell
|
||||
|
||||
" set spellcheck highlight to underline
|
||||
hi clear SpellBad
|
||||
hi SpellBad cterm=underline
|
||||
Reference in New Issue
Block a user