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