diff --git a/terminal/vim/default.vim b/terminal/vim/default.vim new file mode 100644 index 0000000..b83a9ad --- /dev/null +++ b/terminal/vim/default.vim @@ -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 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 +" ----------------------------------- diff --git a/terminal/vim/vimrc b/terminal/vim/vimrc index 89f959a..3789995 100644 --- a/terminal/vim/vimrc +++ b/terminal/vim/vimrc @@ -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 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(':p:h') +let g:vimrcfile = expand(':p') +execute 'source ' . g:dotfiles_vim . '/default.vim' execute 'source ' . g:dotfiles_vim . '/packages.vim' +let mapleader=' ' + +execute ':nnoremap ev :vsplit '. g:vimrcfile. '' +nnoremap sv :so $MYVIMRC " === COLORS === set background=dark @@ -120,11 +39,14 @@ set number set relativenumber -let mapleader=' ' " === REMAPPINGS FOR SWEDISH KEYBOARD === nnoremap ö : nnoremap - ' nnoremap _ ` +nnoremap +nnoremap g g +nnoremap , +xnoremap % " 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 :noh noremap / /\v -nnoremap * mp*`p +nnoremap * * +" disable search highlighting after sourcing vimrc +noh set expandtab @@ -157,4 +83,5 @@ set hidden " === PLUGIN MAPPINGS === nnoremap § :NERDTreeToggle +set wildignore=*.o,*.d let NERDTreeIgnore=['\.o$', '\.d$', '\~$']