diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim new file mode 100644 index 0000000..33eedf6 --- /dev/null +++ b/.config/nvim/init.vim @@ -0,0 +1,126 @@ + + +" setup plugins + + +call plug#begin() + +" theme +Plug 'altercation/vim-colors-solarized' + +" completion +function! DoNvimPluginUpdate(arg) + UpdateRemotePlugins +endfunction +Plug 'Shougo/deoplete.nvim', { 'do': function('DoNvimPluginUpdate') } + let g:deoplete#enable_at_startup = 1 " enable at startup + let g:deoplete#max_abbr_width = 0 " no width limit + let g:deoplete#max_menu_width = 0 " no width limit + let g:deoplete#enable_smart_case = 1 " enable smart case + "let g:deoplete#file#enable_buffer_path = 1 + set completeopt=menuone,noinsert + inoremap pumvisible() ? "\" : "\" + +" git +Plug 'tpope/vim-fugitive' + +" c, c++ +Plug 'zchee/deoplete-clang', { 'for': [ 'c', 'cpp', 'h' ] } +imap emmet#expandAbbrIntelligent("\") +let g:user_emmet_leader_key='' + +" html, css +Plug 'mattn/emmet-vim', { 'for': [ 'html', 'css', 'scss' ] } + +" javascript +Plug 'wokalski/autocomplete-flow', { 'for': [ 'js' ] } + +" go +function! BuildDeopleteGo(arg) + :echom "install/update github.com/nsf/gocode" + :silent !go get -u github.com/nsf/gocode + :silent !make +endfunction +Plug 'zchee/deoplete-go', { 'for': [ 'go' ], 'do': function('BuildDeopleteGo') } +function! BuildVimGo(arg) + :echom "install/update github.com/nsf/gocode" + :silent !go get -u github.com/nsf/gocode + :echom "install/update github.com/alecthomas/gometalinter" + :silent !go get -u github.com/alecthomas/gometalinter + :echom "install/update golang.org/x/tools/cmd/goimports" + :silent !go get -u golang.org/x/tools/cmd/goimports + :echom "install/update golang.org/x/tools/cmd/guru" + :silent !go get -u golang.org/x/tools/cmd/guru + :echom "install/update golang.org/x/tools/cmd/gorename" + :silent !go get -u golang.org/x/tools/cmd/gorename + :echom "install/update github.com/golang/lint/golint" + :silent !go get -u github.com/golang/lint/golint + :echom "install/update github.com/kisielk/errcheck" + :silent !go get -u github.com/kisielk/errcheck + :echom "install/update github.com/jstemmer/gotags" + :silent !go get -u github.com/jstemmer/gotags + :echom "install/update github.com/klauspost/asmfmt/cmd/asmfmt" + :silent !go get -u github.com/klauspost/asmfmt/cmd/asmfmt + :echom "install/update github.com/fatih/motion" + :silent !go get -u github.com/fatih/motion + :echom "install/update github.com/zmb3/gogetdoc" + :silent !go get -u github.com/zmb3/gogetdoc + :echom "install/update github.com/josharian/impl" + :silent !go get -u github.com/josharian/impl +endfunction +Plug 'fatih/vim-go', { 'for': [ 'go' ], 'do': function('BuildVimGo') } + let g:go_highlight_functions = 1 + let g:go_highlight_methods = 1 + let g:go_highlight_structs = 1 + let g:go_highlight_interfaces = 1 + let g:go_highlight_operators = 1 + let g:go_highlight_build_constraints = 1 + let g:go_term_enabled = 1 + autocmd FileType go call s:define_go_leader_mappings() + function! s:define_go_leader_mappings() + " [r] Run go application + nnoremap r :GoRun + " [b] Build go application + nnoremap b :GoBuild + endfunction + +call plug#end() + + +" main configuration + + +" theme +set background=dark +if $LIGHT == 'true' + set background=light +endif +let g:solarized_termtrans=1 +let g:solarized_termcolors=256 +colorscheme solarized + +" numbering +set number +highlight LineNr ctermfg=239 ctermbg=none + +" cursor and line +set cursorline +highlight CursorLine ctermbg=none +highlight CursorLineNR cterm=bold ctermfg=244 + +" indentation +set tabstop=4 +set softtabstop=4 +set shiftwidth=4 + +" hidden characters +set listchars=tab:»\ ,extends:›,precedes:‹,nbsp:·,trail:· +set list + +" spellcheck +set spell spelllang=en_gb + + + +" vim: set expandtab ts=2 sw=2: + diff --git a/.install/caddy.sh b/.install/caddy.sh index 69f15da..2244ced 100755 --- a/.install/caddy.sh +++ b/.install/caddy.sh @@ -7,8 +7,6 @@ echo echo "Installing Caddy $CADDY_VERSION..." echo -source /etc/profile # add Go to PATH - git clone https://github.com/mholt/caddy -b "v$CADDY_VERSION" $(go env GOPATH)/src/github.com/mholt/caddy cd $(go env GOPATH)/src/github.com/mholt/caddy/caddy go get github.com/caddyserver/builds diff --git a/.install/golang.sh b/.install/golang.sh index 0c36a49..93b9bc1 100755 --- a/.install/golang.sh +++ b/.install/golang.sh @@ -29,5 +29,3 @@ cd /usr/local/go/src ./make.bash apk del .build-deps -echo 'export GOPATH="$HOME/go"' >> /etc/profile.d/golang.sh -echo 'export PATH="$GOPATH/bin:/usr/local/go/bin:$PATH"' >> /etc/profile.d/golang.sh diff --git a/.install/neovim.sh b/.install/neovim.sh index 745f52b..98bf15e 100755 --- a/.install/neovim.sh +++ b/.install/neovim.sh @@ -8,9 +8,52 @@ echo "Installing neovim..." echo apk add --no-cache --virtual .build-deps \ + git \ + alpine-sdk build-base \ + libtool \ + automake \ + m4 \ + autoconf \ + linux-headers \ + unzip \ + ncurses ncurses-dev ncurses-libs ncurses-terminfo \ + python3 \ + python3-dev \ + clang \ + go \ + xz \ curl \ - tar + make \ + cmake -echo "# TODO: Install from source" +git clone https://github.com/neovim/libtermkey.git +cd libtermkey +make +make install +cd .. +rm -rf libtermkey + +git clone https://github.com/neovim/libvterm.git +cd libvterm +make +make install +cd .. +rm -rf libvterm + +git clone https://github.com/neovim/unibilium.git +cd unibilium +make +make install +cd .. +rm -rf unibilium + +git clone https://github.com/neovim/neovim.git +cd neovim +make +make install +cd .. +rm -rf nvim + +pip3 install neovim apk del .build-deps diff --git a/.install/packr.sh b/.install/packr.sh index f76b45a..a8bd390 100755 --- a/.install/packr.sh +++ b/.install/packr.sh @@ -7,6 +7,4 @@ echo echo "Installing packr..." echo -source /etc/profile # add Go to PATH - go get -u github.com/gobuffalo/packr/... diff --git a/.install/plug.sh b/.install/plug.sh new file mode 100644 index 0000000..01f9b35 --- /dev/null +++ b/.install/plug.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e +source ./.versions + +echo +echo "Installing vim-plug..." +echo + +curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \ + https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim + +nvim +PlugInstall +qa diff --git a/.install/vgo.sh b/.install/vgo.sh index 02885c5..ab0204b 100755 --- a/.install/vgo.sh +++ b/.install/vgo.sh @@ -7,6 +7,4 @@ echo echo "Installing vgo..." echo -source /etc/profile # add Go to PATH - go get -u golang.org/x/vgo diff --git a/.profile b/.profile index d64761e..f6da899 100755 --- a/.profile +++ b/.profile @@ -1,3 +1,7 @@ +# Golang +export PATH="$(go env GOPATH)/bin:$PATH" + +# Aliases alias vim=nvim diff --git a/Dockerfile b/Dockerfile index 6f82f9c..b5fefbe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,29 +3,30 @@ FROM alpine:latest # Install dotfiles WORKDIR /home/ambrose - COPY . . # Install tools from source +# System RUN ./.install/core.sh RUN ./.install/git.sh RUN ./.install/zsh.sh RUN ./.install/neovim.sh +# Languages RUN ./.install/golang.sh RUN ./.install/node.sh RUN ./.install/python.sh - -RUN ./.install/caddy.sh +# Setup global PATH +ENV PATH=/usr/local/go/bin:$PATH # Create user RUN adduser -s /bin/zsh -D ambrose USER ambrose -# Install user tools - +# Install user programs RUN ./.install/vgo.sh +RUN ./.install/caddy.sh RUN ./.install/packr.sh # Open shell by default