161 lines
2.6 KiB
VimL

" Start with some stuff copied from the default vimrc included with vim 8
" by Bram Moolenaar
if v:progname =~? "evim"
finish
endif
if exists('skip_defaults_vim')
finish
endif
if &compatible
set nocompatible
endif
silent! while 0
set nocompatible
silent! endwhile
set backspace=indent,eol,start
set history=200 " keep 200 lines of command line history
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set wildmenu " display completion matches in a status line
set ttimeout " time out for key codes
set ttimeoutlen=100 " wait up to 100ms after Esc for special key
set display=truncate
set scrolloff=5
if has('reltime')
set incsearch
endif
set nrformats-=octal
if has('win32')
set guioptions-=t
endif
map Q gq
inoremap <C-U> <C-G>u<C-U>
if has('mouse')
set mouse=a
endif
if &t_Co > 2 || has("gui_running")
syntax on
let c_comment_strings=1
endif
if has("autocmd")
filetype plugin indent on
augroup vimStartup
au!
autocmd BufReadPost *
\ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
\ | exe "normal! g`\""
\ | endif
augroup END
endif " has("autocmd")
if !exists(":DiffOrig")
command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis
\ | wincmd p | diffthis
endif
if has('langmap') && exists('+langremap')
set nolangremap
endif
" -----------------------------------
" End of default vimrc
" -----------------------------------
let g:dotfiles_vim = expand('<sfile>:p:h')
execute 'source ' . g:dotfiles_vim . '/packages.vim'
" === COLORS ===
set background=dark
set cursorline
let g:gruvbox_italic=1
augroup colors
au!
au colorscheme * hi SpecialKey ctermfg=1
au colorscheme * hi CursorLine ctermbg=16
au colorscheme * hi SignColumn ctermbg='None'
augroup END
colorscheme gruvbox
" === OTHER DISPLAY OPTIONS ===
set list
set listchars=tab:→\ ,trail:␣,nbsp:⋅
set noruler
set laststatus=2
" === WINDOW NAVIGATION ===
nnoremap <C-H> <C-w>h
nnoremap <C-J> <C-w>j
nnoremap <C-K> <C-w>k
nnoremap <C-L> <C-w>l
set number
set relativenumber
let mapleader=' '
" === REMAPPINGS FOR SWEDISH KEYBOARD ===
nnoremap ö :
nnoremap - '
nnoremap _ `
" Mappings for unimpaired''''''
nmap å [
nmap ¨ ]
omap å [
omap ¨ ]
xmap å [
xmap ¨ ]
" === SEARCH OPTIONS ===
set ignorecase
set smartcase
set incsearch
set showmatch
set hlsearch
nnoremap <silent> <leader> :noh<CR>
noremap / /\v
nnoremap * mp*`p
set expandtab
set tabstop=2
set shiftwidth=2
set softtabstop=2
set smartindent
set noswapfile
set hidden
" === PLUGIN MAPPINGS ===
nnoremap <silent>§ :NERDTreeToggle<CR>
let NERDTreeIgnore=['\.o$', '\.d$', '\~$']