再びvimまとめ(設定編)

2 Mins read

vimも.vimrcの設定次第でかなり使いやすいものとなります。
(windows版の場合は、_vimrcを追加・編集すればOkです)
以下は私がやっている例です。
肝となる部分だけ解説です。

シンタックス表示

syntax enable

行番号表示

set number

タブをソフトタブで、実施する

set tabstop=2 softtabstop=2 shiftwidth=2

記号文字の表示がおかしくならないように

set ambiwidth=double

バックアップファイルを作らない

set nobackup

など、

syntax enable
set modeline
set number
set tabstop=2 softtabstop=2 shiftwidth=2
set foldmethod=marker
set laststatus=2
" 記号文字の表示がおかしくならないように
set ambiwidth=double
filetype on
filetype indent on
filetype plugin on
colorscheme ron
set nobackup
set enc=utf-8set fileencodings=iso-2022-jp,sjis,euc-jp,utf-8
autocmd FileType php  :set omnifunc=phpcomplete#CompletePHP
autocmd FileType html,javascript :set omnifunc=javascriptcomplete#CompleteJSautocmd Filetype *
        \   if &omnifunc == "" |
        \       setlocal omnifunc=syntaxcomplete#Complete |
        \   endif
"-----------------------------------------------------------------------------"
source ~/.vim/vtreeexplorer.vim
let g:treeExplVertical=1
let g:treeExplWinSize=30
"
source ~/.vim/php-doc.vim
inoremap <c-P> <esc>:call PhpDocSingle()<cr>i
nnoremap <c-P> :call PhpDocSingle()<cr>
vnoremap <c-P> :call PhpDocRange()<cr>
source ~/.vim/php-doc.vim
inoremap <c-P> <esc>:call PhpDocSingle()<cr>i
nnoremap <c-P> :call PhpDocSingle()<cr>
vnoremap <c-P> :call PhpDocRange()<cr>
let g:pdv_cfg_Author   = "HASHIMOTO <hashimoto at vone dot jp>"
let g:pdv_cfg_Copyright= "xxxxx INC.2008 All rights reservied."
" phpファイルの場合 下矢印で文法チェックをする
autocmd FileType php :map <down> <esc>:!clear<cr>:!php -l %<cr>
autocmd FileType php :map <c-E> <esc>:!php %<cr>
"autocmd FileType php :set tabstop=4 softtabstop=4 shiftwidth=4

map <f12> <esc>:!php /home/hashimoto/tools/ftp.php %:p 1<cr>

map! =vimh // vim: set expandtab tabstop=2 softtabstop=2 shiftwidth=2 enc=utf8 :
map <left> <esc>:bp<cr>
map <right> <esc>:bn<cr>
map <up> <esc>:ls<cr>

"
function InsertTabWrapper()
    if pumvisible()
        return "\<c-n>"
    endif
    let col = col('.') - 1
    if !col || getline('.')[col - 1] !~ '\k\|<\|/'
        return "\<tab>"
    elseif exists('&omnifunc') && &omnifunc == ''
        return "\<c-n>"
    else
        return "\<c-x>\<c-o>"
    endif
endfunction