summaryrefslogtreecommitdiff
path: root/mnv/runtime/defaults.mnv
diff options
context:
space:
mode:
Diffstat (limited to 'mnv/runtime/defaults.mnv')
-rw-r--r--mnv/runtime/defaults.mnv157
1 files changed, 157 insertions, 0 deletions
diff --git a/mnv/runtime/defaults.mnv b/mnv/runtime/defaults.mnv
new file mode 100644
index 0000000000..74321a3df7
--- /dev/null
+++ b/mnv/runtime/defaults.mnv
@@ -0,0 +1,157 @@
+" The default mnvrc file.
+"
+" Maintainer: The MNV Project <https://github.com/Project-Tick/Project-Tick>
+" Last Change: 2025 Nov 28
+" Former Maintainer: Bram Moolenaar <Bram@mnv.org>
+"
+" This is loaded if no mnvrc file was found.
+" Except when MNV is run with "-u NONE" or "-C".
+" Individual settings can be reverted with ":set option&".
+" Other commands can be reverted as mentioned below.
+
+" When started as "emnv", emnv.mnv will already have done these settings.
+if v:progname =~? "emnv"
+ finish
+endif
+
+" Bail out if something that ran earlier, e.g. a system wide mnvrc, does not
+" want MNV to use these default values.
+if exists('skip_defaults_mnv')
+ finish
+endif
+
+" Use MNV settings, rather than Vi settings (much better!).
+" This must be first, because it changes other options as a side effect.
+" Avoid side effects when it was already reset.
+if &compatible
+ set nocompatible
+endif
+
+" When the +eval feature is missing, the set command above will be skipped.
+" Use a trick to reset compatible only when the +eval feature is missing.
+silent! while 0
+ set nocompatible
+silent! endwhile
+
+set ttimeout " time out for key codes
+set ttimeoutlen=100 " wait up to 100ms after Esc for special key
+
+" Show @@@ in the last line if it is truncated.
+set display=truncate
+
+" Show a few lines of context around the cursor. Note that this makes the
+" text scroll if you mouse-click near the start or end of the window.
+set scrolloff=5
+
+" Do incremental searching when it's possible to timeout.
+if has('reltime')
+ set incsearch
+endif
+
+" Do not recognize octal numbers for Ctrl-A and Ctrl-X, most users find it
+" confusing.
+set nrformats-=octal
+
+" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries.
+if has('win32')
+ set guioptions-=t
+endif
+
+" Don't use Q for Ex mode, use it for formatting. Except for Select mode.
+" Revert with ":unmap Q".
+map Q gq
+sunmap Q
+
+" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
+" so that you can undo CTRL-U after inserting a line break.
+" Revert with ":iunmap <C-U>".
+inoremap <C-U> <C-G>u<C-U>
+
+" In many terminal emulators the mouse works just fine. By enabling it you
+" can position the cursor, Visually select and scroll with the mouse.
+" Only xterm can grab the mouse events when using the shift key, for other
+" terminals use ":", select text and press Esc.
+if has('mouse')
+ if &term =~ 'xterm'
+ set mouse=a
+ else
+ set mouse=nvi
+ endif
+endif
+
+" Only do this part when MNV was compiled with the +eval feature.
+if 1
+
+ " Enable file type detection.
+ " Use the default filetype settings, so that mail gets 'tw' set to 72,
+ " 'cindent' is on in C files, etc.
+ " Also load indent files, to automatically do language-dependent indenting.
+ " Revert with ":filetype off".
+ filetype plugin indent on
+
+ " Put these in an autocmd group, so that you can revert them with:
+ " ":autocmd! mnvStartup"
+ augroup mnvStartup
+ autocmd!
+
+ " When editing a file, always jump to the last known cursor position.
+ " Don't do it when the position is invalid, when inside an event handler
+ " (happens when dropping a file on gmnv), for a commit or rebase message
+ " (likely a different one than last time), and when using xxd(1) to filter
+ " and edit binary files (it transforms input files back and forth, causing
+ " them to have dual nature, so to speak) or when running the new tutor
+ autocmd BufReadPost *
+ \ let line = line("'\"")
+ \ | if line >= 1 && line <= line("$") && &filetype !~# 'commit'
+ \ && index(['xxd', 'gitrebase', 'tutor'], &filetype) == -1
+ \ && !&diff
+ \ | execute "normal! g`\""
+ \ | endif
+
+ " Set the default background for putty to dark. Putty usually sets the
+ " $TERM to xterm and by default it starts with a dark background which
+ " makes syntax highlighting often hard to read with bg=light
+ " undo this using: ":au! mnvStartup TermResponse"
+ autocmd TermResponse * if v:termresponse == "\e[>0;136;0c" | set bg=dark | endif
+ augroup END
+
+ " Quite a few people accidentally type "q:" instead of ":q" and get confused
+ " by the command line window. Give a hint about how to get out.
+ " If you don't like this you can put this in your mnvrc:
+ " ":autocmd! mnvHints"
+ augroup mnvHints
+ au!
+ autocmd CmdwinEnter *
+ \ echohl Todo |
+ \ echo gettext('You discovered the command-line window! You can close it with ":q".') |
+ \ echohl None
+ augroup END
+
+endif
+
+" Switch syntax highlighting on when the terminal has colors or when using the
+" GUI (which always has colors).
+if &t_Co > 2 || has("gui_running")
+ " Revert with ":syntax off".
+ syntax on
+
+ " I like highlighting strings inside C comments.
+ " Revert with ":unlet g:c_comment_strings".
+ let c_comment_strings=1
+endif
+
+" Convenient command to see the difference between the current buffer and the
+" file it was loaded from, thus the changes you made.
+" Only define it when not defined already.
+" Revert with: ":delcommand DiffOrig".
+if !exists(":DiffOrig")
+ command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis
+ \ | wincmd p | diffthis
+endif
+
+if has('langmap') && exists('+langremap')
+ " Prevent that the langmap option applies to characters that result from a
+ " mapping. If set (default), this may break plugins (but it's backward
+ " compatible).
+ set nolangremap
+endif