Split and update vim configuration

This commit is contained in:
Thomas Lovén 2018-03-27 10:44:22 +02:00
parent da48a9372b
commit 7eb754dbba
2 changed files with 102 additions and 89 deletions

86
terminal/vim/default.vim Normal file
View File

@ -0,0 +1,86 @@
" 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!
" Jump to last position ("-mark) when opening a file
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
" -----------------------------------

View File

@ -1,94 +1,13 @@
" 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')
let g:vimrcfile = expand('<sfile>:p')
execute 'source ' . g:dotfiles_vim . '/default.vim'
execute 'source ' . g:dotfiles_vim . '/packages.vim'
let mapleader=' '
execute ':nnoremap <leader>ev :vsplit '. g:vimrcfile. '<CR>'
nnoremap <leader>sv :so $MYVIMRC<CR>
" === COLORS ===
set background=dark
@ -120,11 +39,14 @@ set number
set relativenumber
let mapleader=' '
" === REMAPPINGS FOR SWEDISH KEYBOARD ===
nnoremap ö :
nnoremap - '
nnoremap _ `
nnoremap <c-_> <c-]>
nnoremap g<c-_> g<c-]>
nnoremap <leader>, <c-^>
xnoremap <tab> %
" Mappings for unimpaired''''''
nmap å [
@ -133,6 +55,8 @@ omap å [
omap ¨ ]
xmap å [
xmap ¨ ]
noremap åå [[
noremap ¨¨ ]]
" === SEARCH OPTIONS ===
@ -143,7 +67,9 @@ set showmatch
set hlsearch
nnoremap <silent> <leader> :noh<CR>
noremap / /\v
nnoremap * mp*`p
nnoremap * *<c-o>
" disable search highlighting after sourcing vimrc
noh
set expandtab
@ -157,4 +83,5 @@ set hidden
" === PLUGIN MAPPINGS ===
nnoremap <silent>§ :NERDTreeToggle<CR>
set wildignore=*.o,*.d
let NERDTreeIgnore=['\.o$', '\.d$', '\~$']