neovim: back to basics

This commit is contained in:
George Rawlinson 2022-05-04 21:25:06 +12:00
parent 3f866e685f
commit 6dacde09d5
Signed by: grawlinson
GPG key ID: E0959FEA8B550539
2 changed files with 143 additions and 45 deletions

View file

@ -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

View file

@ -1,16 +1,7 @@
call plug#begin() call plug#begin()
" plugins " plugins
Plug 'vim-airline/vim-airline' Plug 'SirVer/ultisnips'
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'
call plug#end() call plug#end()
@ -18,17 +9,17 @@ call plug#end()
set encoding=utf-8 set encoding=utf-8
" view line numbers " view line numbers
set number "set number
" display " display
set tabstop=4 set tabstop=2
set softtabstop=4 set softtabstop=2
set shiftwidth=4 set shiftwidth=2
set expandtab set expandtab
" show tabs, trailing space & EOL " show tabs, trailing space & EOL
set listchars=tab:▸\ ,trail,eol "set listchars=tab:▸\ ,trail:·,eol:¬
set list "set list
"use system clipboard "use system clipboard
set clipboard+=unnamedplus set clipboard+=unnamedplus
@ -39,14 +30,6 @@ noremap <Down> <NOP>
noremap <Left> <NOP> noremap <Left> <NOP>
noremap <Right> <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 " enable syntax highlighting
syntax enable syntax enable
let g:load_doxygen_syntax=1 let g:load_doxygen_syntax=1
@ -63,24 +46,7 @@ if has('nvim')
set inccommand=nosplit set inccommand=nosplit
endif endif
" syntastic " ultisnips
set statusline+=%#warningmsg# let g:UltiSnipsExpandTrigger="<c-j>"
set statusline+=%{SyntasticStatuslineFlag()} let g:UltiSnipsJumpForwardTrigger="<c-j>"
set statusline+=%* let g:UltiSnipsJumpBackwardTrigger="<c-k>"
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'