Created
December 1, 2016 02:18
-
-
Save GregLevenhagen/d0821cd0e96a78631bcf792a6bdd0d27 to your computer and use it in GitHub Desktop.
macOS .vimrc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| set nocompatible | |
| " Remove ALL auto-commands. This avoids having the autocommands twice when | |
| " the vimrc file is sourced again. | |
| autocmd! | |
| " Suffixes that get lower priority when doing tab completion for filenames. | |
| " These are files we are not likely to want to edit or read. | |
| set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc | |
| set encoding=utf-8 | |
| set showcmd " display incomplete commands | |
| set ruler | |
| set laststatus=2 " Always show the statusline | |
| set number " show line numbers | |
| " tab settings | |
| filetype plugin indent on " load file type plugins + indentation from indent folder | |
| set autoindent " should not interfere with filetype based indentation, but smartident would | |
| set tabstop=4 | |
| set shiftwidth=4 | |
| set expandtab " use spaces, not tabs | |
| " Whitespace, except tabs | |
| set nowrap " don't wrap lines | |
| set backspace=indent,eol,start " make backspace work like most other apps | |
| " Searching | |
| set hlsearch " highlight matches | |
| set incsearch " incremental search | |
| set ignorecase " searches are case insensitive | |
| set smartcase " depends on ignorecase: searches case insensitive unless one capital is used | |
| " Menu | |
| set wildmenu | |
| set wildmode=list:longest,full | |
| set sidescroll=1 | |
| set updatecount=0 | |
| set taglength=0 | |
| set tags+=../tags,/usr/local/include/tags,/usr/include/tags | |
| set wrapscan | |
| set shell=$SHELL\ -f | |
| set report=1 | |
| set noshowmode | |
| set showmatch | |
| set helpheight=100 | |
| set nostartofline | |
| set highlight=l:MySearch | |
| set clipboard=autoselect | |
| set visualbell t_vb= | |
| set viminfo='20,\"50 | |
| set backupdir=/tmp | |
| let c_syntax_for_h=1 | |
| let perl_fold=1 | |
| if &fileformat == "dos" || &term =~ "xterm" || &term =~ "vt220" | |
| set title | |
| endif | |
| autocmd BufEnter * let &titlestring = $HOSTNAME . ":" . expand("%:p:~") | |
| " turn search highlighting on and off | |
| map <F5> :set hls!<bar>set hls?<CR> | |
| imap <F5> <Esc>:set hls!<bar>set hls?<CR>i | |
| map <F6> :r !date<CR> | |
| imap <F6> <Esc>:r !date<CR>i | |
| map M :set paste!<bar>set paste?<CR> | |
| map F :set formatoptions=tcql<bar>set tw=72<CR> | |
| map s :source $HOME/.vimrc<CR> | |
| " map Ctrl-A, Ctrl-E, and Ctrl-K in *all* modes. map! makes the mapping work | |
| " in insert and commandline modes too. | |
| " map <C-A> <Home> | |
| " map <C-E> <End> | |
| " map <C-K> J | |
| " map! <C-A> <Home> | |
| " map! <C-E> <End> | |
| " imap <C-K> <Esc>Ji | |
| " Turn off incremental searching for files over 10,000,000 bytes. It's too slow. | |
| function! IncSearch() | |
| if line2byte(line("$")) < 10000000 | |
| set incsearch | |
| else | |
| set noincsearch | |
| endif | |
| endfunction | |
| autocmd BufReadPost * call IncSearch() | |
| autocmd BufEnter * doautocmd FileType | |
| if &filetype == "" | |
| setfiletype text | |
| endif | |
| function! PoundComment() | |
| map - 0i# <ESC>j | |
| map _ :s/^\s*# \=//g<CR>j | |
| set comments=:# | |
| endfunction | |
| function! LispComment() | |
| map - 0i; <ESC>j | |
| map _ :s/^\s*; \=//g<CR>j | |
| set comments=:; | |
| endfunction | |
| function! HTMLComment() | |
| map - $a --><ESC>0i<!-- <ESC><CR> | |
| map _ :s/^\s*<!-- \=//g<CR>:s/ \=-->[ \t]*$//g<CR>j | |
| set tw=0 formatoptions=tcq | |
| endfunction | |
| function! CComment() | |
| map - $a */<ESC>0i/* <ESC><CR> | |
| map _ :s/^\s*\/\* \=//g<CR>:s/ \=\*\/[ \t]*$//g<CR>j | |
| set nocindent comments=sr:/*,mb:*,ex:*/,:// | |
| " set nocindent comments=:/*,:// | |
| endfunction | |
| function! TexComment() | |
| map - 0i% <ESC>j | |
| map _ :s/^\s*% \=//g<CR>j | |
| set nocindent comments=sr:%,mb:%,el:%,:// | |
| set tw=72 formatoptions=tcqro | |
| endfunction | |
| function! CPlusPlusComment() | |
| map - 0i// <ESC>j | |
| map _ :s/^\s*\/\/ \=//g<CR>j | |
| set nocindent comments=:\/\/ | |
| endfunction | |
| function! VHDLComment() | |
| map - 0i-- <ESC>j | |
| map _ :s/^\s*-- \=//g<CR>j | |
| set comments=:-- | |
| endfunction | |
| function! SpiceComment() | |
| map - 0i* <ESC>j | |
| map _ :s/^\s*\* \=//g<CR>j | |
| set comments=:* | |
| endfunction | |
| function! ConfigComment() | |
| map - 0idnl <ESC>j | |
| map _ :s/^\s*dnl \=//g<CR>j | |
| set comments=:dnl | |
| endfunction | |
| function! VimComment() | |
| map - 0i" <ESC>j | |
| map _ :s/^\s*" \=//g<CR>j | |
| set comments=:\" | |
| endfunction | |
| function! XDefaultsComment() | |
| map - 0i! <ESC>j | |
| map _ :s/^\s*! \=//g<CR>j | |
| set comments=:\! | |
| endfunction | |
| function! PostscriptComment() | |
| map - 0i%% <ESC>j | |
| map _ :s/^\s*%%\= \=//g<CR>j | |
| set comments=:\! | |
| endfunction | |
| function! FT_text() | |
| call PoundComment() | |
| set tw=72 formatoptions=tcq | |
| endfunction | |
| autocmd Filetype html call HTMLComment() | |
| autocmd Filetype vhdl call VHDLComment() | |
| autocmd Filetype c call CComment() | |
| autocmd Filetype cs call CComment() | |
| autocmd Filetype js call CComment() | |
| autocmd Filetype synopsys call CComment() | |
| autocmd Filetype tex call TexComment() | |
| autocmd Filetype cpp call CPlusPlusComment() | |
| autocmd Filetype java call CPlusPlusComment() | |
| autocmd Filetype verilog call CPlusPlusComment() | |
| autocmd Filetype xdefaults call XDefaultsComment() | |
| autocmd Filetype config call ConfigComment() | |
| autocmd Filetype vim call VimComment() | |
| autocmd Filetype lisp call LispComment() | |
| autocmd Filetype skill call LispComment() | |
| autocmd Filetype dosini call LispComment() | |
| autocmd Filetype spice call SpiceComment() | |
| autocmd Filetype perl call PoundComment() | |
| autocmd Filetype apache call PoundComment() | |
| autocmd Filetype csh call PoundComment() | |
| autocmd Filetype sh call PoundComment() | |
| autocmd Filetype cdslib call PoundComment() | |
| autocmd Filetype tcl call PoundComment() | |
| autocmd Filetype xs call PoundComment() | |
| autocmd Filetype make call PoundComment() | |
| autocmd Filetype conf call PoundComment() | |
| autocmd Filetype fvwm call PoundComment() | |
| autocmd Filetype samba call PoundComment() | |
| autocmd Filetype postscr call PostscriptComment() | |
| autocmd Filetype text call FT_text() | |
| " highlighting for the GUI mode | |
| highlight Normal guifg=#e5e5e5 guibg=#000000 | |
| highlight Comment guifg=#009900 | |
| highlight Keyword guifg=#ffffff gui=bold | |
| highlight Statement guifg=#ffffff | |
| highlight String guifg=#87cefa | |
| highlight PreProc guifg=#ff8247 | |
| highlight Define guifg=#ff8247 | |
| highlight Include guifg=#ff8247 | |
| highlight Defined guifg=#ffff00 | |
| highlight Function guifg=#ffff00 gui=bold | |
| highlight Type guifg=#ff82a0 | |
| highlight StorageClass guifg=#ff82a0 | |
| highlight MySearch guibg=#0000ff | |
| highlight Constant guifg=#ffffff | |
| highlight Special guifg=#87cefa | |
| highlight Identifier guifg=#ffffff | |
| set background=dark | |
| syntax enable |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment