]> code.delx.au - dotfiles/commitdiff
Gratuitous restructuring of vim config
authorJames Bunton <jamesbunton@delx.net.au>
Fri, 12 Oct 2007 09:57:57 +0000 (19:57 +1000)
committerJames Bunton <jamesbunton@delx.net.au>
Fri, 12 Oct 2007 09:57:57 +0000 (19:57 +1000)
 * Hopefully easier to understand
 * Some cool autocmds for setting textwidth when editing latex & mail files

.vim/backup.vim [deleted file]
.vim/display.vim
.vim/filetypes.vim [new file with mode: 0644]
.vim/indent.vim
.vim/macros.vim [moved from .vim/commands.vim with 100% similarity]
.vim/mouse.vim [deleted file]
.vim/search.vim [deleted file]
.vim/state.vim
.vimrc

diff --git a/.vim/backup.vim b/.vim/backup.vim
deleted file mode 100644 (file)
index 66007e1..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-" Make a backup (i. e. 'file~') and save it.
-set backup
-" create ~/tmp/ if it doesn't exist and use ~/tmp to save the 
-" backups into
-if has("unix")
-       if !isdirectory(expand("~/tmp/vimbak/."))
-               !mkdir -p ~/tmp/vimbak
-       endif
-endif
-set backupdir=~/tmp/vimbak
index fdbce7e367449473c3868c80c28e4bccb6b51ebc..3397c4c68759d3188f1c9c6d53855f6d16f33389 100644 (file)
@@ -14,9 +14,6 @@ set nowrap
 " If wordwrap is on, don't split words across lines
 set linebreak
 
-" Don't wrap my lines at 78 chars please!
-set textwidth=0
-
 " String to put at the start of lines that have been wrapped
 "set showbreak=+
 set showbreak=
@@ -42,3 +39,19 @@ map <C-K> <C-W>k<C-W>_
 " Always keep one line of context around the cursor
 set scrolloff=1
 
+" Match search results as you type
+set incsearch
+
+" Ignore case when searching
+set ignorecase
+
+" Ignore the ignorecase character if search contains uppercase chars
+set smartcase
+
+" Highlight search terms
+set hlsearch
+
+" Mouse options
+set mouse=a
+set mousehide
+
diff --git a/.vim/filetypes.vim b/.vim/filetypes.vim
new file mode 100644 (file)
index 0000000..1e7200d
--- /dev/null
@@ -0,0 +1,13 @@
+" Make vim aware of filetypes
+filetype plugin on
+filetype plugin indent on
+
+" Pick up some filetypes from their extensions
+autocmd BufNewFile,BufRead *.txt setlocal ft=text
+autocmd BufNewFile,BufRead mutt* setlocal ft=mail
+
+" Set options based on filetypes
+autocmd FileType text setlocal textwidth=78 nosmartindent
+autocmd FileType mail setlocal textwidth=78 nosmartindent
+autocmd FileType tex setlocal textwidth=78 nosmartindent
+
index eeb91b0609a265247265a19cb58bb046727f85ed..b5c6667d0964b80ab288f4f4dd3f402b1008f9db 100644 (file)
@@ -6,8 +6,6 @@ set autoindent
 set copyindent
 " Automatically indent new lines after specific keywords or braces
 set smartindent
-" Indent if the line starts with these words
-set cinwords+=def,class,except,try
 " Don't jump to the start of a line when typing #
 inoremap # X<c-h>#
 
@@ -18,13 +16,6 @@ set tabstop=4
 set softtabstop=4
 set shiftwidth=4
 
-" set [no]expandtab to [not] use spaces
-"function SetTabs(n)
-"      exec "set tabstop=" . a:n
-"      exec "set softtabstop=" . a:n
-"      exec "set shiftwidth=" . a:n
-"endfunction
-
 " Use :retab to change the file to entirely space indents
 " Use :retab! to change the file to entirely tab indents
 
similarity index 100%
rename from .vim/commands.vim
rename to .vim/macros.vim
diff --git a/.vim/mouse.vim b/.vim/mouse.vim
deleted file mode 100644 (file)
index 311209a..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-" Mouse options
-set mouse=a
-set mousehide
-
diff --git a/.vim/search.vim b/.vim/search.vim
deleted file mode 100644 (file)
index f31f696..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-" Match search results as you type
-set incsearch
-
-" Ignore case when searching
-set ignorecase
-
-" Ignore the ignorecase character if search contains uppercase chars
-set smartcase
-
-" Highlight search terms
-set hlsearch
-
-
index da2d70f04f663886f2b465c2accf1880380c3347..d94bb7c6cbb3fa981b719bedb71786ed194db47f 100644 (file)
@@ -7,3 +7,14 @@ au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal g'
 " Keep history
 set history=100
 
+" Make a backup (i. e. 'file~') and save it.
+set backup
+" create ~/tmp/ if it doesn't exist and use ~/tmp to save the 
+" backups into
+if has("unix")
+       if !isdirectory(expand("~/tmp/vimbak/."))
+               !mkdir -p ~/tmp/vimbak
+       endif
+endif
+set backupdir=~/tmp/vimbak
+
diff --git a/.vimrc b/.vimrc
index a227de2ff7e117f7982b673cc88f949aa0acf25f..742d2e7eeb2f667b1c3f855676672fd18269be2e 100644 (file)
--- a/.vimrc
+++ b/.vimrc
@@ -4,19 +4,13 @@ set nocompatible
 " Backspace should work across lines
 set bs=2
 
-" Make vim aware of filetypes
-filetype plugin on
-
-
 " Read files from ~/.vim
-source ~/.vim/backup.vim
 source ~/.vim/state.vim
 source ~/.vim/display.vim
-source ~/.vim/mouse.vim
 source ~/.vim/indent.vim
-source ~/.vim/search.vim
-source ~/.vim/commands.vim
+source ~/.vim/macros.vim
 source ~/.vim/commenter.vim
+source ~/.vim/filetypes.vim
 if !filereadable(expand("~/.vim/abbrsout.vim"))
        !python ~/.vim/abbrs2vim.py
 endif