Luca Stefani | dad7e0a | 2016-11-23 23:44:59 +0100 | [diff] [blame] | 1 | " 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. |
| 7 | if v:progname =~? "evim" |
| 8 | finish |
| 9 | endif |
| 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. |
| 13 | set nocompatible |
| 14 | |
| 15 | " allow backspacing over everything in insert mode |
| 16 | set backspace=indent,eol,start |
| 17 | |
Felix | fc4e70c | 2019-06-06 00:06:45 +0200 | [diff] [blame] | 18 | " Disable modeline parsing for security reasons |
| 19 | set nomodeline |
| 20 | |
Luca Stefani | dad7e0a | 2016-11-23 23:44:59 +0100 | [diff] [blame] | 21 | " swap directories |
| 22 | set directory=.,/data/local/tmp,/tmp |
| 23 | |
| 24 | if has("vms") |
| 25 | set nobackup " do not keep a backup file, use versions instead |
| 26 | else |
| 27 | " set backup " keep a backup file (restore to previous version) |
| 28 | set undofile " keep an undo file (undo changes after closing) |
| 29 | endif |
| 30 | set history=50 " keep 50 lines of command line history |
| 31 | set ruler " show the cursor position all the time |
| 32 | set showcmd " display incomplete commands |
| 33 | set incsearch " do incremental searching |
| 34 | |
| 35 | set 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 |
| 41 | map 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. |
| 45 | inoremap <C-U> <C-G>u<C-U> |
| 46 | |
| 47 | " In many terminal emulators the mouse works just fine, thus enable it. |
| 48 | if has('mouse') |
| 49 | set mouse=a |
| 50 | endif |
| 51 | |
| 52 | " Switch syntax highlighting on, when the terminal has colors |
| 53 | " Also switch on highlighting the last used search pattern. |
| 54 | if &t_Co > 2 || has("gui_running") |
| 55 | syntax on |
| 56 | set hlsearch |
| 57 | endif |
| 58 | |
| 59 | " Only do this part when compiled with support for autocommands. |
| 60 | if 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 | |
| 87 | else |
| 88 | |
| 89 | set autoindent " always set autoindenting on |
| 90 | |
| 91 | endif " has("autocmd") |
| 92 | |
| 93 | " UTF-8 support |
| 94 | if 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 |
| 102 | endif |
| 103 | |
| 104 | if has("syntax") |
| 105 | source /system/usr/share/vim/autoload/spacehi.vim |
| 106 | endif |
| 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. |
| 111 | if !exists(":DiffOrig") |
| 112 | command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis |
| 113 | \ | wincmd p | diffthis |
| 114 | endif |