Mapeamentos de troca para idiomas latinos
Os mapeamentos de troca do Wiki do Vim não funcionarão corretamente em palavras com caracteres acentuados.
Esses mapeamentos são adaptados para funcionar com caracteres ISO / IEC_8859-1 do suplemento latino-1 (europeu) . Isso é feito substituindo todas as instâncias de \w
por [0-9A-Za-zÀ-ÖØ-öø-ÿ_\-]
e todas as instâncias de \_W
por \_[^0-9A-Za-zÀ-ÖØ-öø-ÿ_\-]
.
Limpeza do destaque da pesquisa
Além disso, o realce da pesquisa é limpo quando necessário.
Isso é conseguido adicionando :nohlsearch<return>
no final de cada mapeamento em necessidade.
Aqui está o resultado final:
" Use gc to swap the current CHARACTER with the next, WITHOUT changing the cursor position.
nnoremap <silent> gc xph
" Use gw to swap the current WORD with the next, WITHOUT changing the cursor position.
nnoremap <silent> gw "_yiw:s/\(\%#[0-9A-Za-zÀ-ÖØ-öø-ÿ_\-\']\+\)\(\_[^0-9A-Za-zÀ-ÖØ-öø-ÿ_\-\']\+\)\([0-9A-Za-zÀ-ÖØ-öø-ÿ_\-\']\+\)//<CR><c-o><c-l>:nohlsearch<return>
" Disable Alt+[menukey] menu keys (i.e. Alt+h for help)
set winaltkeys=no
" Use Alt + ← or Alt + h to swap the current WORD with the previous, keeping the cursor on the current word. This feels like "PUSHING" the word to the left.
nnoremap <silent> <A-Left> "_yiw?[0-9A-Za-zÀ-ÖØ-öø-ÿ_\-\']\+\_[^0-9A-Za-zÀ-ÖØ-öø-ÿ_\-]\+\%#<CR>:s/\(\%#[0-9A-Za-zÀ-ÖØ-öø-ÿ_\-\']\+\)\(\_[^0-9A-Za-zÀ-ÖØ-öø-ÿ_\-\']\+\)\([0-9A-Za-zÀ-ÖØ-öø-ÿ_\-\']\+\)//<CR><c-o><c-l>:nohlsearch<return>
nnoremap <silent> <A-h> "_yiw?[0-9A-Za-zÀ-ÖØ-öø-ÿ_\-\']\+\_[^0-9A-Za-zÀ-ÖØ-öø-ÿ_\-]\+\%#<CR>:s/\(\%#[0-9A-Za-zÀ-ÖØ-öø-ÿ_\-\']\+\)\(\_[^0-9A-Za-zÀ-ÖØ-öø-ÿ_\-\']\+\)\([0-9A-Za-zÀ-ÖØ-öø-ÿ_\-\']\+\)//<CR><c-o><c-l>:nohlsearch<return>
" <A-h> corresponds to è
" Use Alt + → or Alt + l to swap the current WORD with the next, keeping the cursor on the current word. This feels like "PUSHING" the word to the right.
nnoremap <silent> <A-Right> "_yiw:s/\(\%#[0-9A-Za-zÀ-ÖØ-öø-ÿ_\-\']\+\)\(\_[^0-9A-Za-zÀ-ÖØ-öø-ÿ_\-\']\+\)\([0-9A-Za-zÀ-ÖØ-öø-ÿ_\-\']\+\)//<CR><c-o>/[0-9A-Za-zÀ-ÖØ-öø-ÿ_\-\']\+\_[^0-9A-Za-zÀ-ÖØ-öø-ÿ_\-\']\+<CR><c-l>:nohlsearch<return>
nnoremap <silent> <A-l> "_yiw:s/\(\%#[0-9A-Za-zÀ-ÖØ-öø-ÿ_\-\']\+\)\(\_[^0-9A-Za-zÀ-ÖØ-öø-ÿ_\-\']\+\)\([0-9A-Za-zÀ-ÖØ-öø-ÿ_\-\']\+\)//<CR><c-o>/[0-9A-Za-zÀ-ÖØ-öø-ÿ_\-\']\+\_[^0-9A-Za-zÀ-ÖØ-öø-ÿ_\-\']\+<CR><c-l>:nohlsearch<return>
" <A-l> corresponds to ì
" Use g{ to swap the current PARAGRAPH with the next.
nnoremap g{ {dap}p{