Update of /etc/skel/.vimrc and /etc/vim/vimrc, added /etc/skel/.vim/ftplugin/c.vim
authorMichael Prokop <mika@grml.org>
Sat, 10 Feb 2007 10:34:26 +0000 (11:34 +0100)
committerMichael Prokop <mika@grml.org>
Sat, 10 Feb 2007 10:34:26 +0000 (11:34 +0100)
debian/changelog
etc/skel/.vim/ftplugin/c.vim [new file with mode: 0644]
etc/skel/.vimrc
etc/vim/vimrc

index 28f9941..880c136 100644 (file)
@@ -1,3 +1,10 @@
+grml-etc-core (0.2.20) unstable; urgency=low
+
+  * Update of /etc/skel/.vimrc and /etc/vim/vimrc, added
+    /etc/skel/.vim/ftplugin/c.vim.
+
+ -- Michael Prokop <mika@grml.org>  Sat, 10 Feb 2007 11:33:13 +0100
+
 grml-etc-core (0.2.19) unstable; urgency=low
 
   * /etc/vim/vimrc: make sure we use 'syntax on' only when we
diff --git a/etc/skel/.vim/ftplugin/c.vim b/etc/skel/.vim/ftplugin/c.vim
new file mode 100644 (file)
index 0000000..19df122
--- /dev/null
@@ -0,0 +1,100 @@
+" Filename:      c.vim
+" Purpose:       configuration file for c programming with Vim
+" Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>, Bart Trojanowski <bart@jukie.net>
+" Bug-Reports:   see http://grml.org/bugs/
+" Latest change: Sam Feb 10 11:31:21 CET 2007 [mika]
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" This file is heavily based on Bart's blog entry
+" "vim and linux CodingStyle" => http://jukie.net/~bart/blog/20070209172606
+
+" some general options
+  set noexpandtab                  " use tabse, not spaces
+  set tabstop=8                    " tabstops of 8
+  set shiftwidth=8                 " indents of 8
+  set textwidth=78                 " screen in 80 columns wide, wrap at 78
+  set autoindent smartindent       " turn on auto/smart indenting
+  set smarttab                     " make <tab> and <backspace> smarter
+  set backspace=eol,start,indent   " allow backspacing over indent, eol, & start
+  set foldmethod=syntax            " syntax highlighting items specify folds
+
+" keybindings
+  nmap <C-J> vip=                  " forces (re)indentation of a block of code
+"  imap if(      if () {<cr>}<esc>k$2hi
+"  imap ife(     <ESC>:call IfElse()<CR>a
+"  imap while(   while () {<cr>}<esc>k$2hi
+"  imap switch(  switch () {<cr>default:<cr>break;<cr>}<esc>3k$2hi
+"  imap do{      <ESC>:call DoWhile()<CR>a
+"  imap for(     for (;;) {<cr>}<esc>k$3hi
+
+" Edit compile speedup (hotkeys)
+" --------- start info -----------------
+" F2 - update file without confirmation
+" F3 - file open dialog
+" F5 - calls manual of function
+" F6 - list all errors
+" F7 - display previous error
+" F8 - display next error
+" --------- end info -------------------
+  map <F2>  :update<CR>
+  map <F3>  :browse confirm e<CR>
+  map <F5>  <Esc>:! man <cfile> <CR>
+  map <F6>  :copen<CR>
+  map <F7>  :cp<CR>
+  map <F8>  :cn<CR>
+
+" abbreviations...
+  abb #i #include
+  abb #d #define
+  abb #f #ifdef
+  abb #n #endif
+"  iab ,I if()<CR>{<CR>}<ESC>kk$i
+"  iab ,F for(;;)<CR>{<CR>}<ESC>kk$hhi
+"  iab ,E else<CR>{<CR>}<ESC>O
+
+" syntax highlighting
+  syntax on
+  syn keyword cType uint ubyte ulong uint64_t uint32_t uint16_t uint8_t boolean_t int64_t int32_t int16_t int8_t u_int64_t u_int32_t u_int16_t u_int8_t
+  syn keyword cOperator likely unlikely
+  syn match ErrorLeadSpace /^ \+/         " highlight any leading spaces
+  syn match ErrorTailSpace / \+$/         " highlight any trailing spaces
+
+" C-mode formatting options
+"   t auto-wrap comment
+"   c allows textwidth to work on comments
+"   q allows use of gq* for auto formatting
+"   l don't break long lines in insert mode
+"   r insert '*' on <cr>
+"   o insert '*' on newline with 'o'
+"   n recognize numbered lists
+  set formatoptions=tcqlron
+
+" C-mode options (cinoptions==cino)
+" N     number of spaces
+" Ns    number of spaces * shiftwidth
+" >N    default indent
+" eN    extra indent if the { is at the end of a line
+" nN    extra indent if there is no {} block
+" fN    indent of the { of a function block
+" gN    indent of the C++ class scope declarations (public, private, protected)
+" {N    indent of a { on a new line after an if,while,for...
+" }N    indent of a } in reference to a {
+" ^N    extra indent inside a function {}
+" :N    indent of case labels
+" =N    indent of case body
+" lN    align case {} on the case line
+" tN    indent of function return type
+" +N    indent continued algibreic expressions
+" cN    indent of comment line after /*
+" )N    vim searches for closing )'s at most N lines away
+" *N    vim searches for closing */ at most N lines away
+  set cinoptions=:0l1t0g0
+
+" folding
+"  - reserve 4 columns on the left for folding tree
+"  - fold by syntax, use {}'s
+"  - start with all folds open
+  if winwidth(0) > 80
+    set foldcolumn=4
+  endif
+
+" EOF
index 9da7583..0e4820f 100644 (file)
@@ -3,7 +3,7 @@
 " Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
 " Bug-Reports:   see http://grml.org/bugs/
 " License:       This file is licensed under the GPL v2.
