Archived
1
0
Fork 0
This repository has been archived on 2024-01-27. You can view files and clone it, but cannot push or open issues or pull requests.
dockerfiles/toolbox/assets/vimrc

184 lines
5.6 KiB
VimL
Raw Normal View History

2021-04-14 14:02:06 +02:00
"
" Install plugins
2021-03-27 18:35:37 +01:00
"
set nocompatible " be iMproved, required
2021-04-14 14:02:06 +02:00
filetype plugin indent on
syntax on
syntax sync minlines=256
"
2021-03-27 18:35:37 +01:00
" Settings
"
2021-04-14 14:02:06 +02:00
set autoindent
set autoread " Automatically reread changed files without asking me anything
set autowrite " Automatically save before :next, :make etc.
2021-03-27 18:35:37 +01:00
set backspace=indent,eol,start " Makes backspace key more powerful.
2021-04-14 14:02:06 +02:00
set complete=.,w,b,u,t
set completeopt=longest,menuone
set display+=lastline
2021-03-27 18:35:37 +01:00
set encoding=utf-8 " Set default encoding to UTF-8
set fileformats=unix,dos,mac " Prefer Unix over Windows over OS 9 formats
2021-04-14 14:02:06 +02:00
set hidden
set history=500
2021-03-27 18:35:37 +01:00
set hlsearch
set ignorecase
2021-04-14 14:02:06 +02:00
set incsearch
set laststatus=2
2021-03-27 18:35:37 +01:00
set lazyredraw
2021-04-14 14:02:06 +02:00
set nobackup " Don't create annoying backup files
2021-03-27 18:35:37 +01:00
set nocursorcolumn
set nocursorline
2021-04-14 14:02:06 +02:00
set noerrorbells " No beeps
set showmode " We show the mode with airlien or lightline
set noswapfile " Don't use swapfile
set nowritebackup
set nrformats-=octal
set number " Show line numbers
2021-03-27 18:35:37 +01:00
set re=1
2021-04-14 14:02:06 +02:00
set ruler " Show the cursor position all the time
set scrolloff=7
set showcmd " Show me what I'm typing
set showmatch " Show matching brackets by flickering
set sidescrolloff=7
set smartcase
set splitbelow " Split horizontal windows below to the current windows
set splitright " Split vertical windows right to the current windows
set synmaxcol=300
set tabpagemax=50
set ttyfast
2021-03-27 18:35:37 +01:00
" Make Vim to handle long lines nicely.
set wrap
set textwidth=79
set formatoptions=qrn1
" Time out on key codes but not mappings.
set notimeout
set ttimeout
set ttimeoutlen=10
2021-04-14 14:02:06 +02:00
if has('gui_running')
"set transparency=3
set regexpengine=1 " fix js regex syntax
endif
let mapleader = ","
" dont save .netrwhist history
let g:netrw_dirhistmax=0
" Allow saving of files as sudo when I forgot to start vim using sudo.
cmap w!! w !sudo tee > /dev/null %
" open help vertically
command! -nargs=* -complete=help Help vertical belowright help <args>
2021-03-27 18:35:37 +01:00
" Different Cursorshapes for the modes
let &t_SI = "\<Esc>[6 q"
let &t_SR = "\<Esc>[4 q"
let &t_EI = "\<Esc>[2 q"
2021-04-14 14:02:06 +02:00
" ==================== Remap Keys ====================
" Remaps % to tab so navigate to matching brackets
nnoremap <tab> %
vnoremap <tab> %
2021-03-27 18:35:37 +01:00
2021-04-14 14:02:06 +02:00
" Visual mode pressing * or # searches for the current selection
vnoremap <silent> * :call VisualSelection('f')<CR>
vnoremap <silent> # :call VisualSelection('b')<CR>
2021-03-27 18:35:37 +01:00
2021-04-14 14:02:06 +02:00
" Center, kill hl
nnoremap n nzzzv
nnoremap N Nzzzv
nnoremap <leader><space> :nohlsearch<CR>
nnoremap <space> zz
2021-03-27 18:35:37 +01:00
" 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.
inoremap <C-U> <C-G>u<C-U>
" Toggle line numbers and rulers
nmap <leader>ll :set number!<cr>
nmap <leader>lr :set relativenumber!<cr>
nmap <leader>cc :set cursorcolumn!<cr>
nmap <leader>cl :set cursorline!<cr>
" Better split switching
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
map <C-down> <C-W>j
map <C-up> <C-W>k
map <C-left> <C-W>h
map <C-right> <C-W>l
2021-04-14 14:02:06 +02:00
" Move up and down on split lines
2021-03-27 18:35:37 +01:00
map <Up> gk
map <Down> gj
map k gk
map j gj
" Spell checking
nnoremap <F6> :setlocal spell! spell?<CR>
map <leader>ss :setlocal spell!<cr>
map <leader>sn ]s
map <leader>sp [s
map <leader>sa zg
map <leader>s? z=
" trim all whitespaces away
nnoremap <leader>W :%s/\s\+$//<cr>:let @/=''<CR>
" Do not show stupid q: window
map q: :q
" Paste Mode
set pastetoggle=<F2>
2021-04-14 14:02:06 +02:00
" ==================== File Type settings ====================
2021-03-27 18:35:37 +01:00
set tabstop=4
set softtabstop=4
2021-04-14 14:02:06 +02:00
set shiftwidth=4
set noexpandtab
2021-03-27 18:35:37 +01:00
set shiftround
2021-04-14 14:02:06 +02:00
set smarttab
2021-03-27 18:35:37 +01:00
2021-04-14 14:02:06 +02:00
au BufNewFile,BufRead *.vim setlocal noet ts=4 sw=4 sts=4
au BufNewFile,BufRead *.txt setlocal noet ts=4 sw=4 sts=4
au BufNewFile,BufRead *.md setlocal noet ts=4 sw=4 sts=4
au BufNewFile,BufRead *.json setlocal et ts=2 sw=2 sts=2
au BufNewFile,BufRead *.go setlocal noet ts=4 sw=4 sts=4
au BufNewFile,BufRead *.md setlocal et ts=4 sw=4 sts=4
au BufNewFile,BufRead *.lua setlocal noet ts=4 sw=4 sts=4
au BufNewFile,BufRead *.py setlocal et ts=4 sw=4 sts=4
au BufNewFile,BufRead *.yml,*.yaml setlocal et ts=2 sw=2 sts=2
au BufNewFile,BufRead *.htm,*.html setlocal noet ts=4 sw=4 sts=4
au FileType dockerfile setlocal et ts=2 sw=2 sts=2
au FileType nginx setlocal noet ts=4 sw=4 sts=4
au FileType fstab,systemd set noet
au FileType gitconfig,sh,toml set noet
2021-03-27 18:35:37 +01:00
" ==================== Wildmenu ====================
set wildmenu
set wildmode=list:full
set wildignore+=.hg,.git,.svn " Version control
set wildignore+=*.aux,*.out,*.toc " LaTeX intermediate files
set wildignore+=*.jpg,*.bmp,*.gif,*.png,*.jpeg " binary images
set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest " compiled object files
set wildignore+=*.spl " compiled spelling word lists
set wildignore+=*.sw? " Vim swap files
set wildignore+=*.DS_Store " OSX bullshit
set wildignore+=*.luac " Lua byte code
set wildignore+=migrations " Django migrations
set wildignore+=go/pkg " Go static files
set wildignore+=go/bin " Go bin files
set wildignore+=go/bin-vagrant " Go bin-vagrant files
set wildignore+=*.pyc " Python byte code
set wildignore+=*.orig " Merge resolution files
" vim:ts=2:sw=2:et