Raimondi / delimitMate

Vim plugin, provides insert mode auto-completion for quotes, parens, brackets, etc.
http://www.vim.org/scripts/script.php?script_id=2754
1.98k stars 117 forks source link

Auto indent is not working with delimitMate #176

Closed siddhion closed 10 years ago

siddhion commented 10 years ago

In SCSS after I hit the { key delimitMate will automatically apply the } next to it as expected. When I press Enter, my cursor goes down to the first character position on the next line along with the } therefore ignoring VIM's auto indent feature.

With delimitMate turned off, after I press { and press Enter, my cursor goes down to the next line and is auto indented. So I know my VIM's auto indentation feature works.

What I want to happen after I press { and Enter is for VIM and delimitMate to send my cursor to the next line auto indented with the } on the line below. This is a major time saving behavior. It seems like delimitMate is disrupting VIM from auto indenting. Same thing happens with Javascript.

Any idea on how to solve this?

my .vimrc

set nocompatible              " be iMproved, required
filetype off                  " required

set t_Co=256
set background=dark
set term=screen-256color
color jellybeans 

" Lightline config
let g:lightline = {
      \ 'colorscheme': 'jellybeans',
      \ 'component': {
      \   'readonly': '%{&readonly?"⭤":""}',
      \ },
      \ 'separator': { 'left': '⮀', 'right': '⮂' },
      \ 'subseparator': { 'left': '⮁', 'right': '⮃' }
      \ }
set laststatus=2

" Tmuxline config
let g:tmuxline_preset = {
      \'a'    : '#S',
      \'win'  : ['#I', '#W'],
      \'cwin' : ['#I', '#W', '#F'],
      \'y'    : ['%R', '%a', '%Y'],
      \'z'    : '#H'}

" make backspace work
set backspace=2

" mps space to colon, time saver
nmap <space> :

" tcomment time saver
map <leader>c <c-_><c-_>

" tomment ESC key in xterm fix
if &term =~ 'screen' || &term =~ 'xterm'
  let g:CommandTCancelMap = ['<ESC>', '<C-c>']
endif

" allows for mouse scrolling
set mouse=a

" visual up and down movement through wrapped lines/paragraphs
noremap j gj
noremap k gk

" change mapleader from \ to ,
let mapleader=","

" Unmap the arrow keys
no <down> <Nop>
no <up> <Nop>
no <left> <Nop>
no <right> <Nop>
ino <down> <Nop>
ino <up> <Nop>
ino <left> <Nop>
ino <right> <Nop>

" quickly edit/reload vimrc and tmux.conf
nmap <silent> <leader>ev :e $MYVIMRC<CR>
nmap <silent> <leader>sv :so $MYVIMRC<CR>
nnoremap <silent> <leader>et :e ~/.tmux.conf<CR>
nnoremap <silent> <leader>st :so ~/.tmux.conf<CR>

" :tabnew
nmap <leader>tn :tabnew<CR> 
" :tabp
nmap gr :tabp<CR>

" set command-t height
let g:CommandTMaxHeight=10 

:map <MiddleMouse> "*p 
:map! <MiddleMouse> <C-R>* 

" enable +clipboard
set clipboard=unnamedplus

set tabstop=2
set expandtab
set shiftwidth=2
set autoindent
set ignorecase

set number
set showcmd
set title
set nobackup
set noswapfile

" Vim can highlight whitespaces for you in a convenient way:
set list
set listchars=tab:>_,trail:.,extends:#,nbsp:.

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim

call vundle#begin()

" let Vundle manage Vundle, required
Bundle 'gmarik/Vundle.vim'

"Bundle 'tpope/vim-fugitive'
"Bundle 'moll/vim-node'
"Bundle 'jelera/vim-javascript-syntax'
"Bundle 'pangloss/vim-javascript'
Bundle 'digitaltoad/vim-jade'
Bundle 'cakebaker/scss-syntax.vim'
Bundle 'kwaledesign/scss-snippets'
"Bundle 'scrooloose/nerdtree'
Bundle 'tpope/vim-surround'

Bundle 'tomtom/tcomment_vim'
"Bundle 'scrooloose/nerdcommenter'
" Bundle 'godlygeek/tabular'
" Bundle 'jamescarr/snipmate-nodejs'
Bundle 'MarcWeber/vim-addon-mw-utils'
Bundle 'tomtom/tlib_vim'
Bundle 'garbas/vim-snipmate'
Bundle 'Raimondi/delimitMate'
"Bundle 'nathanaelkane/vim-indent-guides'
"Bundle 'scrooloose/syntastic'
" Bundle 'Valloric/YouCompleteMe'
" Bundle 'marijnh/tern_for_vim'
Bundle 'edkolev/tmuxline.vim'
Bundle 'itchyny/lightline.vim'
"Bundle 'maksimr/vim-jsbeautify'
Bundle 'terryma/vim-multiple-cursors'

" Bundle from http://vim-scripts.org/vim/scripts.html
Bundle 'L9'
" Bundle 'togglecursor'

" Git plugin not hosted on GitHub
Plugin 'git://git.wincent.com/command-t.git'

" All of your Plugins must be added before the following line
call vundle#end()            " required

syntax on
filetype plugin indent on    " required
Raimondi commented 10 years ago

See if :help delimitMateExpansion helps.

siddhion commented 10 years ago

Ahh yes I found what I was looking for there. I just had to add

let delimitMate_expand_cr = 1
let delimitMate_expand_space = 1

to my .vimrc. I'm very suprised it is not set to 1 by default since it provides the expected behavior. Thanks a bunch :)

seantalts commented 10 years ago

thanks for posting the answer! Came here looking for the same thing :)