summaryrefslogtreecommitdiff
path: root/editors/vim/files/vimrc
blob: cc200a086c9daa6739af0b726ded1a4bd0cc68d1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
" FreeBSD provides this file for three reasons:
"   1. Some of the default settings are not great (e.g. backspace)
"   2. FreeBSD requires some special handling (e.g. g:is_posix)
"   3. vim-tiny doesn't ship with $VIMRUNTIME/defaults.vim, so any
"      settings that vim-tiny gets must appear in this file

" defaults.vim will override this file. Sourcing it here and
" setting the skip flag prevents clobbering settings
source $VIMRUNTIME/defaults.vim
let skip_defaults_vim = 1

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