Created
November 15, 2012 08:07
-
-
Save ahmadseleem/4077319 to your computer and use it in GitHub Desktop.
vim config
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
" ================ General Config ==================== | |
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 visualbell "no sounds | |
set autoread "reload files changed outside vim | |
set autochdir | |
" Disable all blinking: | |
:set guicursor+=a:blinkon0 | |
" Remove previous setting: | |
:set guicursor-=a:blinkon0 | |
" Restore default setting: | |
:set guicursor& | |
:set lazyredraw | |
:set ttyfast | |
" this makes vim act like all other editors, buffers can | |
" exist in the background without being in a window. | |
set hidden | |
ino jj <Esc> | |
vmap nn <Esc> | |
filetype plugin on | |
"turn on syntax highlighting | |
syntax on | |
" copy text to osx clipboard on osx | |
vmap <c-c> y:call system("pbcopy", getreg("\""))<cr> | |
" could use * rather than *.*, but i prefer to leave .files unsaved | |
"au bufwinleave * silent! mkview "make vim save view (state) (folds, cursor, etc) | |
"au bufwinenter * silent! loadview "make vim load view (state) (folds, cursor, etc) | |
"disables tabs altogethe | |
autocmd bufwinenter,bufnewfile * silent tabo | |
" ================ gui ==================== | |
if has("gui_running") | |
"set guioptions=egmt | |
set transparency=15 | |
set guioptions=aace | |
set columns=150 | |
" looks a little better fullscreen | |
color molokai | |
set bg=dark | |
" expand width in fullscreen | |
set fuoptions=maxvert,maxhorz | |
" hide tab bar | |
set showtabline=0 | |
"set guifont=monaco:h16 " font size | |
set guifont=inconsolata:h20 " font family and font size. | |
endif | |
if has("gui_macvim") | |
macmenu &File.New\ Tab key=<nop> | |
map <D-t> <Plug>PeepOpen | |
end | |
" ===================== vim ui ====================== | |
set splitbelow | |
"" make nerdtree look nice | |
"let nerdtreeminimalui = 1 | |
"let nerdtreedirarrows = 1 | |
"let g:nerdtreewinsize = 30 | |
"let nerdtreechdirmode = 2 | |
"let nerdtreeshowhidden=1 | |
" | |
"" auto open nerd tree on startup | |
"let g:nerdtree_tabs_open_on_gui_startup = 0 | |
"" focus in the main content window | |
"let g:nerdtree_tabs_focus_on_files = 1 | |
" ================ 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment