diff options
author | alfred <alfred@FreeBSD.org> | 2014-11-16 10:32:18 +0800 |
---|---|---|
committer | alfred <alfred@FreeBSD.org> | 2014-11-16 10:32:18 +0800 |
commit | aaf0603bdd81101abacbeb4a659545d7a9292cf0 (patch) | |
tree | 3632471982df29c8b6d63db97745c86a10cd22ea /editors | |
parent | 213f90b3ca01a94578b236f15c5cabfe9734c721 (diff) | |
download | freebsd-ports-gnome-aaf0603bdd81101abacbeb4a659545d7a9292cf0.tar.gz freebsd-ports-gnome-aaf0603bdd81101abacbeb4a659545d7a9292cf0.tar.zst freebsd-ports-gnome-aaf0603bdd81101abacbeb4a659545d7a9292cf0.zip |
A nice default vimrc for new users.
Otherwise users get "vi compat mode" which gives very old and
unfriendly vi defaults that breaks arrow keys and backspace as well
as no color.
Expert users can disable this default vimrc via "make config".
Approved by: delphij
Diffstat (limited to 'editors')
-rw-r--r-- | editors/vim/Makefile | 12 | ||||
-rw-r--r-- | editors/vim/files/vimrc | 49 |
2 files changed, 60 insertions, 1 deletions
diff --git a/editors/vim/Makefile b/editors/vim/Makefile index 67ac09edca16..a409c2a9dad0 100644 --- a/editors/vim/Makefile +++ b/editors/vim/Makefile @@ -20,13 +20,14 @@ COMMENT?= Improved version of the vi editor PATCH_DEPENDS= ${LOCALBASE}/bin/gpatch:${PORTSDIR}/devel/patch -OPTIONS_DEFINE= CSCOPE EXUBERANT_CTAGS LUA NLS PERL PYTHON RUBY TCL XTERM_SAVE +OPTIONS_DEFINE= CSCOPE EXUBERANT_CTAGS LUA NLS PERL PYTHON RUBY TCL XTERM_SAVE DEFAULT_VIMRC OPTIONS_SINGLE= UI OPTIONS_SINGLE_UI= ATHENA CONSOLE GNOME GTK2 MOTIF X11 OPTIONS_SUB= yes ATHENA_DESC= Athena GUI toolkit CSCOPE_DESC= cscope support CONSOLE_DESC= Console/terminal mode +DEFAULT_VIMRC_DESC= Install a default vimrc for new users EXUBERANT_CTAGS_DESC= Use exctags instead of ctags UI_DESC= User interface XTERM_SAVE_DESC= Restore xterm screen after exit @@ -88,6 +89,8 @@ MAKE_ARGS+= CONF_OPT_FEAT=--with-features=big \ PLIST_SUB+= NON_LITE="" .endif +OPTIONS_DEFAULT+= DEFAULT_VIMRC + ATHENA_MAKE_ARGS= CONF_OPT_GUI=--enable-gui=athena ATHENA_USE= XORG=xaw CONSOLE_MAKE_ARGS= CONF_OPT_GUI="--enable-gui=no --without-x" @@ -121,6 +124,10 @@ X11_USE= XORG=x11,xt IGNORE= this port has new UI option (CONSOLE) for users who do not need GUI support. Please run "make config" to modify your setting .endif +.if ${PORT_OPTIONS:MDEFAULT_VIMRC} +DEFAULT_VIMRC_LOCATION=${PREFIX}/share/vim +.endif + .if ${PORT_OPTIONS:MCONSOLE} || ${PORT_OPTIONS:MX11} PLIST_SUB+= GUI="@comment " .else @@ -183,5 +190,8 @@ post-install: .endif ${INSTALL_DATA} ${FILESDIR}/vietnamese_viscii.vim ${STAGEDIR}${DATADIR}/${VIM_VER}/keymap/ ${TOUCH} ${STAGEDIR}${DATADIR}/${VIM_VER}/lang/.keepme +.if ${PORT_OPTIONS:MDEFAULT_VIMRC} + ${INSTALL_DATA} ${FILESDIR}/vimrc ${STAGEDIR}${DEFAULT_VIMRC_LOCATION}/vimrc +.endif .include <bsd.port.post.mk> diff --git a/editors/vim/files/vimrc b/editors/vim/files/vimrc new file mode 100644 index 000000000000..64321a3d2e50 --- /dev/null +++ b/editors/vim/files/vimrc @@ -0,0 +1,49 @@ +" Uncomment the next line to make Vim more Vi-compatible +" From ubuntu's vimrc, slightly modified for FreeBSD ports. +"set compatible + +" Vim5 and later versions support syntax highlighting. Uncommenting the next +" line enables syntax highlighting by default. +if has("syntax") + syntax on +endif + +" This is the problem most of the time. +set nocompatible + +" Sensible backspace setting, seems to work on most terminals. +set backspace=2 + +" If using a dark background within the editing area and syntax highlighting +" turn on this option as well +"set background=dark + +" Uncomment the following to have Vim jump to the last position when +" reopening a file +"if has("autocmd") +" au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif +"endif + +" Uncomment the following to have Vim load indentation rules and plugins +" according to the detected filetype. +"if has("autocmd") +" filetype plugin indent on +"endif + +" The following are commented out as they cause vim to behave a lot +" differently from regular Vi. They are highly recommended though. +"set showcmd " Show (partial) command in status line. +"set showmatch " Show matching brackets. +"set ignorecase " Do case insensitive matching +"set smartcase " Do smart case matching +"set incsearch " Incremental search +"set autowrite " Automatically save before commands like :next and :make +"set hidden " Hide buffers when they are abandoned +"set mouse=a " Enable mouse usage (all modes) + +" Source a global configuration file if available +if filereadable($VIMRUNTIME . "/vimrc") + source $VIMRUNTIME . "/vimrc" +endif + + |