]> git.rmz.io Git - dotfiles.git/blobdiff - vimrc
it's already run it /etc/profile
[dotfiles.git] / vimrc
diff --git a/vimrc b/vimrc
index 53183df21e21a7fbf941c120a0015bab0d2bc73c..99d28bada96f6e10eae9ce705ac61cb8cf3220a1 100644 (file)
--- a/vimrc
+++ b/vimrc
@@ -1,15 +1,8 @@
-" An example for a vimrc file.
+" My vimrc file.
 "
-" Maintainer:  Bram Moolenaar <Bram@vim.org>
-" Last change: 2008 Dec 17
+" Maintainer:   Samir Benmendil <ram-z@chakra-project.org>
 "
-" 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
@@ -29,16 +22,18 @@ set nocompatible
 set backspace=indent,eol,start
 
 if has("vms")
-  set nobackup         " do not keep a backup file, use versions instead
+  set nobackup          " do not keep a backup file, use versions instead
 else
-  set backup           " keep a backup file
+  set backup            " keep a backup file
   set backupdir=$HOME/.vim/backupdir
 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 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 number              " show some linenumbers
+" viminfo defaults but save file in .vim
+set viminfo='100,<50,s10,h,n~/.vim/viminfo
 
 " For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
 " let &guioptions = substitute(&guioptions, "t", "", "g")
@@ -95,8 +90,10 @@ if has("autocmd")
   " (happens when dropping a file on gvim).
   " Also don't do it when the mark is in the first line, that is the default
   " position when opening a file.
+  " blacklist certain filetype, you can get a file type with :echo &ft
+  let blacklist = ['gitcommit']
   autocmd BufReadPost *
-    \ if line("'\"") > 1 && line("'\"") <= line("$") |
+    \ if index(blacklist, &ft) < 0 && line("'\"") > 1 && line("'\"") <= line("$") |
     \   exe "normal! g`\"" |
     \ endif
 
@@ -104,7 +101,7 @@ if has("autocmd")
 
 else
 
-  set autoindent               " always set autoindenting on
+  set autoindent                " always set autoindenting on
 
 endif " has("autocmd")
 
@@ -113,7 +110,7 @@ endif " has("autocmd")
 " Only define it when not defined already.
 if !exists(":DiffOrig")
   command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
-                 \ | wincmd p | diffthis
+                  \ | wincmd p | diffthis
 endif
 
 " Ask what to do when closing unsaved documents
@@ -140,6 +137,8 @@ set shiftwidth=4
 set expandtab
 
 set showbreak=▒▒
+" show these chars for tabs and trailing spaces
+set list listchars=tab:»·,trail:·
 
 set pastetoggle=<F11>
 " split right when using :vsp
@@ -151,6 +150,17 @@ imap ii <Esc>
 " Press `` to toggle insert and replace mode (no <Insert> key on Mac keyboard)
 imap `` <Insert> 
 
+" fold between {{{ }}}
+set foldmethod=marker
+set foldlevelstart=99
+" space will toggle current fold in normal mode, if not in a fold, normal
+" behaviour
+nnoremap <silent> <Space> @=(foldlevel('.')?'za':"\<Space>")<CR>
+vnoremap <Space> zf
+" save and restore folds
+autocmd BufWinLeave *.* mkview
+autocmd BufWinEnter *.* silent loadview
+
 " Jump to the next or previous line that has the same level or a lower
 " level of indentation than the current line.
 "