nvim/.vimrc
2025-03-11 22:57:10 +01:00

100 lines
3.4 KiB
VimL

" minivimrc
"
" Minimal VIM configuration that does not depend on any 3rd party / plugins etc.
" to drop into foreign boxes
" based on my regular [.vimrc](https://github.com/hannenz/dotfiles/files/.vimrc)
" as of 2019-08-22
"
set nocompatible
filetype plugin indent on " filetype detection[ON] plugin[ON] indent[OFF]
syntax enable " enable syntax highlighting (previously syntax on).
colorscheme habamax
set path+=**
set wildmenu
set relativenumber
set hidden " allows to change bufferfs even if there are unsaved changes
set laststatus=2 " last window always has a statusline
set nohlsearch " Don't continue to highlight searched phrases.
set incsearch " But do highlight as you type your search.
"set ruler " Always show info along bottom.
set autoindent
set previewheight=30
set textwidth=80 " text width to hard-fold (gq)
set tabstop=2
set noexpandtab
set shiftwidth=2
set ignorecase " ignorecase must be set for smartcase to work -- wtf?
set smartcase " smartcase in search: case sensitive as soon as a capital letter is in the query
set nowrap " don't wrap text
set wildmode=longest,list " Tab-completion like in bash
set lazyredraw " Don't redraw the screen when executing macros etc.
set splitright
set splitbelow
set autoread " Re-read file if it has been edited outside vim and not inside
set scrolloff=6 " Keep at least 6 line visible at top/bottom when scrolling
if &listchars ==# 'eol:$'
set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+
endif
set timeout timeoutlen=5000 ttimeoutlen=100
set backspace=indent,eol,start
set foldmethod=manual
set formatoptions-=t
" Sane line joins
if v:version > 703 || v:version == 703 && has('patch541')
set formatoptions+=j
endif
if has('patch-8.1.360')
set diffopt=filler,internal,vertical,algorithm:patience,indent-heuristic " Always vertical diffs
endif
let mapleader=' '
let g:netrw_banner = 0 " Disable banner of netrw
let g:netrw_liststyle = 3 " Tree view
let g:netrw_winsize = -40 " Window size
augroup my_indent_options
autocmd!
autocmd FileType * setlocal noexpandtab
autocmd FileType * setlocal shiftwidth=2
augroup END
augroup text_wrap
autocmd!
autocmd FileType txt,markdown, setlocal textwidth=70
autocmd FileType txt,markdown, setlocal formatoptions+=t
augroup END
imap jj <Esc>
imap kj <Esc>
imap jk <Esc>
nmap <C-s> :w<CR>
imap <C-s> <Esc>:w<CR>a
" fileexplorer
nnoremap <Leader>e :Lexplore<CR>
nnoremap <Leader>lf :Lexplore<CR>
" nnoremap <Leader>b :ls<CR>:b
nnoremap <Leader><Leader> :ls<CR>:b
iabbrev </ </<C-X><C-O>
"Use 24-bit (true-color) mode in Vim/Neovim when outside tmux.
"If you're using tmux version 2.2 or later, you can remove the outermost $TMUX check and use tmux's 24-bit color support
"(see < http://sunaku.github.io/tmux-24bit-color.html#usage > for more information.)
if (empty($TMUX) && getenv('TERM_PROGRAM') != 'Apple_Terminal')
if (has("nvim"))
"For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 >
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
endif
"For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162 >
"Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd >
" < https://github.com/neovim/neovim/wiki/Following-HEAD#20160511 >
if (has("termguicolors"))
set termguicolors
endif
endif