You are not logged in.

#1 2010-07-31 09:43:48

rent0n
Member
From: Italy
Registered: 2009-10-29
Posts: 457
Website

[Solved] The one thing I hate about Vim

Hi,

I've started using Vim some time ago and I now understand why everyone loves it.
There's one thing, though, that is driving me nuts; a little but very irritating behaviour.
I hope to be understandable enough so that someone can help me.

Basically when editing (deleting or inserting characters)  a long line containing many words separated by spaces, Vim automatically moves  part of the line to a new line, creating a new paragraph.

Do you see what I mean? I just don't want Vim to create new paragraphs when editing a line.
I'm sure other Vim users already experienced this behaviour... how can I fix it?

Here's my .vimrc, it may be involved somehow:

" All system-wide defaults are set in $VIMRUNTIME/archlinux.vim (usually just
" /usr/share/vim/vimfiles/archlinux.vim) and sourced by the call to :runtime
" you can find below.  If you wish to change any of those settings, you should
" do it in this file (/etc/vimrc), since archlinux.vim will be overwritten
" everytime an upgrade of the vim packages is performed.  It is recommended to
" make changes after sourcing archlinux.vim since it alters the value of the
" 'compatible' option.

" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages available in Debian.
runtime! archlinux.vim

" If you prefer the old-style vim functionalty, add 'runtime! vimrc_example.vim'
" Or better yet, read /usr/share/vim/vim72/vimrc_example.vim or the vim manual
" and configure vim to your own liking!

" no vi compatibility
set nocompatible

" directory
set directory=/home/enrico/.vim

" disable backups (and swap)
set nobackup
set nowritebackup
set noswapfile

" wrap searches
set wrapscan

" tab and indentation
set tabstop=4
set noexpandtab
set smarttab
set shiftwidth=4
set backspace=indent,eol,start
set autoindent
set smartindent

" show commands
set showcmd

" show line and column position of cursor
set ruler

" status bar
set statusline=\ \%f%m%r%h%w\ ::\ %y\ [%{&ff}]\%=\ [%p%%:\ %l/%L]\ 
set laststatus=2
set cmdheight=1

" textwidth
set textwidth=79

" formatting options
set formatoptions=c,q,r,t

" line numbers
set number

" match bracklets
"set showmatch

" search
set hlsearch
set incsearch
set ignorecase
set smartcase

" syntax highlighting
filetype plugin on
syntax on

" background
set background=dark

" enable mouse
set mouse=a

" set colorscheme
colorscheme miromiro
"colorscheme dante
"colorscheme molokai

"allows sudo with :w!!
cmap w!! %!sudo tee > /dev/null %

" mutt tricks (F1 through F3 re-wraps paragraphs)
augroup MUTT
au BufRead ~/.mutt/temp/mutt* set tw=72
au BufRead ~/.mutt/temp/mutt* set spell " <-- vim 7 required
au BufRead ~/.mutt/temp/mutt* nmap  <F1>  gqap
au BufRead ~/.mutt/temp/mutt* nmap  <F2>  gqqj
au BufRead ~/.mutt/temp/mutt* nmap  <F3>  kgqj
au BufRead ~/.mutt/temp/mutt* map!  <F1>  <ESC>gqapi
au BufRead ~/.mutt/temp/mutt* map!  <F2>  <ESC>gqqji
au BufRead ~/.mutt/temp/mutt* map!  <F3>  <ESC>kgqji
augroup END

Thanks! wink

Last edited by rent0n (2010-07-31 10:45:23)


rent0n@deviantART | rent0n@bitbucket | rent0n@identi.ca | LRU #337812
aspire: Acer Aspire 5920 Arch Linux x86_64 | beetle: Gericom Beetle G733 Arch Linux i686

Offline

#2 2010-07-31 09:46:16

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,092

Re: [Solved] The one thing I hate about Vim

:h nowrap


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#3 2010-07-31 09:48:29

scarletxfi
Member
From: Australia
Registered: 2010-04-19
Posts: 105

Re: [Solved] The one thing I hate about Vim

or add "set nowrap" to your .vimrc..

Offline

#4 2010-07-31 09:52:43

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: [Solved] The one thing I hate about Vim

This will suppress breaking the lines.

" textwidth
set textwidth=0

See ":help textwidth" and ":help ins-textwidth" for more.

BTW: "nowrap" does only influence how the text will be displayed. it doesn't change the text in the buffer.

Last edited by bernarcher (2010-07-31 09:54:23)


To know or not to know ...
... the questions remain forever.

Offline

#5 2010-07-31 10:37:58

quigybo
Member
Registered: 2009-01-15
Posts: 223

Re: [Solved] The one thing I hate about Vim

Check out 'formatoptions' for a more fine-grained control over how things are formatted - lines, paragraphs, comments etc. Combined with an augroup for specific filetypes this can be really handy - eg. I automatically break lines in .tex files, but not code.

Offline

#6 2010-07-31 10:44:08

rent0n
Member
From: Italy
Registered: 2009-10-29
Posts: 457
Website

Re: [Solved] The one thing I hate about Vim

bernarcher wrote:

This will suppress breaking the lines.

" textwidth
set textwidth=0

See ":help textwidth" and ":help ins-textwidth" for more.

BTW: "nowrap" does only influence how the text will be displayed. it doesn't change the text in the buffer.

Thanks bernarcher, 'textwidth' was the option I was looking for! big_smile
Wrapping is another thing and I like to keep it enabled.

@quigybo: I will look through 'formatoptions', thanks. I already use augroup for mutt and is very handy indeed!

Last edited by rent0n (2010-07-31 10:45:06)


rent0n@deviantART | rent0n@bitbucket | rent0n@identi.ca | LRU #337812
aspire: Acer Aspire 5920 Arch Linux x86_64 | beetle: Gericom Beetle G733 Arch Linux i686

Offline

Board footer

Powered by FluxBB