Skip to content

Inserting a use statement switches off auto indentation #37

Open
@dbatten5

Description

@dbatten5

Using:
NeoVim version 0.2.2

init.vim config:

" Alphabetisize the use statements
let g:php_namespace_sort_after_insert = 1

" Insert the use statement
function! IPhpInsertUse()
    call PhpInsertUse()
    call feedkeys('a',  'n')
endfunction
autocmd FileType php inoremap <leader>u <Esc>:call IPhpInsertUse()<CR>
autocmd FileType php noremap <leader>u :call PhpInsertUse()<CR><Paste>

" Expand a class name to the qualified name
function! IPhpExpandClass()
    call PhpExpandClass()
    call feedkeys('a', 'n')
endfunction
autocmd FileType php inoremap <leader>ex <Esc>:call IPhpExpandClass()<CR>
autocmd FileType php noremap <leader>ex :call PhpExpandClass()<CR>

Inserting a use statement works as expected but when I go to insert a new line, the cursor starts at the very start of the line as opposed to the correct indentation like so:

screen shot 2018-01-08 at 12 23 22
screen shot 2018-01-08 at 12 25 45

This can be rectified with the command :set autoindent but this only applies to the current buffer

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions