Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
.vimrc
" An example for a vimrc file.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last change: 2002 May 28
"
" To use it, copy it to
" for Unix and OS/2: ~/.vimrc
" for Amiga: s:.vimrc
" for MS-DOS and Win32: $VIM\_vimrc
" for OpenVMS: sys$login:.vimrc
" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
finish
endif
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
set autoindent " always set autoindenting on
if has("vms")
set nobackup " do not keep a backup file, use versions instead
else
set backup " keep a backup file
endif
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
set runtimepath^=~/.vim/bundle/ctrlp.vim
" set mapleader to space
let mapleader = " "
" -----------------------------------------------------
" vundle kurulumu
" -----------------------------------------------------
" $ git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
"
" -----------------------------------------------------
" vundle ile plugin kurulumu
" -----------------------------------------------------
" Once ~/.vimrc dosyasina kurmak istediğimiz plugin eklenir:
" Plugin 'tope/vim-commentary'
" Vim yeniden başlatılır ve su komut calistirilir:
" :PluginInstall
" Komut çalıştırılınca otomatik olarak pluginleri kurar.
" -----------------------------------------------------
" vundle icin gerekli setup [VUNDLE-BEGIN]
" -----------------------------------------------------
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
" call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required"
Plugin 'gmarik/Vundle.vim'
Bundle 'L9'
Plugin 'tpope/vim-dispatch'
Plugin 'tpope/vim-commentary'
Plugin 'tpope/vim-bundler'
Plugin 'tpope/vim-rails'
Plugin 'vim-ruby/vim-ruby'
Plugin 'tpope/vim-vinegar'
Plugin 'tpope/vim-fugitive'
Plugin 'kchmck/vim-coffee-script'
Plugin 'tpope/vim-endwise'
Plugin 'vim-scripts/surround.vim.git'
Plugin 'vim-scripts/closetag.vim.git'
Plugin 'Townk/vim-autoclose.git'
Plugin 'thoughtbot/vim-rspec'
Plugin 'NLKNguyen/papercolor-theme'
Plugin 'kien/ctrlp.vim.git'
Plugin 'ekalinin/Dockerfile.vim'
Plugin 'mileszs/ack.vim.git'
Plugin 'ton/vim-bufsurf.git'
Bundle 'FuzzyFinder'
Plugin 'c9s/bufexplorer.git'
Plugin 'scrooloose/nerdtree.git'
Plugin 'vim-scripts/mru.vim.git'
Plugin 'vim-scripts/The-NERD-Commenter.git'
Plugin 'plasticboy/vim-markdown'
Plugin 'elzr/vim-json.git'
Plugin 'jwhitley/vim-matchit.git'
Plugin 'tpope/vim-haml'
Plugin 'timcharper/textile.vim'
Plugin 'nathanaelkane/vim-indent-guides'
" -----------------------------------------------------
" vundle ile kurulan pluginler - [BEGIN]
" -----------------------------------------------------
"
" Ornekler:
" Plugin 'tpope/vim-fugitive' # plugin on GitHub repo
" Plugin 'L9' # plugin from http://vim-scripts.org/vim/scripts.html
" Plugin 'git://git.wincent.com/command-t.git' # github disindaki bir repo.
" Plugin 'file:///home/gmarik/path/to/plugin' # dosya sisteminde plugin
"
" vim-snipmate ve vim-snippet icin gerekenler
Bundle "MarcWeber/vim-addon-mw-utils"
Bundle "tomtom/tlib_vim"
Bundle "garbas/vim-snipmate"
Bundle "honza/vim-snippets"
Bundle 'slim-template/vim-slim.git'
" -----------------------------------------------------
" vundle ile kurulan pluginler - [END]
" -----------------------------------------------------
" All of your Plugins must be added before the following line
call vundle#end() " required"
"filetype plugin indent on " required"
" -----------------------------------------------------
" vundle icin gerekli setup [VUNDLE-END]
" -----------------------------------------------------
" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
" let &guioptions = substitute(&guioptions, "t", "", "g")
" Don't use Ex mode, use Q for formatting
map Q gq
" This is an alternative that also works in block mode, but the deleted
" text is lost and it only works for putting the current register.
"vnoremap p "_dp
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
filetype plugin indent on
" For all text files set 'textwidth' to 78 characters.
" autocmd FileType text setlocal textwidth=78
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
endif " has("autocmd")
" Necessary. This setting tells vim to load latex-suite
" when a tex file opened.
" filetype plugin on
" Optional. This enables automatic indentation as you
" type.
" filetype indent on
"
"
" set background=light
" colorscheme PaperColor
"colorscheme navajo-night
"colorscheme darkblue
"colorscheme vividchalk
"set lines=45
"set columns=95
set sw=2 "shiftwidth
set ts=2 "tabstop
set expandtab
set sts=2 "softtabstop
set nu
":retab
":.retab # sadece bulunduğumuz satırı tab'lemek için
set wildmode=list:longest
set hidden
" CTRL-A herseyi secsin
map <C-a> 1GvG$
"CTRL-S ==> save
map <C-s> :w<CR>
"CTRL-Y ==> Copy
map <C-y> "+y
"CTRL-P ==> Paste
"map <C-p> "+gP
map <leader>p "+gP
" Idea from : http://www.charlietanksley.net/blog/blog/2011/10/18/vim-navigation-with-lustyexplorer-and-lustyjuggler/
" Open CtrlP starting from a particular path, making it much
" more likely to find the correct thing first. mnemonic 'jump to [something]'
map <leader>jm :CtrlP app/models<CR>
map <leader>jc :CtrlP app/controllers<CR>
map <leader>jv :CtrlP app/views<CR>
map <leader>jh :CtrlP app/helpers<CR>
map <leader>jl :CtrlP lib<CR>
map <leader>js :CtrlP spec<CR>
map <leader>jd :CtrlP db<CR>
map <leader>jC :CtrlP config<CR>
map <leader>jF :CtrlP factories<CR>
map <leader>jT :CtrlP test<CR>
" tab'lar arsında ALT+1, ALT+2.. ALT+n ile dolaşmak için
map <A-1> 1gt
map <A-2> 2gt
map <A-3> 3gt
map <A-4> 4gt
map <A-5> 5gt
map <A-6> 6gt
map <A-7> 7gt
map <A-8> 8gt
map <A-9> 9gt
map <A-0> 10gt
" Sonraki/onceki tab
map <C-Tab> :tabnext<CR>
map <leader>n :tabnext<CR>
map <leader>b :tabprevious<CR>
set cindent
set showmatch
" ignore case when searching
set ignorecase
set smartcase
"--Buffers
nmap <F2> :sp<CR>:Exp<CR>
" Ruby syntax check
nmap <F3> :!ruby -c % <CR>
" Rub Ruby script
nmap <F4> :!ruby % <CR>
" erb syntax check
nmap <F5> :!erb -x -T '-' % \|ruby -c<CR>
" PHP syntax kontrol
"nmap <F6> :!php -l -f % <CR>
"Dikkat!!! F5 winmanager(wmanager) tarafından refresh yapmak icin kullaniliyor.
"nmap <F4> :ls<CR>:e #
" Renk düzeltir
"map <F4> mb<CR>:1<CR>o<ESC>dd<ESC>`b<CR>k
"nmap <F4> :!javac % <CR>
"nmap <F4> :!g++ % <CR>
"nmap <F4> :!gcc -lm % <CR>
"nmap <F5> :!./a.out <CR>
"nmap <F7> mzgg=G'z<CR>
"nmap <F6> :!tidy % <CR>
"map <F6> : !aspell -c %<CR>
map <F6> : !ispell %<CR>: e %<CR>
"nmap <F7> :!debugperl -c % <CR>
nmap <F8> :!tidy -i % <CR>
"nmap <F8> :TagbarToggle<CR>
"map <F8> gg"+yG
"nmap <F9> :!xmllint --valid --noout % <CR>
"nnoremap <F9> :Dispatch rspec %<CR>
nmap <F11> :NERDTreeToggle<CR>
"Split ile acilan pencereleri esit yukseklige getirir.
"nmap <F12> <C-W>=
"
"nmap <F5> :bp<CR>
"nmap <F6> :bn<CR>
"nmap <F7> :bd<CR>
"map <F5> :sil bp<C-M>
"map <F6> :sil bn<C-M>
"map <F7> :sil bd<C-M>
"map <C-u> :!ftpFtoPwdYing.sh %
"map <C-u> :!scpFtoYing.sh %
" ALT+j= escape olsun
"inoremap <M-j> <ESC>
"jj escape olsun
imap jj <ESC>
" ALT-h, Alt-j, Alt-k, Alt-l ile insert modunda cursor'u hareket ettirmek:
inoremap <M-h> <C-o>h
inoremap <M-j> <C-o>j
inoremap <M-k> <C-o>k
inoremap <M-l> <C-o>l
"--Abreviations
cab W w
cab Wq wq
cab wQ wq
cab WQ wq
cab Q q
set noerrorbells "be quiet, dont beep
set laststatus=2 "always show a status line
set nobackup
"Ignore case when searching
set ignorecase
set smartcase
" dosya~ seklinde backup dosyasi olusturma
set nowritebackup
" Bir kisim kisaltmalar
:ab func function
"":ab ### ############################################################<ESC>
:ab #-- #-----------------------------------------------------------<ESC>
"":ab #** #***********************************************************<ESC>
:ab *** ************************************************************<ESC>
:ab #!b #!/bin/bash<CR>
:ab #!e #!/usr/bin/env ruby<CR>
:ab #!p #!/usr/bin/perl<CR>
:ab #!r #!/usr/bin/ruby<CR>
:ab jq $(document).ready(function() {<ESC>o<ESC>o<ESC>i });<ESC>3hx<ESC>ki
:ab jqi $('#')<ESC>2h
" ruby, eruby
:au Filetype ruby :ab habtm has_and_belongs_to_many :object<ESC>6h
:au Filetype ruby,eruby :ab lgd logger.debug "--------------------"<ESC>10h
:au Filetype ruby,eruby :ab lge logger.error "--------------------"<ESC>10h
:au Filetype ruby,eruby :ab lgw logger.warn "--------------------"<ESC>10h
:au Filetype ruby,eruby :ab cld CUSTOM_LOGGER.debug "--------------------"<ESC>10h
":au Filetype eruby :ab <% <% %><ESC>2hi
":au Filetype eruby :ab <%= <%= %><ESC>2hi
":au Filetype eruby,html :ab br <br /><ESC>
":au Filetype eruby,html :ab hr <hr /><ESC>
:au Filetype ruby :ab #e \# encoding: utf-8<ESC>0x
:au Filetype ruby,eruby :ab ss #{
:au Filetype ruby,eruby :ab ta ta('')<ESC>2h
:au Filetype ruby,eruby :ab t t('')<ESC>2h
:au Filetype ruby,eruby set expandtab
"C
:au Filetype c :ab #i #include
:au Filetype c :ab #l /* -------------------------------------------------- */<ESC>
"C++
:au Filetype cpp :ab #s System.out.println("");<ESC>3h<ESC>
:au Filetype cpp :ab #l /* -------------------------------------------------- */<ESC>
"html
":au Filetype html,php :ab #m <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9">
" --- XML :ab ---
":au Filetype xml map <Leader>x <ESC>:%s/></>\r</g<ESC>ggVG="
":au Filetype xml,xsd,wsdl :ab <?x <?xml version="1.0" encoding="ISO-8859-9" standalone=""?><ESC>3h
":au Filetype xml,xsd,wsdl :ab <:e <xsd:element name=""<ESC>2h
":au Filetype xml,xsd,wsdl :ab <:s <xsd:sequence<ESC>h
":au Filetype xml,xsd,wsdl :ab <:c <xsd:complexType<ESC>2h
":au Filetype xml,xsd,wsdl :ab <E <ElementType name="" content="" model=""<ESC>22h
":au Filetype xml,xsd,wsdl :ab <e <element type="" minOccurs="" maxOccurs=""/><ESC>30h
":au Filetype xml,xsd,wsdl :ab <A <AttributeType name="" dt:type=""/><ESC>15h
":au Filetype xml,xsd,wsdl :ab <a <attribute type=""/><ESC>4h
"Perl
":au Filetype perl :ab #t $q->start_table({-class=>""});<ESC>4h
":au Filetype perl :ab #f $q->start_form({-action=>"", -method=>"post"});<ESC>21h
":au Filetype perl :ab :s use strict;<ESC>
":au Filetype perl :ab :w use warnings;<ESC>
" split line
"map + i<CR><ESC>
" java tags
"set tags=~/.vim/tags/java
"set tags=~/.vim/tags/cpp_tags
"set tags=~/.vim/tags/php.tags
" rails tags
"set tags=~/.vim/tags/rails
"set tags=./tags
set tags=tags
" C Comments
"set comments=sl:/*,mb:**,elx:*
set encoding=utf8
"set encoding=latin5
" closetag scripti icin: NOT: asagidaki zimbirti calismadi.
":au Filetype php,perl,html,xml,xsl source ~/.vim/plugin/closetag.vim
" Tarih
map! ;d <C-R>=strftime("%Y.%m.%d %T")<CR>
" --------------------------------------------------------------------
" Asagidaki satirlarin alindigi adres:
" http://www.pinkjuice.com/howto/vimxml/setup.xml
" --------------------------------------------------------------------
let $ADDED = '~/.vim/added'
map <Leader>cd :exe 'cd ' . expand ("%:p:h")<CR>
"nmap <F1> :w<CR>
"imap <F1> <ESC>:w<CR>a
:au Filetype xml,html map <Leader>x <ESC>:%s/></>\r</g<ESC>ggVG=
" indentation CTRL+i
map <C-i> ggVG=
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Installed
" www.vim.org/scripts/script.php?script_id=301
" $ADDED/xml.vim
" www.vim.org/scripts/script.php?script_id=39
" copied macros/matchit.vim to plugin/
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" XML
"map <Leader>x :set filetype=xml<CR>
" \:source $ADDED/xml.vim<CR>
" \:iunmap <buffer> <Leader>.<CR>
" \:iunmap <buffer> <Leader>><CR>
" \:inoremap \> ><CR>
" catalog should be set up
"nmap <Leader>l <Leader>cd:%w !xmllint --valid --noout -<CR>
"nmap <Leader>r <Leader>cd:%w !rxp -V -N -s -x<CR>
"vmap <Leader>px !xmllint --format -<CR>
"nmap <Leader>px !!xmllint --format -<CR>
"nmap <Leader>pxa :%!xmllint --format -<CR>
"nmap <Leader>i :%!xsltlint<CR>
" --------------------------------------------------------------------
" Yukardaki satirlarin alindigi adres:
" http://www.pinkjuice.com/howto/vimxml/setup.xml
" --------------------------------------------------------------------
"
"autocmd BufReadPre *.pdf set ro
"autocmd BufReadPost *.pdf %!pdftotext -nopgbrk "%" -
" rails snippets
autocmd BufNewFile,BufRead *.rb,*.rhtml,*.html.erb,*.build.xml source ~/.vim/scripts/rubysnippets.vim
" Requires fuzzyfinder and fuzzyfinder_textmate plugins
let g:fuzzy_ignore = "*.log"
let g:fuzzy_ignore = ".svn"
let g:fuzzy_ignore = ".git"
let g:fuzzy_matching_limit = 70
"map t :FuzzyFinderTextMate
"map t :FuzzyFinderBuffer
map <Leader>f :FuzzyFinderBuffer
"map t :FuzzyFinderFile
"map <leader>b :FuzzyFinderBuffer<CR>
" statusline'da rvm bilgisi gozuksun icin diye
"set statusline=[%n]\ %<%.99f\ %h%w%m%r%y%{exists('g:loaded_rvm')?rvm#statusline():''}%=%-16(\ %l,%c-%v\ %)%P
" Leader shortcuts for Rails commands
"map <Leader>m :Rmodel
"map <Leader>c :Rcontroller
"map <Leader>v :Rview
"map <Leader>u :Runittest
"map <Leader>f :Rfunctionaltest
"map <Leader>tm :RTmodel
"map <Leader>tc :RTcontroller
"map <Leader>tv :RTview
"map <Leader>tu :RTunittest
"map <Leader>tf :RTfunctionaltest
"map <Leader>sm :RSmodel
"map <Leader>sc :RScontroller
"map <Leader>sv :RSview
"map <Leader>su :RSunittest
"map <Leader>sf :RSfunctionaltest
" Folding
"set foldmethod=syntax
"set foldmethod=indent
"autocmd FileType ruby setlocal foldmethod=syntax
"autocmd FileType css setlocal foldmethod=indent
" bind control-l to <%= %>
imap <C-l> <%=<Space>
map <C-l> i<%=<Space>
imap <C-k> <><Esc>i
map <C-k> i<><Esc>i
" convert word into ruby symbol
"imap <C-k> <C-o>b:<Esc>Ea
"nmap <C-k> lbi:<Esc>E
" autocorrect.vim : Correct common typos and misspellings as you type
iabbrev teh the
iabbrev campaing campaign
iabbrev Campaing Campaign
iabbrev campaings campaigns
iabbrev safya sayfa
iabbrev sorna sonra
iabbrev catolog catalog
iabbrev promt prompt
iabbrev abstarct abstract
iabbrev pust puts
iabbrev lenght length
" Find file in current directory and edit it.
function! Find(name)
let l:list=system("find . -name '".a:name."' | perl -ne 'print \"$.\\t$_\"'")
let l:num=strlen(substitute(l:list, "[^\n]", "", "g"))
if l:num < 1
echo "'".a:name."' not found"
return
endif
if l:num != 1
echo l:list
let l:input=input("Which ? (CR=nothing)\n")
if strlen(l:input)==0
return
endif
if strlen(substitute(l:input, "[0-9]", "", "g"))>0
echo "Not a number"
return
endif
if l:input<1 || l:input>l:num
echo "Out of range"
return
endif
let l:line=matchstr("\n".l:list, "\n".l:input."\t[^\n]*")
else
let l:line=l:list
endif
let l:line=substitute(l:line, "^[^\t]*\t./", "", "")
execute ":e ".l:line
endfunction
command! -nargs=1 Find :call Find("<args>")
" another user defined command
" User-defined commands must start with a uppercase letter.
command MyRails sp ~/Workspace/command_reference/rails_my_quick_ref.txt
command MyRuby sp ~/Workspace/command_reference/ruby_my_quick_ref.txt
command MyJquery sp ~/Workspace/command_reference/jquery_my_quick_ref.txt
command MyBdd sp ~/Workspace/command_reference/bdd_my_quick_ref.textile
command MyMarkdown sp ~/Workspace/command_reference/markdown.txt
command MyCommands sp ~/Workspace/command_reference/commands.txt
command MySnippets sp ~/Workspace/command_reference/snippets.txt
command MyVim sp ~/Workspace/command_reference/vim_my_quick_ref.txt
command MyGit sp ~/Workspace/command_reference/git.txt
command MyCapybaraCheatSheet sp ~/Workspace/command_reference/capybara_cheat_sheet.txt
command MyDocker sp ~/Workspace/command_reference/docker.md
command MyKurulum sp ~/Workspace/command_reference/kurulum-apt-get.md
command Clipboard sp ~/.clipboard.txt
command Bp BufSurfBack
command Bn BufSurfForward
command Fuz FuzzyFinderBuffer
" NOT: Sadece :Dispatch komutu ile acik olan rspec dosyasindaki testler
" calistirilir.
" Overwrite g:rspec_command variable to execute a custom command.
" rspec --help to see other formatters and other options.
" let g:rspec_command = "!bundle exec rspec {spec} --format progress --no-color"
let g:rspec_command = "!bundle exec rspec {spec} --format progress"
" Rspec.vim mappings
map <Leader>t :call RunCurrentSpecFile()<CR>
map <Leader>s :call RunNearestSpec()<CR>
map <Leader>l :call RunLastSpec()<CR>
autocmd BufRead *_spec.rb nmap <F9> :w\|!clear && bundle exec rspec % --format documentation --color<cr>
" markdown code block
map <Leader>mc i ```<ESC>yyp
" This statement says that when starting to edit a new file that doesn't exist
" or when starting to edit a new buffer, after reading the file into the
" buffer, if the file matches the pattern *.md then set filetype=markdown
autocmd BufNewFile,BufRead *.md set filetype=markdown
" Make shift-insert work like in Xterm
map <S-Insert> <MiddleMouse>
map! <S-Insert> <MiddleMouse>
" Disable mouse at all
" set mouse=c
command DisableMouse set mouse=c
command MyDisableMouse set mouse=c
command ShrinkV :vertical resize -5
command GrowV :vertical resize +5
command Shrink :resize -5
command Grow :resize +5
" Add a colored column(red) at 90 to avoid going to far to the right:
set colorcolumn=90
" nnoremap ; :
" nnoremap : ;
" tmux ile sorun cikariyor.
" set background=dark
" colorscheme PaperColor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.