java - I edited vim configuration file and error occured (on MS Windows, error says "don't know "%\" option) -


i'm using ms windows first, i'm novice in programming , linux , many question here, i'm sorry

i wanted comfile java source code on gvim , searched googled.. found post , found code "myjava.vim", configuration , _vimrc code

and error occured

here myjava.vim if config file java

~/.vim/myjava.vim


set cindent set smartindent set ai syntax on  " indent config set sw=4 sts=4 ts=8 et  " compile , execution map <f6> :!java %:r<space> map <f7> :w<enter>:make<enter>  " compile config set makeprg=javac %\ set errorformat=%a%f:%l:\ %m,%-z%p^,%-c%.%#  " finding compile error map ,n :cn<enter> map ,p :cp<enter> map ,l :cl<enter> map ,w :cw<enter>  " set block , auto annotation vmap ,c :s/^/\/\//g<enter> vmap ,uc :s/^\/\///g<enter>  " taglist config nnoremap <silent> <f8> :tlist<cr> nnoremap <silent> <f9> :w<cr>:tlistupdate<cr> let tlist_inc_winwidth=0 let tlist_use_right_window=1  " ctags config set tags=~/.javatags set complete=.,w,b,u,t,i  " abbreviation config ab sysout system.out.println();<esc>hi ab syserr system.out.println();<esc>hi ab debug if (log.isdebugenabled()) {<cr>log.debug();<cr>}<cr><esc>kkf(a 

in line 14 error occured "don't know %\ option"

and here _vimrc code didn't know have place code in _vimrc file , put in end.


let tlist_ctags_cmd="c:\programs\ctags554\ctags.exe"  au bufnewfile,bufread *.java :source ~/.vim/myjava.vim 

i chanded ~/.vim/myjava.vim c:\program files (x86)\vim\vim74\myjava.vim don't know right

this _vimrc file _vimrc reads myjava.vim automatically when reading *.java files


set nocompatible source $vimruntime/vimrc_example.vim source $vimruntime/mswin.vim behave mswin  set diffexpr=mydiff() function mydiff()   let opt = '-a --binary '   if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif   if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif   let arg1 = v:fname_in   if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif   let arg2 = v:fname_new   if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif   let arg3 = v:fname_out   if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif   let eq = ''   if $vimruntime =~ ' '     if &sh =~ '\<cmd'       let cmd = '""' . $vimruntime . '\diff"'       let eq = '"'     else       let cmd = substitute($vimruntime, ' ', '" ', '') . '\diff"'     endif   else     let cmd = $vimruntime . '\diff'   endif   silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq endfunction   let tlist_ctags_cmd="c:\programs\ctags554\ctags.exe"  au bufnewfile,bufread *.java :source c:\program files (x86)\vim\vim74\myjava.vim 

i made myjava.vim , put in vim74 folder , edited _vimrc file in vim folder

and opened java file, windows said don't know "%\ option"

please correct code error. thank reading.

the error message getting escaping problem. inside set in vim need escape spaces:

set makeprg=javac\ % 

is correct makeprg setup. % filename of current buffer being edited.

moreover, have @ $vimruntime variable (just :echo $vimruntime in vim find it). on system variable amounts c:\program files (x86)\vim\vim74

this way can autocmd follows:

au bufnewfile,bufread *.java :source $vimruntime/myjava.vim 

vim uses forward slash on ms windows (unless in string passed command line, or shellslash set).


finally, @vgr right faster vim answers on http://vi.stackexchange.com (our vim part of website)


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -