Skip to content

Instantly share code, notes, and snippets.

@blake-simpson
Last active October 9, 2022 17:12
Show Gist options
  • Save blake-simpson/3343006 to your computer and use it in GitHub Desktop.
Save blake-simpson/3343006 to your computer and use it in GitHub Desktop.
Macvim Config
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
Bundle 'tpope/vim-fugitive'
Bundle 'tpope/vim-rails'
Bundle 'jpo/vim-railscasts-theme'
Bundle 'scrooloose/nerdtree'
Bundle 'kien/ctrlp.vim'
Bundle 'tsaleh/vim-supertab'
""Bundle 'myusuf3/numbers.vim'
Bundle 'scrooloose/syntastic'
Bundle 'groenewege/vim-less'
Bundle 'mileszs/ack.vim'
Bundle 'msanders/snipmate.vim'
Bundle 'scrooloose/nerdcommenter'
"" Syntastic plugin options
""
"" Enable symbols
let g:syntastic_check_on_open=0
"" Set symbol characters
let g:syntastic_error_symbol='✗'
let g:syntastic_warning_symbol='⚠'
"" Open and close error list console automatically
let g:syntastic_auto_loc_list=1
"" Choose a Javascript syntax checker
let g:syntastic_javascript_jshint_conf="~/.jshintrc"
let g:syntastic_javascript_syntax_checker="jshint"
"" Choose active file types and set default mode to passive (Use SyntasticToggleMode to enable active checking)
let g:syntastic_mode_map = { 'mode': 'passive', 'active_filetypes': ['ruby', 'php', 'js', 'css'], 'passive_filetypes': ['less'] }
filetype plugin indent on
"" Ctrl + E = Switch to previous buffer (file)
nmap <C-E> :b#<CR>
"" Ctrl-n to disable search match highlight
nmap <silent> <C-N> :silent noh<CR>
"" Retab the file and then save it
"" nmap <silent> <C-K> :silent retab<CR>:w<CR>
"" Ctrl + L to toggle better line numbers
"" nmap <silent> <C-L> :NumbersToggle<CR>
colorscheme railscasts
"" Don't create .swp files
set noswapfile
"" Show numbers
set nu
"" Highlight the current line
set cursorline
""Show dots for invisible hidden spaces (use blank spaces for tabs)
set list listchars=tab:\ \ ,trail:·
"" This converts tabs to soft tabs (spaces). Currentlly not using this though.
"" set expandtab
"" Set tabs to 4 spaces
set expandtab
set tabstop=4
set shiftwidth=4
set softtabstop=4
"" VIM will autoindent
set autoindent
set smartindent
"" Show possibilties when pressing tab
set wildmenu
"" Highlight search
set hlsearch
"" Hide GUI toolbar
set guioptions-=T
"" Set the leader key
let mapleader=","
"" Tell CtrlP to open with Leader + t
let g:ctrlp_map = '<Leader>t'
"" Setup CtrlP
let g:ctrlp_working_path_mode = 2
let g:ctrlp_root_markers = ['Gemfile', '.meteor', 'Rakefile']
let g:ctrlp_custom_ignore = '\.git$\|\vendor/*|\.sass-cache/*|\.meteor/*|output/*|build/*|node_modules/*|tmp/*|public/uploads/*|doc/*'
""Show NERDTree on start
autocmd vimenter * if !argc() | NERDTree | endif
""Remove whitespace on save
autocmd BufWritePre * if &ft != 'markdown' | :%s/\s\+$//e
function! SwitchTabStyle ()
if &tabstop == 2
set tabstop=4
set shiftwidth=4
set softtabstop=4
else
set tabstop=2
set shiftwidth=2
set softtabstop=2
endif
echo &tabstop
endfunction
nmap <C-K> :call SwitchTabStyle()<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment