Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- " An example for a vimrc file.
- "
- " Maintainer: Bram Moolenaar <[email protected]>
- " Last change: 2019 Dec 17
- "
- " To use it, copy it to
- " for Unix: ~/.vimrc
- " for Amiga: s:.vimrc
- " for MS-Windows: $VIM\_vimrc
- " for Haiku: ~/config/settings/vim/vimrc
- " for OpenVMS: sys$login:.vimrc
- " When started as "evim", evim.vim will already have done these settings, bail
- " out.
- if v:progname =~? "evim"
- finish
- endif
- " Get the defaults that most users want.
- source $VIMRUNTIME/defaults.vim
- if has("vms")
- set nobackup " do not keep a backup file, use versions instead
- else
- set backup " keep a backup file (restore to previous version)
- if has('persistent_undo')
- set undofile " keep an undo file (undo changes after closing)
- endif
- endif
- if &t_Co > 2 || has("gui_running")
- " Switch on highlighting the last used search pattern.
- set hlsearch
- endif
- " Put these in an autocmd group, so that we can delete them easily.
- augroup vimrcEx
- au!
- " For all text files set 'textwidth' to 78 characters.
- autocmd FileType text setlocal textwidth=78
- augroup END
- " Add optional packages.
- "
- " The matchit plugin makes the % command work better, but it is not backwards
- " compatible.
- " The ! means the package won't be loaded right away but when plugins are
- " loaded during initialization.
- if has('syntax') && has('eval')
- packadd! matchit
- endif
- "
- " Custom Rules added by me
- "
- " Enable syntax highlighting
- syntax on
- " Attempt to determine the type of a file based on its name and possibly its
- " contents. Use this to allow intelligent auto-indenting for each filetype,
- " and for plugins that are filetype specific.
- filetype indent plugin on
- " Better command-line completion
- set wildmenu
- " Show partial commands in the last line of the screen
- set showcmd
- " Highlight searches (use <C-L> to temporarily turn off highlighting; see the
- " mapping of <C-L> below)
- set hlsearch
- " When opening a new line and no filetype-specific indenting is enabled, keep
- " the same indent as the line you're currently on. Useful for READMEs, etc.
- set autoindent
- " Display line numbers on the left
- set number
- " Indentation settings for using 2 spaces instead of tabs.
- " Do not change 'tabstop' from its default value of 8 with this setup.
- set shiftwidth=4
- set softtabstop=4
- set expandtab
- " Display a dark-gray ruler at column 78
- set colorcolumn=78
- hi ColorColumn ctermbg=darkgray guibg=darkgray
- " When your cursor is moving away from matched strings, the highlight will
- " be turned off automatically if there is no matching.
- let g:incsearch#auto_nohlsearch = 1
- " Use default system clipboard as clipboard
- " Can be: unnamed and unnamedplus
- set clipboard=unnamedplus
- " I use F-keys to toggle visibility of things:
- nmap <F2> :set hlsearch!<CR>
- nmap <F3> :set number!<CR>
- nmap <F4> :set list!<CR>
- nmap <F5> :set cursorline!<CR>:set cursorcolumn!<CR>
Advertisement