blob: 3c95fdb4bc2b699288563f53a3240f4c62d97bb6 [file] [log] [blame]
Luca Stefanidad7e0a2016-11-23 23:44:59 +01001" vimrc default android config file
2"
3" Adapted for Android by tpruvot@github
4" Last change: 2014 Jul 22 (UTF-8)
5
6" When started as "evim", evim.vim will already have done these settings.
7if v:progname =~? "evim"
8 finish
9endif
10
11" Use Vim settings, rather than Vi settings (much better!).
12" This must be first, because it changes other options as a side effect.
13set nocompatible
14
15" allow backspacing over everything in insert mode
16set backspace=indent,eol,start
17
18" swap directories
19set directory=.,/data/local/tmp,/tmp
20
21if has("vms")
22 set nobackup " do not keep a backup file, use versions instead
23else
24" set backup " keep a backup file (restore to previous version)
25 set undofile " keep an undo file (undo changes after closing)
26endif
27set history=50 " keep 50 lines of command line history
28set ruler " show the cursor position all the time
29set showcmd " display incomplete commands
30set incsearch " do incremental searching
31
32set viminfo="NONE"
33
34" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
35" let &guioptions = substitute(&guioptions, "t", "", "g")
36
37" Don't use Ex mode, use Q for formatting
38map Q gq
39
40" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
41" so that you can undo CTRL-U after inserting a line break.
42inoremap <C-U> <C-G>u<C-U>
43
44" In many terminal emulators the mouse works just fine, thus enable it.
45if has('mouse')
46 set mouse=a
47endif
48
49" Switch syntax highlighting on, when the terminal has colors
50" Also switch on highlighting the last used search pattern.
51if &t_Co > 2 || has("gui_running")
52 syntax on
53 set hlsearch
54endif
55
56" Only do this part when compiled with support for autocommands.
57if has("autocmd")
58
59 " Enable file type detection.
60 " Use the default filetype settings, so that mail gets 'tw' set to 72,
61 " 'cindent' is on in C files, etc.
62 " Also load indent files, to automatically do language-dependent indenting.
63 filetype plugin indent on
64
65 " Put these in an autocmd group, so that we can delete them easily.
66 augroup vimrcEx
67 au!
68
69 " For all text files set 'textwidth' to 78 characters.
70 autocmd FileType text setlocal textwidth=78
71
72 " When editing a file, always jump to the last known cursor position.
73 " Don't do it when the position is invalid or when inside an event handler
74 " (happens when dropping a file on gvim).
75 " Also don't do it when the mark is in the first line, that is the default
76 " position when opening a file.
77 autocmd BufReadPost *
78 \ if line("'\"") > 1 && line("'\"") <= line("$") |
79 \ exe "normal! g`\"" |
80 \ endif
81
82 augroup END
83
84else
85
86 set autoindent " always set autoindenting on
87
88endif " has("autocmd")
89
90" UTF-8 support
91if has("multi_byte")
92 if &termencoding == ""
93 let &termencoding = "utf-8"
94 endif
95 set encoding=utf-8
96 setglobal fileencoding=utf-8
97 " setglobal bomb " Do not force BOM headers
98 set fileencodings=ucs-bom,utf-8,latin1
99endif
100
101if has("syntax")
102 source /system/usr/share/vim/autoload/spacehi.vim
103endif
104
105" Convenient command to see the difference between the current buffer and the
106" file it was loaded from, thus the changes you made.
107" Only define it when not defined already.
108if !exists(":DiffOrig")
109 command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis
110 \ | wincmd p | diffthis
111endif