Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- " Avoid the possibility of trojaned text files (FreeBSD advice)
- set nomodeline
- " Enable mouse support in all modes
- "set mouse=a
- " Search without case if lowercase
- set ignorecase smartcase
- " Automatically indent new lines the same way as the line before
- set autoindent
- " Make autoindent copy the existing indent structure
- set copyindent
- " Do smart indention (cindent is to abusive as the default)
- "set smartindent
- " But do the cindent for .php files
- "au BufRead,BufNewFile *.php set cindent
- set cindent
- "Fix indent of '#text' and 'text:' to not start at beginning of line
- set cinkeys=0{,0},!^F,o,O,e " default is: 0{,0},0),:,0#,!^F,o,O,e
- " Briefly mark the other bracket when inserting one
- set showmatch
- " Minimum number of lines on screen (so that we don't scroll to far down)
- set scrolloff=6
- "Search while typing
- set incsearch
- " But don't highlight it
- set nohlsearch
- " Make backspace work the way it should on all systems
- set backspace=2
- " Do the syntax highlight the way I want it.
- syntax on
- set bg=dark
- autocmd BufRead,BufNewFile *.php hi Comment ctermfg=Blue guifg=Blue
- " au BufRead,BufNewFile *.php set bg=light
- " Only do this part when compiled with support for autocommands
- if has("autocmd")
- augroup js
- autocmd!
- " 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
- augroup END
- endif
- "Toggle free-move mode with /w ( alltså § )
- noremap <silent> § :call ToggleWrap()<CR>
- function ToggleWrap()
- if &wrap
- echo "Wrap OFF"
- setlocal nowrap
- set virtualedit=all
- silent! nunmap <buffer> <Up>
- silent! nunmap <buffer> <Down>
- silent! nunmap <buffer> <Home>
- silent! nunmap <buffer> <End>
- silent! iunmap <buffer> <Up>
- silent! iunmap <buffer> <Down>
- silent! iunmap <buffer> <Home>
- silent! iunmap <buffer> <End>
- else
- echo "Wrap ON"
- setlocal wrap linebreak nolist
- set virtualedit=
- setlocal display+=lastline
- noremap <buffer> <silent> <Up> gk
- noremap <buffer> <silent> <Down> gj
- noremap <buffer> <silent> <Home> g<Home>
- noremap <buffer> <silent> <End> g<End>
- inoremap <buffer> <silent> <Up> <C-o>gk
- inoremap <buffer> <silent> <Down> <C-o>gj
- inoremap <buffer> <silent> <Home> <C-o>g<Home>
- inoremap <buffer> <silent> <End> <C-o>g<End>
- endif
- endfunction
- " Allow to change encoding using F8
- function! ChangeFileencoding()
- let encodings = ['iso-8859-1', 'utf-8', 'iso-8859-15']
- let prompt_encs = []
- let index = 0
- while index < len(encodings)
- call add(prompt_encs, index.'. '.encodings[index])
- let index = index + 1
- endwhile
- let choice = inputlist(prompt_encs)
- if choice >= 0 && choice < len(encodings)
- execute 'e ++enc='.encodings[choice].' %:p'
- endif
- endf
- nmap <F8> :call ChangeFileencoding()<CR>
- " Vim support file to switch on loading indent files for file types
- if exists("did_indent_on")
- finish
- endif
- let did_indent_on = 1
- augroup filetypeindent
- au FileType * call s:LoadIndent()
- func! s:LoadIndent()
- if exists("b:undo_indent")
- exe b:undo_indent
- unlet! b:undo_indent b:did_indent
- endif
- let s = expand("<amatch>")
- if s != ""
- if exists("b:did_indent")
- unlet b:did_indent
- endif
- " When there is a dot it is used to separate filetype names. Thus for
- " "aaa.bbb" load "indent/aaa.vim" and then "indent/bbb.vim".
- for name in split(s, '\.')
- exe 'runtime! indent/' . name . '.vim'
- endfor
- endif
- endfunc
- augroup END
Add Comment
Please, Sign In to add comment