Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- " Function that returns the type of system. You need to
- " change this to the correct type: linux, mac, windows
- fun! MySys()
- return 'mac'
- endfun
- " Pathogen plugin configuration
- "call pathogen#runtime_append_all_bundles()
- " Makes Vim not compatible with vi
- set nocompatible
- " No lines are checked for set commands. Prevent security exploits.
- set modelines=0
- " Sets how many lines of history Vim has to remember
- set history=300
- " Enable filetype plugin and indent for specific file types
- filetype plugin on
- filetype indent on
- " Auto read a file if it is changed from the outside
- set autoread
- " Set numbers for lines
- set number
- " Number of spaces that a <Tab> in the file counts for.
- set tabstop=4
- " Number of spaces to use for each step of (auto)indent.
- set shiftwidth=4
- " Number of spaces that a <Tab> counts for while performing
- " editing operations, like inserting a <Tab> or using <BS>.
- set softtabstop=4
- " Use the appropriate number of spaces to insert a <Tab>.
- " If linecharstring:tab is used tab marks will not be shown
- " because they have been converted into spaces.
- set expandtab
- " List mode: Show tabs as CTRL-I is displayed, display $ after
- " end of line. Useful to see the difference between tabs and
- " spaces and for trailing blanks.
- set list
- " Strings to use in 'list' mode and for the :list command.
- " It is a comma separated list of string settings.
- " tab:xy - Two chars to be used to show a tab. First used one
- " second is repeated to fill the space of the tab
- " eol:c - Char to show at the end of each line
- set listchars=tab:»\ ,eol:←
- " Sets the character enconding to Unicode UTF8
- set encoding=utf-8
- if has("gui_running")
- set mouse=a " enable the mouse
- set guioptions-=T " remove the toolbar
- set t_Co=256 " number of colors
- colorscheme murphy " set a colorscheme
- else
- colorscheme slate
- endif
- " Try to set the language to Spanish
- try
- language es_ES
- catch
- endtry
- " This gives the end-of-line (<EOL>) formats that will be tried
- " when starting to edit a new buffer and when reading a file
- " into an existing buffer
- set fileformats=unix,dos,mac
- " Minimal number of screen lines to keep above and below the cursor.
- set scrolloff=4
- " Copy indent from current line when starting a new line (<CR>
- " in Insert mode or when using the "o" or "O" command).
- set autoindent
- " Do smart autoindenting when starting a new line. Works for
- " C-like programs, but can also be used for other languages.
- set smartindent
- " Enables automatic C program indenting. When you don't like
- " the way 'cindent' works, try the 'smartindent'
- set cindent
- " If in Insert, Replace or Visual mode put a message on
- " the last line.
- set showmode
- " Indicates when a line is wrapped by prefixing wrapped lie
- " with the choosen character.
- :set showbreak=>\
- " When off a buffer is unloaded when it is |abandon|ed.
- " When on a buffer becomes hidden when it is |abandon|ed.
- set hidden
- " When is on, command-line completion operates in an
- " enhanced mode.
- set wildmenu
- " No error beeps on errors
- set noerrorbells
- " Use visual bell instead of beeping.
- set novisualbell
- " No visual flashes on the display
- set vb t_vb=
- " Completion mode that is used for the character specified with
- " 'wildchar'. It is a comma separated list of up to four parts.
- " list:longest - When more than one match, list all matches and
- " complete till longest common string.
- " set wildmode=list:longest
- " Highlight the screen line of the cursor with CursorLine
- " set cursorline
- " Indicates a fast terminal connection. More characters will
- " be sent to the screen for redrawing, instead of using
- " insert/delete line commands.
- set ttyfast
- " Show the line and column number of the cursor position,
- " separated by a comma.
- " set ruler
- " Sets a ruler with a steroid format.
- " set rulerformat=%30(%=\:b%n%y%m%r%w\ %l,%c%V\ %P%)
- " Show (partial) command in the last line of the screen.
- set showcmd
- " The value of this option influences when the last window will
- " have a status line: 0: never 1: only if there are at least
- " two windows 2: always
- if has('statusline')
- set laststatus=2
- " Broken down into easily includeable segments
- set statusline=%<%f\ " Filename
- set statusline+=%w%h%m%r " Options
- "set statusline+=%{fugitive#statusline()} " Git Hotness
- set statusline+=\ [%{&ff}/%Y] " filetype
- set statusline+=\ [%{getcwd()}] " current dir
- set statusline+=\ [A=\%03.3b/H=\%02.2B] " ASCII / Hex value of char
- set statusline+=%=%-14.(%l,%c%V%)\ %p%% " Right aligned file nav info
- endif
- " Influences the working of <BS>, <Del>, CTRL-W and CTRL-U in
- " Insert mode. This is a list of items, separated by commas
- set backspace=indent,eol,start
- " Do not redraw while executing macros
- set nolazyredraw
- " Enable highlighting of text depending on filetype
- syntax enable
- " Set font according to system
- if MySys() == "mac"
- set guifont=Menlo:h14
- set shell=/bin/bash
- elseif MySys() == "windows"
- set guifont=Bitstream\ Vera\ Sans\ Mono:h10
- elseif MySys() == "linux"
- set guifont=Monospace\ 10
- set shell=/bin/bash
- endif
- " COLORS
- "
- " Highlighting used for eol, extends and precedes
- highlight NonText ctermfg=lightgray guifg=lightgray
- " Highlighting used for nbsp, tab and trail
- highlight SpecialKey ctermfg=lightgray guifg=lightgray
- " Change the <leader> key from the default "\" to "," (comma)
- let mapleader = ","
- let g:mapleader = ","
- " MANAGE LONG LINES OF TEXT
- "
- " Lines longer than the width of the window will wrap and
- " displaying continues on the next line
- set wrap
- " Maximum width of text that is being inserted. A longer line
- " will be broken after white space to get this width
- set textwidth=79
- " This is a sequence of letters which describes how automatic
- " formatting is to be done.
- " q = Allow formatting of comments with "gq".
- " r = Auto insert the current comment leader after hitting
- " <Enter> in Insert mode.
- " n = When formatting text, recognize numbered lists.
- " 1 = Don't break a line after a one-letter word. It's
- " broken before it instead (if possible).
- set formatoptions=qrn1
- " Comma separated list of screen columns that are highlighted
- " with ColorColumn 'hl-ColorColumn'
- " NEW in Vim 7.3
- " set colorcolumn=85
- " SEARCHING AND MOVING
- "
- " Ignore case in search patterns. Also used when searching
- " in the tags file.
- set ignorecase
- " Override the 'ignorecase' option if the search pattern
- " contains upper case characters.
- set smartcase
- " When on, the ":substitute" flag 'g' is default on.
- " This means that all matches in a line are substituted instead
- " of one. When a 'g' flag is given to a ":substitute" command,
- " this will toggle the substitution to one match.
- set gdefault
- " While typing a search command, show where the pattern, as it
- " was typed so far, matches. The matched string is highlighted.
- set incsearch
- " When a bracket is inserted, briefly jump to the matching one.
- " The jump is only done if the match can be seen on the screen.
- set showmatch
- " When there is a previous search pattern, highlight all
- " its matches.
- set hlsearch
- " MAPPINGS
- "
- " Insert a character in normal mode in the current char position
- :nnoremap s :exec "normal i".nr2char(getchar())."\e"<cr>
- " Insert a character in normal mode in the next char position
- :nnoremap S :exec "normal a".nr2char(getchar())."\e"<cr>
- " Fix Vim’s horribly broken default regex “handling” by
- " automatically inserting a \v before any string you search for.
- " This makes Vim regex work like Perl/Python regex formatting.
- nnoremap / /\v
- vnoremap / /\v
- " Map the <tab> key to the "%" key to make the <tab> key match
- " bracket pairs. Which makes a lot easier to move in source code.
- nnoremap <tab> %
- noremap <tab> %
- " This mapping makes it easy to clear the highlighting of a
- " previous search
- noremap <leader><space> :noh<cr>
- " Remap the F1 key to ESC. This will avoid getting the help
- " when trying aiming for escape.
- inoremap <F1> <ESC>
- nnoremap <F1> <ESC>
- vnoremap <F1> <ESC>
- " Remap the ';' key to do the same thing as the ':' key.
- " Will save one less key to type.
- nnoremap ; :
- " Save the file on losing focus
- autocmd FocusLost * :wa
- " Source changes to vimrc immediately
- autocmd BufWritePost ~/.vimrc :source ~/.vimrc
- " Add file extensions so they are handled with the
- " correct filetype
- autocmd BufRead,BufNewFile *.module set filetype=php
- autocmd BufRead,BufNewFile *.install set filetype=php
- autocmd BufRead,BufNewFile *.inc set filetype=php
- " Activate code completion for a programming language.
- autocmd FileType php set omnifunc=phpcomplete#CompletePHP
- " LEADER COMMANDS
- "
- " Strip all trailing whitespaces on the current file
- nnoremap <leader>W :%s/\s\+$//<cr>:let @/=''<cr>
- " Fold tag function to fold a section of text that is
- " between a pair of HTML tags
- nnoremap <leader>ft Vatzf
- " Re-hardwrap paragraphs of text.
- nnoremap <leader>q gqip
- " Reselect the text that was just pasted so you can
- " perform commands (like indentation) on it
- nnoremap <leader>v V`]
- " Open your ˜/.vimrc file in a vertically split window so
- " you can add new settings on the fly
- nnoremap <leader>ev <C-w><C-v><C-l>:e $MYVIMRC<cr>
- " Fast save a file
- nnoremap <leader>w :w!<cr>
- " WINDOW MAPPINGS
- "
- " Mapping to open a new vertical split and switch
- " over to it.
- nnoremap <leader>w <C-w>v<C-w>l
- " Mappings to facilitate moving around your splits.
- nnoremap <C-h> <C-w>h
- nnoremap <C-j> <C-w>j
- nnoremap <C-k> <C-w>k
- nnoremap <C-l> <C-w>l
Add Comment
Please, Sign In to add comment