Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- " ============================================================================
- " VIMRC file
- " --------------------------------------------------
- " Developed while learning Vimscript
- " at HTTP://learnvimscriptthehardway.stevelosh.com
- " ============================================================================
- " ============================================================================
- " GLOBAL OPTIONS
- " ============================================================================
- " {{{
- " -----------------------------
- " ensure Vim settings are used
- " -----------------------------
- set nocompatible
- " ---------------------------
- " Map Leader and Local Leader
- " ---------------------------
- let mapleader = '-'
- let maplocalleader = '\\'
- " ------------
- " Code folding
- " ------------
- augroup filetype_vim
- autocmd!
- autocmd FileType vim setlocal foldmethod=marker
- autocmd FileType vim :normal! zM
- augroup end
- " }}}
- " ============================================================================
- " FORMATTING OPTIONS
- " ============================================================================
- " {{{
- " ---------------------
- " Colors and formatting
- " ---------------------
- colorscheme badwolf
- "-- ensure background consistency
- "-- when scrolling in a terminal
- set t_ut=
- " ------------------
- " Set line numbering
- " ------------------
- set number numberwidth=4
- set relativenumber
- " -----------------------
- " Line-control mechanisms
- " -----------------------
- set nowrap
- " ---------------------
- " Tab stops and spacing
- " ---------------------
- set tabstop=4
- set softtabstop=4
- set shiftwidth=4
- set expandtab
- " }}}
- " ============================================================================
- " MAPPINGS AND COMMANDS
- " ============================================================================
- " {{{
- " -------------------
- " Custom key mappings
- " -------------------
- " -- normal mode mappings
- " -----------------------
- " {{{
- " - word at cursor position to uppercase
- nnoremap <leader>u viwU
- " - quick configuration file editing
- nnoremap <leader>ev :vsplit $MYVIMRC<cr>
- nnoremap <leader>sv :source $MYVIMRC<cr>:echo $MYVIMRC "sourced"<cr>
- " - shortcut to toggle highlighting after a search
- nnoremap <leader>hh :set hlsearch!<cr>
- " - highlight trailing white space and line end
- " with Error color pattern
- nnoremap <leader>w :match Error /\v\s+$/<cr>
- " - open or close quick fix window
- " {{{
- nnoremap <leader>q :call QuickfixToggle()<cr>
- " -- set variable and close quick fix window
- let g:quickfix_is_open = 0
- cclose
- " -- quick fix toggle function
- function! QuickfixToggle()
- if g:quickfix_is_open
- cclose
- let g:quickfix_is_open = 0
- execute g:quickfix_return_to_window . "wincmd w"
- else
- let g:quickfix_return_to_window = winnr()
- copen
- let g:quickfix_is_open = 1
- endif
- endfunction
- " }}}
- " - move to next and previous results in quick fix window
- nnoremap cn :cnext<cr>
- nnoremap cp :cprevious<cr>
- " - toggle cursor line highlighting
- " -- cursor line highlighting
- nnoremap <leader>cl :set cursorline!<cr>
- " }}}
- " -- visual mode mappings
- " -----------------------
- " {{{
- " }}}
- " -- insert mode mappings
- " -----------------------
- " {{{
- " }}}
- " -------------
- " Abbreviations
- " -------------
- " }}}
- " ============================================================================
- " OTHER CONFIGURATION OPTIONS
- " ============================================================================
- " {{{
- " ------------------
- " Enable visual menu
- " ------------------
- set wildmenu
- " --------------------
- " Show matching [{()}]
- " --------------------
- set showmatch
- " ------------
- " Code folding
- " ------------
- set foldenable
- set foldlevelstart=10
- set foldnestmax=10
- set foldmethod=indent
- " --------------
- " Syntax options
- " --------------
- " -- highlighting on
- syntax enable
- " -- filetype indent on
- filetype indent on
- " --------------
- " Search options
- " --------------
- " -- highlight search
- set hlsearch
- " -- incremental search
- set incsearch
- " --------------
- " Spell checking
- " --------------
- set spell spelllang=en_us
- " ----------------
- " show status line
- " ----------------
- set laststatus=2
- " ---------------------
- " customize status line
- " ---------------------
- set statusline =%-30.30t
- set statusline+=%#StatusLineNC#
- set statusline+=\ %y\ %r
- set statusline+=%=
- set statusline+=%m
- set statusline+=\ %c,%l
- set statusline+=\ [%L]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement