setup.vim (3160B)
1 if exists('s:did_load') 2 " Align Nvim defaults to Vim. 3 set commentstring=/*\ %s\ */ 4 if g:testname !~ 'test_ins_complete_no_halt\.vim$' 5 set complete=.,w,b,u,t,i 6 set completeopt=menu,preview 7 endif 8 set define=^\\s*#\\s*define 9 set diffopt=internal,filler,closeoff,indent-heuristic,inline:char 10 set directory^=. 11 set display= 12 set fillchars=vert:\|,foldsep:\|,fold:- 13 set formatoptions=tcq 14 set fsync 15 set include=^\\s*#\\s*include 16 set joinspaces 17 set jumpoptions= 18 set laststatus=1 19 set listchars=eol:$ 20 set maxsearchcount=99 21 set mousemodel=extend 22 set nohidden nosmarttab noautoindent noautoread 23 set nohlsearch noincsearch 24 set nrformats=bin,octal,hex 25 set sessionoptions+=options 26 set shelltemp 27 set shortmess=filnxtToOS 28 set sidescroll=0 29 set startofline 30 set switchbuf= 31 set tags=./tags,tags 32 set undodir^=. 33 set viewoptions+=options 34 set wildoptions= 35 if has('win32') 36 set isfname+=: 37 endif 38 if g:testname !~ 'test_mapping\.vim$' 39 " Make "Q" switch to Ex mode. 40 " This does not work for all tests as Nvim only supports Vim Ex mode. 41 nnoremap Q gQ<Cmd>call<SID>ExStart()<CR> 42 endif 43 endif 44 45 " Common preparations for running tests. 46 47 " Only load this once. 48 if exists('s:did_load') 49 finish 50 endif 51 let s:did_load = 1 52 53 func s:ExStart() 54 call feedkeys($"\<Cmd>call{expand('<SID>')}ExMayEnd()\<CR>") 55 endfunc 56 57 func s:ExMayEnd() 58 " When :normal runs out of characters in Vim, the behavior is different in 59 " normal Ex mode vs. Vim Ex mode. 60 " - In normal Ex mode, "\n" is used. 61 " - In Vim Ex mode, Ctrl-C is used. 62 " Nvim only supports Vim Ex mode, so emulate the normal Ex mode behavior. 63 if state('m') == '' && mode(1) == 'cv' && getcharstr(1) == "\<C-C>" 64 call feedkeys("\n") 65 endif 66 endfunc 67 68 " Clear Nvim default user commands, mappings and menus. 69 comclear 70 mapclear 71 mapclear! 72 aunmenu * 73 tlunmenu * 74 autocmd! nvim.popupmenu 75 76 " Undo the 'grepprg' and 'grepformat' setting in _core/defaults.lua. 77 set grepprg& grepformat& 78 79 " Prevent Nvim log from writing to stderr. 80 let $NVIM_LOG_FILE = exists($NVIM_LOG_FILE) ? $NVIM_LOG_FILE : 'Xnvim.log' 81 82 " Make sure 'runtimepath' and 'packpath' does not include $HOME. 83 set rtp=$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after 84 let &packpath = &rtp 85 86 " Avoid storing shell history. 87 let $HISTFILE = "" 88 89 " Use default shell on Windows to avoid segfault, caused by TUI 90 if has('win32') 91 let $SHELL = '' 92 let $TERM = '' 93 let &shell = empty($COMSPEC) ? exepath('cmd.exe') : $COMSPEC 94 set shellcmdflag=/s/c shellxquote=\" shellredir=>%s\ 2>&1 95 let &shellpipe = &shellredir 96 endif 97 98 " Detect user modules for language providers 99 let $PYTHONUSERBASE = $HOME . '/.local' 100 if executable('gem') 101 let $GEM_PATH = system('gem env gempath') 102 endif 103 104 " Have current $HOME available as $ORIGHOME. $HOME is used for option 105 " defaults before we get here, and test_mksession checks that. 106 let $ORIGHOME = $HOME 107 108 if !exists('$XDG_CONFIG_HOME') 109 let $XDG_CONFIG_HOME = $HOME .. '/.config' 110 endif 111 112 " Make sure $HOME does not get read or written. 113 let $HOME = expand(getcwd() . '/XfakeHOME') 114 if !isdirectory($HOME) 115 call mkdir($HOME) 116 endif 117 118 " Use Vim's default color scheme 119 colorscheme vim