-" Latest change: Mon Jun 05 16:30:29 CEST 2006 [mika]
+" Latest change: Sam Feb 10 11:20:38 CET 2007 [mika]
 "###############################################################################
 " Thanks to Sven Guckes for his template!
 "###############################################################################
@@ -20,6 +20,7 @@
 "  set list listchars=tab:»·,trail:·
   set listchars=eol:$,precedes:«,extends:»,tab:»·,trail:·
   set viminfo=%,'50,\"100,:100,n~/.viminfo
+  set tags=./tags,./TAGS,tags,TAGS,../tags,../../tags,../../../tags,../../../../tags
 
 " autocommands:
 " when the file type is "mail" then set the textwidth to "70":
@@ -33,6 +34,7 @@
 "  hi nontext  ctermfg=blue   ctermbg=black guifg=blue   guibg=black
 " switch on syntax coloring!! "bunt ist meine lieblingsfarbe!" :-)
   syn on
+" set t_Co=256                " number of colors
 
 " some useful mappings:
   set pastetoggle=<f11>
 " Kill quote spaces (when quoting a quote)
   map ,kqs mz:%s/^> >/>>/<cr>
 
+" Interface to Mercurial Version Control
+  if filereadable( "/usr/share/doc/mercurial/examples/vim/hg-menu.vim" )
+    source /usr/share/doc/mercurial/examples/vim/hg-menu.vim
+  endif
+
 " Vim 7 brings cool new features - see ':he version7'!
 " The coolest features of Vim7 by mika
 " ====================================
index 838cacc..020ba51 100644 (file)
@@ -3,7 +3,7 @@
 " Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
 " Bug-Reports:   see http://grml.org/bugs/
 " License:       This file is licensed under the GPL v2.
-" Latest change: Fre Feb 09 14:32:09 CET 2007 [mika]
+" Latest change: Sam Feb 10 11:07:20 CET 2007 [mika]
 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 
 " All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just
 " can find below.  If you wish to change any of those settings, you should do it
 " in the file /etc/vim/vimrc.local, since debian.vim will be overwritten
 " everytime an upgrade of the vim packages is performed and this file
-" (/etc/vim/vimrc) every time the package grml-etc is upgraded.  It is
+" (/etc/vim/vimrc) every time the package grml-etc-core is upgraded.  It is
 " recommended to make changes after sourcing debian.vim since it alters the
 " value of the 'compatible' option.
 
 " This line should not be removed as it ensures that various options are
 " properly set to work with the Vim-related packages available in Debian.
-runtime! debian.vim
+  runtime! debian.vim
 
 " Uncomment the next line to make Vim more Vi-compatible
 " NOTE: debian.vim sets 'nocompatible', but only if debian.vim is available,
 " so let's make sure we run in nocompatible mode:
-set nocompatible
+  set nocompatible
+
 " Setting 'compatible' changes numerous
 " options, so any other options should be set AFTER setting 'compatible'.
-"set compatible
+" set compatible
 
-set backspace=indent,eol,start " more powerful backspacing
+  set backspace=indent,eol,start        " more powerful backspacing
 
 " Now we set some defaults for the editor
-set autoindent         " always set autoindenting on
-" set linebreak                " Don't wrap words by default
-set textwidth=0                " Don't wrap lines by default
-set nobackup           " Don't keep a backup file
-set backupcopy=no      " grml: Overwrite files/links with w!
-" set backupcopy=yes   " Keep a backup file
-set viminfo='20,\"50   " read/write a .viminfo file, don't store more than
-                       " 50 lines of registers
-set history=50         " keep 50 lines of command line history
-set ruler              " show the cursor position all the time
+  set autoindent        " always set autoindenting on
+" set linebreak         " Don't wrap words by default
+  set textwidth=0       " Don't wrap lines by default
+  set nobackup          " Don't keep a backup file
+  set backupcopy=no     " grml: Overwrite files/links with w!
+" set backupcopy=yes    " Keep a backup file
+  set viminfo='20,\"50  " read/write a .viminfo file, don't store more than
+                        " 50 lines of registers
+  set history=50        " keep 50 lines of command line history
+  set ruler             " show the cursor position all the time
 
 " Suffixes that get lower priority when doing tab completion for filenames.
 " These are files we are not likely to want to edit or read.
-set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc
+  set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc
 
 " Make p in Visual mode replace the selected text with the "" register.
-vnoremap p <Esc>:let current_reg = @"<CR>gvdi<C-R>=current_reg<CR><Esc>
+  vnoremap p <Esc>:let current_reg = @"<CR>gvdi<C-R>=current_reg<CR><Esc>
 
 " Vim5 and later versions support syntax highlighting.
 " Just load the main syntax file when Vim was compiled with "+syntax".
@@ -60,7 +61,7 @@ vnoremap p <Esc>:let current_reg = @"<CR>gvdi<C-R>=current_reg<CR><Esc>
 
 " If using a dark background within the editing area and syntax highlighting
 " turn on this option as well
-set background=dark
+  set background=dark
 
 " begin of grml specials:
 "  set list listchars=tab:»·
@@ -69,34 +70,36 @@ set background=dark
 
 " Uncomment the following to have Vim jump to the last position when
 " reopening a file
-"if has("autocmd")
-"  au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
-"    \| exe "normal g'\"" | endif
-"endif
+" if has("autocmd")
+"   au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
+"     \| exe "normal g'\"" | endif
+" endif
 
 " Uncomment the following to have Vim load indentation rules according to the
 " detected filetype. Per default Debian Vim only load filetype specific
 " plugins.
-"if has("autocmd")
-"  filetype indent on
-"endif
+  if has("autocmd")
+    filetype indent on
+  endif
 
 " The following are commented out as they cause vim to behave a lot
 " differently from regular Vi. They are highly recommended though.
-  set showcmd          " Show (partial) command in status line.
-  set showmatch                " Show matching brackets.
-"set ignorecase                " Do case insensitive matching
-"set smartcase         " Do smart case matching
-"set incsearch         " Incremental search
-"set autowrite         " Automatically save before commands like :next and :make
+  set showcmd           " Show (partial) command in status line.
+  set showmatch         " Show matching brackets.
+" set ignorecase        " Do case insensitive matching
+" set smartcase         " Do smart case matching
+" set incsearch         " Incremental search
+" set autowrite         " Automatically save before commands like :next and :make
 " When switching between different buffers you can't use undo without 'set hidden':
- set hidden             " Hide buffers when they are abandoned
-"set mouse=a           " Enable mouse usage (all modes) in terminals
+  set hidden            " Hide buffers when they are abandoned
+" set mouse=a           " Enable mouse usage (all modes) in terminals
+
+  set pastetoggle=<f11>               " don't change text when copy/pasting
+  set dictionary=/usr/share/dict/word " used with CTRL-X CTRL-K
 
 " Source a global configuration file if available
-" XXX Deprecated by Debian but as grml's package grml-etc provides this file
-" it is still valid
-if filereadable("/etc/vim/vimrc.local")
-  source /etc/vim/vimrc.local
-endif
+" Deprecated by Debian but still supported by grml
+  if filereadable("/etc/vim/vimrc.local")
+    source /etc/vim/vimrc.local
+  endif
 " EOF