Begun vim configuring

This commit is contained in:
Thomas Lovén 2017-10-18 15:50:04 +02:00
parent 0fb4017aa1
commit 043740fd63
8 changed files with 138 additions and 4 deletions

View File

@ -10,7 +10,6 @@ function main()
${scriptdir}/git/setup.sh ${scriptdir}/git/setup.sh
brewget vim --with-override-system-vi
caskget docker caskget docker
makedir ${HOME}/code makedir ${HOME}/code

View File

@ -50,6 +50,6 @@ function makedir()
{ {
if [ ! -d $@ ]; then if [ ! -d $@ ]; then
print_info "Making directory $@" print_info "Making directory $@"
mkdir $@ mkdir -p $@
fi fi
} }

View File

@ -17,7 +17,7 @@ end
set -x LANG sv_SE.UTF-8 set -x LANG sv_SE.UTF-8
set -x LC_ALL sv_SE.UTF-8 set -x LC_ALL sv_SE.UTF-8
set -x EDITOR nvim set -x EDITOR vim
alias v nvim alias v vim
eval (python3 -m virtualfish) eval (python3 -m virtualfish)

View File

@ -8,6 +8,7 @@ function main()
${scriptdir}/kitty/setup.sh ${scriptdir}/kitty/setup.sh
${scriptdir}/fish/setup.sh ${scriptdir}/fish/setup.sh
${scriptdir}/vim/setup.sh
print_info "Installing terminal applications" print_info "Installing terminal applications"
brewget tmux brewget tmux

4
terminal/vim/keys.vim Normal file
View File

@ -0,0 +1,4 @@
nnoremap <C-H> <C-w>h
nnoremap <C-J> <C-w>j
nnoremap <C-K> <C-w>k
nnoremap <C-L> <C-w>l

10
terminal/vim/packages.vim Normal file
View File

@ -0,0 +1,10 @@
command! PackUpdate packadd minpac | source $MYVMRC | redraw | call minpac#update()
command! PackClean packadd minpac | source $MYVIMRC | call minpac#clean()
if !exists('*minpac#init')
finish
endif
call minpac#init()
call minpac#add('k-takata/minpac', {'type': 'opt'})

27
terminal/vim/setup.sh Executable file
View File

@ -0,0 +1,27 @@
#!/usr/bin/env bash
source ${DOTFILES}/helpers.sh
function main()
{
local scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)"
brewget vim --with-override-system-vi
makedir "${HOME}/.vim"
if [ ! -f "${HOME}/.vim/vimrc" ]; then
cat << EOF > "${HOME}/.vim/vimrc"
source ${scriptdir}/vimrc
EOF
fi
if [ ! -d "${HOME}/.vim/pack/minpac/opt" ]; then
makedir "${HOME}/.vim/pack/minpac/opt"
pushd "${HOME}/.vim/pack/minpac/opt"
git clone https://github.com/k-takata/minpac.git
popd
fi
}
main "$@"

93
terminal/vim/vimrc Normal file
View File

@ -0,0 +1,93 @@
" 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'
execute 'source ' . g:dotfiles_vim . '/keys.vim'