]> git.ipfire.org Git - people/ms/ipfire-3.x.git/commitdiff
vim: Update configuration file.
authorStefan Schantl <stefan.schantl@ipfire.org>
Sun, 21 Jul 2013 18:24:22 +0000 (20:24 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Sun, 21 Jul 2013 18:24:22 +0000 (20:24 +0200)
Enable the feature to put the cursor on it's last position
if a file gets opened again.

Fixes #10364.

vim/vim.nm
vim/vimrc

index 2863e9454b859873a9102960a85f731d948f479d..03540f5ccf1cb1dcc40a6c04570f0d6a69fb06fc 100644 (file)
@@ -5,7 +5,7 @@
 
 name       = vim
 version    = 7.3
-release    = 3
+release    = 4
 
 groups     = Applications/Editors
 url        = http://www.vim.org
@@ -13,8 +13,8 @@ license    = PublicDomain/Charityware
 summary    = Very feature- and powerful editor.
 
 description
-       Vim is a highly configurable text editor built to enable efficient \
-       text editing. It is an improved version of the vi editor \
+       Vim is a highly configurable text editor built to enable efficient
+       text editing. It is an improved version of the vi editor
        distributed with most UNIX systems.
 end
 
@@ -44,24 +44,28 @@ build
                --with-compiled-by="<bugzilla@ipfire.org>"
 
        configure_cmds
-               echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h
+               echo '#define SYS_VIMRC_FILE "%{sysconfdir}/vimrc"' >> src/feature.h
        end
 
        install_cmds
-               ln -sfv vim %{BUILDROOT}/usr/bin/vi
+               ln -sfv vim %{BUILDROOT}%{bindir}/vi
 
                # Install configuration
-               mkdir -pv %{BUILDROOT}/etc
-               cp -vf %{DIR_SOURCE}/vimrc %{BUILDROOT}/etc/vimrc
+               mkdir -pv %{BUILDROOT}%{sysconfdir}
+               cp -vf %{DIR_SOURCE}/vimrc %{BUILDROOT}%{sysconfdir}/vimrc
 
                # Remove script for c-shell
-               rm -rf %{BUILDROOT}/usr/share/vim/vim73/tools/vim132
+               rm -rf %{BUILDROOT}%{datadir}/vim/vim73/tools/vim132
        end
 end
 
 packages
        package %{name}
                groups += Base
+
+               configfiles
+                       %{sysconfidir}/vimrc
+               end
        end
 
        package %{name}-debuginfo
index f8b6666dc8e326a5f19ee30f01b9a751ad38712b..18c14813cb032ded0e46ad8cd14b7eed7c9ceef9 100644 (file)
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -1,6 +1,42 @@
+if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
+   set fileencodings=ucs-bom,utf-8,latin1
+endif
+
 set nocompatible
-set backspace=2
+set bs=indent,eol,start                " allow backspacing over everything in insert mode
+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
+
+" Only do this part when compiled with support for autocommands
+if has("autocmd")
+       augroup ipfire
+       autocmd!
+
+       " In text files, always limit the width of text to 78 characters
+       " autocmd BufRead *.txt set tw=78
+
+       " When editing a file, always jump to the last cursor position
+       autocmd BufReadPost *
+       \ if line("'\"") > 0 && line ("'\"") <= line("$") |
+       \   exe "normal! g'\"" |
+       \ endif
+
+       " don't write swapfile on most commonly used directories for NFS mounts or USB sticks
+       autocmd BufNewFile,BufReadPre /media/*,/mnt/* set directory=~/tmp,/var/tmp,/tmp
+
+       " start with spec file template
+       autocmd BufNewFile *.spec 0r /usr/share/vim/vimfiles/template.spec
+
+       augroup END
+endif
+
 syntax on
 if (&term == "iterm") || (&term == "putty")
   set background=dark
 endif
+
+" Don't wake up system with blinking cursor:
+" http://www.linuxpowertop.org/known.php
+let &guicursor = &guicursor . ",a:blinkon0"