Skip to content

Instantly share code, notes, and snippets.

@iCasablanca
Last active October 16, 2018 02:52
Show Gist options
  • Save iCasablanca/2469618 to your computer and use it in GitHub Desktop.
Save iCasablanca/2469618 to your computer and use it in GitHub Desktop.
vimrc
" Vundle Enable vimrc
set nocompatible " not compatible with the old-fashion vi mode
filetype off " required!
" Setting up Vundle - the vim plugin bundler
let iCanHazVundle=1
let vundle_readme=expand('~/.vim/bundle/Vundle.Vim/README.md')
if !filereadable(vundle_readme)
echo "Installing Vundle.."
echo ""
silent !mkdir -p ~/.vim/bundle
silent !git clone http://github.com/VundleVim/Vundle.Vim ~/.vim/bundle/Vundle.Vim
let iCanHazVundle=0
endif
" Enable Vundle
set rtp+=~/.vim/bundle/Vundle.vim
" Let Vindle manage Plugins
call vundle#begin()
" Let Vindle manage Vundle
Plugin 'VundleVim/Vundle.vim'
" My Bundles here:
Plugin 'scrooloose/nerdtree'
Plugin 'tpope/vim-rails'
Plugin 'altercation/vim-colors-solarized'
Plugin 'maksimr/vim-jsbeautify'
call vundle#end()
" General
filetype plugin indent on
"smart ident HTML "filetype ident on
"set filetype=HTML
"set smartident
"gg=G
"syntax on
"solarized dark
syntax enable
set background=dark
colorscheme solarized
"solarized light
"syntax enable
"set background=light
"colorscheme solarized
set ruler
set hlsearch
set nu
"ruby env
"set tabstop=2
"set softtabstop=2
"set shiftwidth=2
"set noexpandtab
"python env
set textwidth=79 " lines longer than 79 columns will be broken
set shiftwidth=4 " operation >> indents 4 columns; << unindents 4 columns
set tabstop=4 " a hard TAB displays as 4 columns
set expandtab " insert spaces when hitting TABs
set softtabstop=4 " insert/delete 4 spaces when hitting a TAB/BACKSPACE
set shiftround " round indent to multiple of 'shiftwidth'
set autoindent " align the new line indent with the previous line
" define OpenURL (OSX)
:command -bar -nargs=1 OpenURL :!open <args>
" define OpenURL (Linux)
":command -bar -nargs=1 OpenURL :!firefox <targs>
" define OpenURL (Windows)
" :command -bar -nargs=1 OpenURL :!start cmd /cstart /b <args>
nmap \s :w<cr>
nmap \q :q!<cr>
nmap \f <C-f>
nmap \b <C-b>
nmap \d <C-d>
nmap \u <C-u>
nmap \r <C-r>
nmap \w <C-w>w
nmap \e :shell<cr>
nmap \h :call HtmlBeautify()<cr>
nmap \c :call CSSBeautify()<cr>
nmap \j :call JsBeautify()<cr>
nmap \n :call JsonBeautify()<cr>
"nmap \x :call JsxBeautify()<cr>
""
nmap \g :call Google()<CR>
fun! Google()
let keyword = expand("<cword>")
let url = "http://www.google.com/search?q=" . keyword
let path = "C:/Program Files (x86)/Google/Chrome/Application/"
exec '!"' . path . 'chrome.exe" ' . url
"exec 'silent !"' . path . 'chrome.exe" ' . url
endfun
nmap \l :call HandleURL()<cr>
fun! HandleURL()
let s:uri = matchstr(getline("."), '[a-z]*:\/\/[^ >,;]*')
echo s:uri
if s:uri != ""
let path = "C:/Program Files (x86)/Google/Chrome/Application/"
exec '!"' . path . 'chrome.exe" ' . s:uri
else
echo "No URI found in line."
endif
endfun
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment