Last active
April 19, 2018 12:53
-
-
Save MatheusFaria/10986138 to your computer and use it in GitHub Desktop.
VIM Configuration File
This file contains 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
"Syntax Color | |
syntax on | |
"Line Number | |
set number | |
"Always in paste mode | |
"set paste | |
"Indentation whith Spaces | |
set expandtab | |
set tabstop=4 | |
set shiftwidth=4 | |
set autoindent | |
"Indentation per language | |
autocmd FileType html setlocal shiftwidth=2 tabstop=2 | |
autocmd FileType css setlocal shiftwidth=2 tabstop=2 | |
autocmd FileType ruby setlocal shiftwidth=2 tabstop=2 | |
autocmd FileType perl setlocal shiftwidth=2 tabstop=2 | |
autocmd FileType python setlocal shiftwidth=4 tabstop=4 | |
autocmd FileType lua setlocal shiftwidth=4 tabstop=4 | |
autocmd FileType c setlocal shiftwidth=4 tabstop=4 smartindent | |
autocmd FileType cpp setlocal shiftwidth=4 tabstop=4 smartindent | |
autocmd FileType javascript setlocal shiftwidth=4 tabstop=4 | |
"Code Folding | |
"set foldmethod=indent | |
"set nofoldenable | |
"set foldlevel=99 | |
"Tab Options | |
set tabpagemax=15 | |
map! <C-Right> <Esc>:tabn<CR> | |
map! <C-Left> <Esc>:tabp<CR> | |
nmap <C-Right> <Esc>:tabn<CR> | |
nmap <C-Left> <Esc>:tabp<CR> | |
"Redo | |
nmap r <C-r> | |
"Mark the current line | |
set cursorline | |
"Show unwanted white spaces | |
set list | |
set listchars=tab:>-,trail:~,extends:>,precedes:< | |
"Search option | |
set ignorecase | |
set hlsearch | |
nnoremap <CR> :nohlsearch<CR><CR> | |
"Make backspace work | |
set backspace=indent,eol,start | |
"Turn off sounds | |
set belloff=all | |
"File Encoding | |
set encoding=utf-8 | |
set fileencoding=utf-8 | |
set pastetoggle=<F2> | |
"Highlight exceding character in the 80th colunm | |
"highlight OverLength ctermbg=red ctermfg=white guibg=#592929 | |
"match OverLength /\%81v.\+/ | |
set colorcolumn=80 | |
"Font Style and Size - GUI | |
if has("gui_running") | |
if has("gui_gtk2") | |
set guifont=Inconsolata\ 12 | |
elseif has("gui_win32") | |
set guifont=Consolas:h11:cANSI | |
endif | |
endif | |
"Copy and paste from and to clipboard | |
if has("unix") | |
let s:uname = system("uname -s") | |
" regex to check if it is a Mac OS | |
if s:uname =~ "darwin" | |
command Copyfile w !pbcopy | |
command Copyline .w !pbcopy | |
nmap <F6> :set paste<CR>:r !pbpaste<CR>:set nopaste<CR> | |
imap <F6> <Esc>:set paste<CR>:r !pbpaste<CR>:set nopaste<CR> | |
nmap <F7> :.w !pbcopy<CR><CR> | |
vmap <F7> :w !pbcopy<CR><CR> | |
else | |
command Copyfile w !xclip -selection clipboard | |
command Copyline .w !xclip -selection clipboard | |
nmap <F6> :set paste<CR>:r !xclip -selection clipboard -o <CR>:set nopaste<CR> | |
imap <F6> <Esc>:set paste<CR>:r !xclip -selection clipboard -o <CR>:set nopaste<CR> | |
nmap <F7> :.w !xclip -selection clipboard<CR><CR> | |
vmap <F7> :w !xclip -selection clipboard<CR><CR> | |
endif | |
endif | |
" Ignore the following extensions when you try to autocomplete file path | |
set wildignore=*.o,*.pyc,*~,*.swp,*.swo | |
" Incrementally searchs while typing | |
set incsearch | |
" Always shows the line and colunm on the bottom left of the screen | |
set ruler | |
" Always keeps N lines before and after the cursor line | |
set scrolloff=15 | |
" Ignores files with those extensions in the file explorer | |
let g:netrw_list_hide= '^[.]*.*\.s[a-w][a-z]$,^.*\.py[co]$,^.*DS_Store$,^.*\.o$,^.*\~$' | |
" Tips and Tricks | |
" Access the serach buffer: ctrl + r and slash (/) | |
" Access the "yank" buffer: ctrl + r and quotes (") | |
" Access the word under the cursor: ctrl + r and ctrl + w |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment