add the old snippet md files

This commit is contained in:
Travis Shears 2025-06-05 16:20:57 +02:00
parent fc0dd204c7
commit bcf8313a4b
110 changed files with 3048 additions and 0 deletions

View file

@ -0,0 +1,33 @@
---
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>
```