Browse Source

neovim: back to basics

primary
George Rawlinson 3 months ago
parent
commit
6dacde09d5
Signed by: grawlinson
GPG Key ID: E0959FEA8B550539
  1. 132
      nvim/.config/nvim/UltiSnips/PKGBUILD.snippets
  2. 56
      nvim/.config/nvim/init.vim

132
nvim/.config/nvim/UltiSnips/PKGBUILD.snippets

@ -0,0 +1,132 @@
priority -50
snippet maint "Maintainer tag" i
`#!/usr/bin/env bash
echo "# Maintainer:" $(cat /etc/makepkg.conf $XDG_CONFIG_HOME/pacman/makepkg.conf 2>/dev/null | grep -oP '^PACKAGER="\K[^"]+')
`
endsnippet
snippet base "Metadata" i
pkgname=$1
pkgver=${2:1}
pkgrel=${3:1}
pkgdesc='$4'
arch=(${5:'any'})
url='$6'
license=($7)
depends=($8)
makedepends=($9)
checkdepends=($10)
optdepends=($11)
options=('!lto')
source=("$pkgname::git+$12")
b2sums=('SKIP')
endsnippet
snippet prep "prepare" i
prepare() {
cd "$pkgname"
$1
}
endsnippet
snippet ver "pkgver" i
pkgver() {
cd "$pkgname"$1
git describe --tags | sed 's/^v//'
printf 'r%s.g%s' "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
endsnippet
snippet build "build" i
build() {
cd "$pkgname"
$1
}
endsnippet
snippet chk "check" i
check() {
cd "$pkgname"
$1
}
endsnippet
snippet pkg "package" i
package() {
cd "$pkgname"
$1
}
endsnippet
## General package() snippets
snippet pkgbin "Package binary" i
# binary
install -vDm755 -t "$pkgdir/usr/bin" $1
endsnippet
snippet pkgdoc "Package documentation" i
# documentation
install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" $1
endsnippet
snippet pkglic "Package license" i
# license
install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" $1
endsnippet
## Go specific
snippet goprep "Prepare (Go)" i
# create directory for build output
mkdir build
# download dependencies
go mod download
endsnippet
snippet gobuild "Build (Go)" i
# set Go flags
export CGO_CPPFLAGS="${CPPFLAGS}"
export CGO_CFLAGS="${CFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
go build -v \
-trimpath \
-buildmode=pie \
-mod=readonly \
-modcacherw \
-ldflags "-linkmode external -extldflags ${LDFLAGS}" \
-o build \
.
endsnippet
snippet gochk "Check (Go)" i
go test -v ./...
endsnippet
## Rust specific
snippet rustprep "Prepare (Rust)" i
# download dependencies
cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
endsnippet
snippet rustbuild "Build (Rust)" i
cargo build --frozen --release --all-features
endsnippet
snippet rustchk "Check (Rust)" i
cargo test --frozen --all-features
endsnippet
snippet rustpkg "Package (Rust)" i
# binary
install -vDm755 -t "$pkgdir/usr/bin" "target/release/$pkgname"
endsnippet
# vim: tabstop=2 shiftwidth=2 expandtab

56
nvim/.config/nvim/init.vim

@ -1,16 +1,7 @@
call plug#begin()
" plugins
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'airblade/vim-gitgutter'
Plug 'chrisbra/sudoedit.vim'
Plug 'vim-syntastic/syntastic'
Plug 'mtscout6/syntastic-local-eslint.vim'
Plug 'editorconfig/editorconfig-vim'
Plug 'fatih/vim-go'
Plug 'pearofducks/ansible-vim', { 'do': './UltiSnips/generate.sh' }
Plug 'rust-lang/rust.vim'
Plug 'SirVer/ultisnips'
call plug#end()
@ -18,17 +9,17 @@ call plug#end()
set encoding=utf-8
" view line numbers
set number
"set number
" display
set tabstop=4
set softtabstop=4
set shiftwidth=4
set tabstop=2
set softtabstop=2
set shiftwidth=2
set expandtab
" show tabs, trailing space & EOL
set listchars=tab:▸\ ,trail,eol
set list
"set listchars=tab:▸\ ,trail:·,eol:¬
"set list
"use system clipboard
set clipboard+=unnamedplus
@ -39,14 +30,6 @@ noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
" vim-airline - solarized + powerline
let g:airline_theme='solarized'
let g:airline_solarized_bg='dark'
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#fnamemod = ':t'
set laststatus=2
" enable syntax highlighting
syntax enable
let g:load_doxygen_syntax=1
@ -63,24 +46,7 @@ if has('nvim')
set inccommand=nosplit
endif
" syntastic
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
" checkers
let g:syntastic_c_checkers = ['gcc', 'cppcheck']
let g:syntastic_cpp_checkers = ['gcc', 'cppcheck']
let g:syntastic_javascript_checkers = ['eslint']
let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck']
let g:syntastic_php_checkers = ['php', 'phpcs']
let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }
let g:syntastic_sh_checkers = ['shellcheck']
let g:syntastic_zsh_checkers = ['zsh']
" python host paths
let g:python_host_prog = '/usr/bin/python2'
let g:python3_host_prog = '/usr/bin/python'
" ultisnips
let g:UltiSnipsExpandTrigger="<c-j>"
let g:UltiSnipsJumpForwardTrigger="<c-j>"
let g:UltiSnipsJumpBackwardTrigger="<c-k>"

Loading…
Cancel
Save