33 lines
847 B
Markdown
33 lines
847 B
Markdown
---
|
|
title: "replae <s> with spell and nohl"
|
|
date: 2020-01-11T12:57:46+01:00
|
|
draft: false
|
|
snippet_types: ["vim"]
|
|
---
|
|
|
|
When is the last time you used the **\<s>** key in vim? May not know what it even does?
|
|
|
|
The vim help pages lists it as substitute:
|
|
|
|
```
|
|
4.2 Substitute *:substitute*
|
|
*:s* *:su*
|
|
:[range]s[ubstitute]/{pattern}/{string}/[flags] [count]
|
|
```
|
|
|
|
In real use I find this visual selection putting or using **\<c>** along with movement keys much
|
|
better for substituting text. This leave the s key in normal mode open to be remapped! Here are two
|
|
mappings I have so far:
|
|
|
|
- turn off highlighting with a quick **\<s>\<s>**
|
|
```vim script
|
|
nnoremap ss :noh<CR>
|
|
```
|
|
|
|
- turn on spell check in a given language
|
|
```vim script
|
|
nnoremap <leader>se :setlocal spell spelllang=en<CR>
|
|
nnoremap <leader>sd :setlocal spell spelllang=de<CR>
|
|
```
|
|
|
|
|