What are your suggestions for an ideal Vim configuration for Perl development?

后端 未结 12 1023
说谎
说谎 2021-01-29 17:56

There are a lot of threads pertaining to how to configure Vim/GVim for Perl development on PerlMonks.org. My purpose in posting this question is to try to create, as much as pos

12条回答
  •  野的像风
    2021-01-29 18:21

    By far the most useful are

    1. Perl filetype pluging (ftplugin) - this colour-codes various code elements
    2. Creating a check-syntax-before-saving command "W" preventing you from saving bad code (you can override with the normal 'w').

    Installing he plugins are a bit dicky as the version of vim (and linux) put the plugins in different places. Mine are in ~/.vim/after/

    my .vimrc below.

    set vb
    set ts=2
    set sw=2
    set enc=utf-8
    set fileencoding=utf-8
    set fileencodings=ucs-bom,utf8,prc
    set guifont=Monaco:h11
    set guifontwide=NSimsun:h12
    set pastetoggle=
    command -range=% -nargs=* Tidy ,!
        \perltidy
    filetype plugin on
    augroup JumpCursorOnEdit
     au!
     autocmd BufReadPost *
     \ if expand(":p:h") !=? $TEMP |
     \ if line("'\"") > 1 && line("'\"") <= line("$") |
     \ let JumpCursorOnEdit_foo = line("'\"") |
     \ let b:doopenfold = 1 |
     \ if (foldlevel(JumpCursorOnEdit_foo) > foldlevel(JumpCursorOnEdit_foo - 1)) |
     \ let JumpCursorOnEdit_foo = JumpCursorOnEdit_foo - 1 |
     \ let b:doopenfold = 2 |
     \ endif |
     \ exe JumpCursorOnEdit_foo |
     \ endif |
     \ endif
     " Need to postpone using "zv" until after reading the modelines.
     autocmd BufWinEnter *
     \ if exists("b:doopenfold") |
     \ exe "normal zv" |
     \ if(b:doopenfold > 1) |
     \ exe "+".1 |
     \ endif |
     \ unlet b:doopenfold |
     \ endif
    augroup END
    

提交回复
热议问题