With gUU you can change a line to all upper case words.
With guu you can change a line to all lower case.
How can you apply this to a selection?
Meaning:
When I have a piece of code selected to status line shows --SELECT--
When I then press gUU, it removes my selection and give me the text gUU.
That's not what I want.
What I want is to:
1) Select a piece of code.
2) Press <Shift-F3> and make it upper case.
3) Press <Shift-F3> again to change it to lower case. (So a toggle function)
Rgds,
Jeri
> With gUU you can change a line to all upper case words.
> With guu you can change a line to all lower case.
>
> How can you apply this to a selection?
> Meaning:
> When I have a piece of code selected to status line shows --SELECT--
> When I then press gUU, it removes my selection and give me the text gUU.
> That's not what I want.
You should not be using select mode instead of visual mode. If you press `gU'
(not `gUU` since second `U' is a motion) in visual mode, it will do what you
want. Try doing `set selectmode=' and then repeat what you do. If you do not
want to use visual mode, use `<C-o>gU' instead of `gU'.
> What I want is to:
> 1) Select a piece of code.
> 2) Press <Shift-F3> and make it upper case.
> 3) Press <Shift-F3> again to change it to lower case. (So a toggle
> function)
If you want to toggle upper/lower (so that `Ul' becomes `uL'), use
vnoremap <special> <S-F3> ~
if you want to toggle upper/lower based on character under cursor, use
vnoremap <expr> <special> <S-F3> ((matchstr(getline('.'), '^.', col('.')-1)=~#'\u')?
('gu'):('gU'))
If I remember correctly, keybindings like Shift-Fn are recognized only
by gvim, not by terminal vim (because of limitations of the terminal
emulator, e.g., xterm or konsole)
Using ~ to toggle the case of text seems more simple to type for me.
--
Javier Rojas
GPG Key ID: 0x24E00D68
> If I remember correctly, keybindings like Shift-Fn are recognized only
> by gvim, not by terminal vim (because of limitations of the terminal
> emulator, e.g., xterm or konsole)
No, sometimes <S-FN> works fine. Sometimes it requires a bunch of
...
set <S-F3>=^[[13;2~
...
placed in the vimrc. But they can be recognized in a terminal. There can be some
problems when terminal takes <S-FN> key as its own shortcut... but this can
apply to any <C-, <A- and others as well.
This seems to work for the text selected when your in select mode
vmap <S-F3> <esc>gv~
<esc> stops the select-mode
gv selects the last selection, but then in visual mode
~ does then the toggling
Rgds,
Jeri