Skip to content

Instantly share code, notes, and snippets.

@ahmadseleem
Last active December 27, 2015 17:29

Revisions

  1. ahmadseleem revised this gist Nov 7, 2013. No changes.
  2. ahmadseleem created this gist Nov 7, 2013.
    211 changes: 211 additions & 0 deletions after.vimrc
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,211 @@
    " ================ General Config ====================
    set nuw=3
    let g:Powerline_symbols = 'compatible'

    set number "Line numbers are good
    set backspace=indent,eol,start "Allow backspace in insert mode
    set history=1000 "Store lots of :cmdline history
    set showcmd "Show incomplete cmds down the bottom
    set showmode "Show current mode down the bottom
    set gcr=a:blinkon0 "disable cursor blink
    set guicursor+=a:blinkon0
    set visualbell "no sounds
    set autoread "reload files changed outside vim

    set noerrorbells visualbell t_vb=
    autocmd GUIEnter * set visualbell t_vb=

    let NERDTreeChDirMode=2
    nmap <C-u> :NERDTreeToggle<CR>
    " Indentaion G ==================
    set tabstop=1
    set shiftwidth=4
    set expandtab

    set list lcs=tab:\|\
    let g:indentLine_color_term = 111
    let g:indentLine_color_gui = '#2A2F34'
    "let g:indentLine_color_gui = '#DADADA'
    "let g:indentLine_char = '∙▹¦'
    let g:indentLine_char = ''

    " ===============================

    :set guicursor+=a:blinkon0 " Disable all blinking
    :set guicursor-=a:blinkon0 " Remove previous setting
    " Restore default setting:
    :set guicursor&
    :set lazyredraw
    :set ttyfast

    ino jj <Esc>
    vmap nn <Esc>
    " copy text to osx clipboard on osx
    vmap <c-c> y:call system("pbcopy", getreg("\""))<cr>
    "disables tabs altogethe
    autocmd bufwinenter,bufnewfile * silent tabo

    " ================ gui ====================

    if has("gui_macvim")
    " set guioptions=egmt
    " set transparency=15
    set guioptions=ce
    set columns=150
    " looks a little better fullscreen
    color atom
    "set bg=dark

    " expand width in fullscreen
    set fuoptions=maxvert,maxhorz
    " hide tab bar
    set showtabline=0
    "set guifont=Monaco\ for\ Powerline:h16 " font family and font size.
    set guifont=Source\ Code\ Pro\ For\ Powerline:h17
    endif

    " ===================== vim ui ======================
    "
    set splitbelow

    " ================ search settings =================

    set incsearch "find the next match as we type the search
    set hlsearch "hilight searches by default
    set viminfo='100,f1 "save up to 100 marks, enable capital marks

    " ================ turn off swap files ==============

    set noswapfile
    set nobackup
    set nowb

    " ================ persistent undo ==================
    " keep undo history across sessions, by storing in file.
    " only works all the time.

    set undodir=~/.vim/backups
    set undofile

    " ================ formating ========================

    "set matchpairs+=<:> " match, to be used with %
    set pastetoggle=<f11> " pastetoggle (sane indentation on pastes)
    "set comments=sl:/*,mb:*,elx:*/ " auto format comment blocks

    " ================ indentation ======================

    set autoindent
    set smartindent
    set smarttab
    set shiftwidth=2
    set softtabstop=2
    set tabstop=2
    set expandtab

    set wrap "don't wrap lines
    set linebreak "wrap lines at convenient points
    set nolist "improve line wrap

    " ================ movement ========================

    vmap <d-j> gj
    vmap <d-k> gk
    vmap <d-4> g$
    vmap <d-6> g^
    vmap <d-0> g^
    nmap <d-j> gj
    nmap <d-k> gk
    nmap <d-4> g$
    nmap <d-6> g^
    nmap <d-0> g^
    " ================ folds ============================

    set nofoldenable "dont fold by default

    " ================ completion =======================

    set wildmode=list:longest
    set wildmenu "enable ctrl-n and ctrl-p to scroll thru matches
    set wildignore=*.o,*.obj,*~ "stuff to ignore when tab completing
    set wildignore+=*vim/backups*
    set wildignore+=*sass-cache*
    set wildignore+=*ds_store*
    set wildignore+=vendor/rails/**
    set wildignore+=vendor/cache/**
    set wildignore+=*.gem
    set wildignore+=log/**
    set wildignore+=tmp/**
    set wildignore+=*.png,*.jpg,*.gif

    " ================ scrolling ========================

    set scrolloff=8 "start scrolling when we're 8 lines away from margins
    set sidescrolloff=15
    set sidescroll=0

    " -----------------------------------------------------------
    " == key (re)mappings ======================================
    " -----------------------------------------------------------

    "the default leader is '\', but many people prefer ',' as it's in a standard
    "location
    let mapleader = ','

    " making it so ; works like : for commands. saves typing and eliminates :w style typos due to lazy holding shift.
    nnoremap ; :
    " easier moving in tabs and windows
    map <c-j> <c-w>j<c-w>_
    map <c-k> <c-w>k<c-w>_
    map <c-l> <c-w>l<c-w>_
    map <c-h> <c-w>h<c-w>_
    " wrapped lines goes down/up to next row, rather than next line in file.
    "nnoremap j gj
    "nnoremap k gk

    " stupid shift key fixes
    cmap w w
    cmap wq wq
    cmap wq wq
    cmap q q
    cmap tabe tabe
    " yank from the cursor to the end of the line, to be consistent with c and d.
    nnoremap y y$
    "clearing highlighted search
    nmap <silent> <leader>/ :nohlsearch<cr>
    " visual shifting (does not exit visual mode)
    vnoremap < <gv
    vnoremap > >gv
    " adjust viewports to the same size
    map <leader>= <c-w>=

    " ==================== editing ============================
    let g:syntastic_quiet_warnings=1

    "ragtag for erb
    inoremap <M-o> <Esc>o
    inoremap <C-j> <Down>
    let g:ragtag_global_maps = 1

    " == snippets ===
    "autocmd BufNewFile,BufRead *.html.erb set filetype=html.eruby.rb
    "autocmd BufNewFile,BufRead *.css.scss set filetype=scss.css

    " == PeepOpen ===
    if has("gui_macvim")
    macmenu &File.New\ Tab key=<nop>
    map <D-t> <Plug>PeepOpen
    end