LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 11-20-2014, 12:50 AM   #1
kikinovak
MLED Founder
 
Registered: Jun 2011
Location: Montpezat (South France)
Distribution: CentOS, OpenSUSE
Posts: 3,453

Rep: Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154
How to completely stop indenting in Vim?


Hi,

Sometimes, I have to copy/paste code from a webpage into a local text file. My text editor is Vim. There's one thing that's nagging me. The indenting function doesn't seem to behave like it should. Basically I have these two modes:

Code:
:set autoindent
:set noautoindent
Curiously enough, when I disable auto-indentation, text still keeps indenting automatically. So when I have some shell script with a few if-then-else-fi blocks, I get some basically unusable text going from the upper left to the right bottom of my console.

Anybody knows how to turn this off completely?
 
Old 11-20-2014, 05:22 AM   #2
Cesare
Member
 
Registered: Jun 2010
Posts: 65

Rep: Reputation: 113Reputation: 113
Use "set paste" before copy-pasting preformatted code into vim. Use "set nopaste" to get the default behaviour back.
 
1 members found this post helpful.
Old 11-20-2014, 05:39 AM   #3
moisespedro
Senior Member
 
Registered: Nov 2013
Location: Brazil
Distribution: Slackware
Posts: 1,223

Rep: Reputation: 195Reputation: 195
Better than that add this to your .vimrc:

Code:
" F11 to toggle paste mode
map <F11> :set invpaste<CR>
set pastetoggle=<F11>
Then you can toggle between paste and "normal" insert mode with F11

I got this from here
 
3 members found this post helpful.
Old 11-20-2014, 03:11 PM   #4
kikinovak
MLED Founder
 
Registered: Jun 2011
Location: Montpezat (South France)
Distribution: CentOS, OpenSUSE
Posts: 3,453

Original Poster
Rep: Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154
Thanks a lot, guys! That made my day.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Vim map CTRL-S indenting problem sadarax Linux - General 6 01-17-2008 01:52 PM
vim auto indenting? kryptobs2000 Linux - Software 2 10-20-2007 03:11 PM
disable indenting in VIM Ygrex Linux - Software 3 12-24-2005 04:07 AM
vim and fortran smart-indenting s_siouris Linux - Software 0 11-23-2004 05:00 AM
Make vi stop indenting tumana Linux - Newbie 1 04-06-2004 09:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration