Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] how to stop vim doing this....?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
papu
l33t
l33t


Joined: 25 Jan 2008
Posts: 709
Location: Sota algun pi o alzina...

PostPosted: Wed Nov 02, 2016 10:31 am    Post subject: [SOLVED] how to stop vim doing this....? Reply with quote

every time a paste some text that content espaces/tabs, vim is doing like this:

EXAMPLE, if i try to copy --->
Code:
Section "Monitor"
    Identifier             "Monitor0"
EndSection

Section "Device"
    Identifier             "Device0"
    Driver                 "amdgpu"
    Option                 "DRI" "3"       
EndSection

Section "Screen"
    Identifier             "Screen0" 
    Device                 "Device0"
    Monitor                "Monitor0"
    DefaultDepth            24
    SubSection "Display"
        Viewport   0 0
        Depth     24
    EndSubSection
EndSection



and then paste inside vim--->
https://i.imgur.com/wRc40bf.png


it's so annoying :oops:
_________________
"~amd64" --cpu 7700 non-x --DDR5 2x16GB 6000MHz --gpu RX 470


Last edited by papu on Wed Nov 02, 2016 11:37 am; edited 3 times in total
Back to top
View user's profile Send private message
fedeliallalinea
Administrator
Administrator


Joined: 08 Mar 2003
Posts: 30965
Location: here

PostPosted: Wed Nov 02, 2016 10:37 am    Post subject: Reply with quote

Before paste set paste mode that will prevent vim from re-tabbing your code :set paste, after you can reset with :set nopaste
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
papu
l33t
l33t


Joined: 25 Jan 2008
Posts: 709
Location: Sota algun pi o alzina...

PostPosted: Wed Nov 02, 2016 11:24 am    Post subject: Reply with quote

thank you

then i find that typing in mode command "*p or "+p do same thing :roll:

:wink:
_________________
"~amd64" --cpu 7700 non-x --DDR5 2x16GB 6000MHz --gpu RX 470


Last edited by papu on Thu Nov 03, 2016 3:55 pm; edited 1 time in total
Back to top
View user's profile Send private message
miket
Guru
Guru


Joined: 28 Apr 2007
Posts: 488
Location: Gainesville, FL, USA

PostPosted: Wed Nov 02, 2016 8:56 pm    Post subject: Reply with quote

I switch between paste and normal-indent mode so often I included this line in my .vimrc
Code:
set pastetoggle=<f5>

Now when I type the F5 key--in either visual or command mode--vim switches in or out of paste mode for me.
Back to top
View user's profile Send private message
papu
l33t
l33t


Joined: 25 Jan 2008
Posts: 709
Location: Sota algun pi o alzina...

PostPosted: Wed Nov 02, 2016 11:54 pm    Post subject: Reply with quote

miket wrote:
I switch between paste and normal-indent mode so often I included this line in my .vimrc
Code:
set pastetoggle=<f5>

Now when I type the F5 key--in either visual or command mode--vim switches in or out of paste mode for me.


oh, thanks!

Code:
Some people like the visual feedback shown in the status line by the following alternative for your vimrc:

nnoremap <F2> :set invpaste paste?<CR>
set pastetoggle=<F2>
set showmode

The first line sets a mapping so that pressing F2 in normal mode will invert the 'paste' option, and will then show the value of that option. The second line allows you to press F2 when in insert mode, to toggle 'paste' on and off. The third line enables displaying whether 'paste' is turned on in insert mode.


:wink:
_________________
"~amd64" --cpu 7700 non-x --DDR5 2x16GB 6000MHz --gpu RX 470
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum