1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-25 04:43:33 +00:00
freebsd-ports/editors/vim/files/vimrc
Adam Weinberger 41fd417789 Update to Vim to patchlevel 1439, change default python, improve vimrc
Some big changes in this update:

* Patchlevel 1439
* Default python is now 3.x instead of 2.x [1]
* Expose DEFAULT_VIMRC option (on by default) to vim-tiny

Also, many changes to the default vimrc. Any changes necessarily risk
contention, but then I remembered that I actually maintain editors/vim,
so here we are. The idea here is that Vim, by default, behaves like Vi,
and people who install the Vim port do so because they DON'T just want
Vi. I've enabled features that are basic quality-of-life settings for
me, and that I hope will be ideal for most end-users.

Important changes in the default vimrc:
* Don't install gvimrc at all. gvim should load $ETCDIR/vimrc anyway. I
  can't test gvim locally, so someone please let me know if I broke it.
* Turn on autoindent
* Disable console bells entirely. Console bells are terrible.
* Enable incsearch: highlights search results as you type them
* ^L clears search highlights while redrawing the screen
* Assume fast terminal by default
* Explain every setting in comments

Many of these settings are modeled after the defaults in NeoVim, which
really got it right. I want our default vimrc to be usable and ideal,
so please let me know if anything doesn't work for you, or if you have
other settings you'd like to see changed in the default.

In particular, please let me know if I broke gvim by removing the gvimrc!

PR:		235142 [1]
Submitted by:	John W. O'Brien [1]
2019-06-01 14:35:55 +00:00

35 lines
1.4 KiB
VimL

set nocompatible " Enable Vim mode (instead of vi emulation)
let g:is_posix = 1 " Our /bin/sh is POSIX, not bash
set autoindent " Intelligent indentation matching
set autoread " Update the file if it's changed externally
set backspace=indent,eol,start " Allow backspacing over anything
set belloff=all " Turn off bells
set display=truncate " Show '@@@' when the last screen line overflows
set formatoptions+=j " Delete comment char when joining lines
set history=100 " Undo up to this many commands
set hlsearch " Highlight search results
set incsearch " Highlight search matches as you type them
set ruler " Show cursor position
set ttyfast " Redraw faster for smoother scrolling
set wildmenu " Show menu for tab completion in command mode
try
syntax on " Enable syntax highlighting
catch | endtry " vim-tiny is installed without the syntax files
if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
set fileencodings=ucs-bom,utf-8,latin1
endif
" CTRL-L will mute highlighted search results
nnoremap <silent> <C-l> :<C-u>nohlsearch<CR><C-l>
augroup FreeBSD
autocmd!
autocmd BufNewFile /usr/ports/*/*/Makefile 0r /usr/ports/Templates/Makefile
if !empty($PORTSDIR)
autocmd BufNewFile $PORTSDIR/*/*/Makefile 0r $PORTSDIR/Templates/Makefile
endif
augroup END