2017-07-23 11:49 GMT+03:00 Length Power <elearn2014@gmail.com>:
> here is my .vimrc
>
> 1 execute pathogen#infect()
> 2 execute pathogen#helptags()
> 3 syntax on
> 4 filetype plugin indent on
> 5
> 6 let g:pydiction_location = '/home/guest/.vim/bundle/dict/pydiction/complete-dict'
> 7 let g:pydiction_menu_height = 10
> 8
> 9 au FileType python call PyFun()
> 10 function PyFun()
> 11 set tags+=/home/guest/.vim/tags/python.tag
> 12 autocmd FileType python set omnifunc=pythoncomplete#Complete
> 13 endfunction
> 14
> 15 au FileType c call CFun()
> 16 function CFun()
> 17 set tags+=/home/guest/.vim/tags/c.tag
> 18 autocmd FileType c set omnifunc=ccomplete#Complete
> 19 endfunction
> 20
> 21 au FileType php call PhpFun()
> 22 function PhpFun()
> 23 set dictionary-=$HOME/.vim/bundle/dict/vim-php-dictionariy/dict/PHP.dict dictionary+=$HOME/.vim/bundle/dict/vim-php-dictionary/dict/PHP.dict
> 24 autocmd FileType php set omnifunc=phpcomplete#Complete
> 25 endfunction
> 26
> 27 let g:tern_show_signature_in_pum = 1
>
>
> :source .vimrc
>
> result in some error info
>
> Error detected while processing /home/guest/.vimrc:
> line 13:
> E122: Function PyFun already exists, add ! to replace it
> line 19:
> E122: Function CFun already exists, add ! to replace it
> line 25:
> E122: Function PhpFun already exists, add ! to replace it
> Press ENTER or type command to continue
>
> Are there something wrong to fix?
There are many things wrong here, but with this vimrc you should be
restarting Vim in order to not get the errors (or add bang like it
requests, but if you keep writing code like this better just restart).
"Wrong":
1. You are defining autocmds which run something on FileType event …
in a function which is *already* run on FileType event. I am not sure
whether these autocommands work, but this is a waste. Just remove all
`autocmd FileType {ft} {cmd}` from functions, keeping only `{cmd}`
parts.
This is a waste not only because of needless autocmd creation, but
because new autocmd setting omnifunc will be added each time you open
php, etc file, this way after opening two php files you will have two
autocommands doing the same thing.
2. All autocommands are supposed to be in an augroup with a unique
name unless you want troubles (creating duplicate autocommands each
time) on resourcing vimrc. Example is right below `:h :augroup`.
3. Do not use `:set` for filetype-specific options, there is `:setlocal`.
>
> --
> --
> You received this message from the "vim_use" 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
>
> ---
> You received this message because you are subscribed to the Google Groups "vim_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
--
You received this message from the "vim_use" 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
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment