On 2012-09-28, ZyX wrote:
> > Thanks for the reply, but I see that I didn't explain the problem
> > very well. Also, some of my experiments created new buffers instead
> > of replacing the contents of existing buffers with new filetypes, so
> > I wasn't replicating the actual problem conditions.
> >
> > Let me try again.
> >
> > The actual problem is that I would like to set 'indentexpr' for
> > buffers with no 'filetype' so that I get indenting behavior that I
> > think might be useful when just opening Vim and typing notes. To
> > that end I put the following in my ~/.vimrc.
> >
> > au BufWinEnter * if &ft == "" || &ft == "text"
> > \ | setlocal indentexpr=indent(prevnonblank(v:lnum-1))
> > \ | setlocal indentkeys-=o
> > \ | let b:undo_ftplugin = "setl inde< indk<"
> > \ | endif
> You can just set 'autoindent'. This option is ignored in most
> cases when using other ways to define indentation.
I have 'autoindent' set all the time, but it doesn't always work as
I would like it to. For example,
I may have a set of lines like these,
each indented from the one above,
then I may add one ending in parentheses()
then paste one below it line this.
I would like to be able to type == to align that last line with the
one above it, but == instead aligns that last line with the first
line. The behavior has something to do with the parentheses.
Without the parentheses, == aligns the last line with the one above
it.
I thought that my 'indentexpr' would be a good way to fix this, and
it is except for my inability to unset it.
I found a solution to that problem later in this thread.
Regards,
Gary
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php