标签:vim
【vim配置】.vimrc
set nocompatible
set enc=utf-8
"-show line number
"set number
"-enable filetype plugin
filetype plugin on
set history=500
syntax on
set autoindent
set smartindent
"-show brackets match
set showmatch
"-show status
set ruler
"-close highline match
"set nohls
"-enable quick search
set incsearch
"-enable paste mode
set paste
"set tabstop=4
set ts=4
"set shiftwidth=4
set sw=4
"set expandtab
set et
if has("autocmd")
filetype plugin indent on
endif
autocmd filetype python setlocal et sta sw=4 sts=4
"-smart append title by file type
func SetTitle()
if &filetype == ‘sh‘
call setline(1, "\#!/bin/bash")
call append(line("."), "\# ")
call append(line(".")+1, "")
else
call setline(1, "\#!/usr/local/bin/python3")
call append(line("."), "\# ")
call append(line(".")+1, "")
endif
endfunc
autocmd BufNewFile *.py,*.sh exec ":call SetTitle()"
"-go to the end of file
autocmd BufNewFile * normal G
"-press F2 to delete empty line
nnoremap <F2> :g/^\s*$/d<CR>标签:vim
原文地址:http://nosmoking.blog.51cto.com/3263888/1594836