build core, basic and go variants and add template
This commit is contained in:
19
core/Containerfile
Normal file
19
core/Containerfile
Normal file
@@ -0,0 +1,19 @@
|
||||
FROM alpine:latest
|
||||
|
||||
# Install alpine packages
|
||||
RUN apk add --no-cache \
|
||||
mandoc mandoc-doc less less-doc bash bash-doc bash-completion \
|
||||
tmux tmux-doc neovim neovim-doc
|
||||
|
||||
# Add shell configs
|
||||
COPY shell /etc
|
||||
|
||||
# Add neovim config
|
||||
COPY nvim /etc/xdg/nvim
|
||||
ENV VIMINIT=":luafile /etc/xdg/nvim/init.lua"
|
||||
|
||||
# Configure environment
|
||||
USER 1000:1000
|
||||
WORKDIR /work
|
||||
ENV HOME=/tmp TERM=xterm-256color LANG=en_US.UTF-8
|
||||
ENTRYPOINT ["/usr/bin/tmux", "new-session", "/usr/bin/nvim"]
|
||||
69
core/nvim/init.lua
Normal file
69
core/nvim/init.lua
Normal file
@@ -0,0 +1,69 @@
|
||||
-- Change files in place
|
||||
vim.o.backupcopy = 'yes'
|
||||
|
||||
-- Disable auto comment
|
||||
vim.cmd.autocmd('FileType', '*', 'setlocal', 'formatoptions-=cro')
|
||||
|
||||
-- Disable double spaces when joining
|
||||
vim.o.joinspaces = false
|
||||
|
||||
-- Code folding
|
||||
vim.o.foldmethod = 'indent'
|
||||
vim.o.foldlevel = 99
|
||||
|
||||
-- Indentation
|
||||
vim.o.tabstop = 2
|
||||
vim.o.shiftwidth = 2
|
||||
vim.o.softtabstop = -1
|
||||
vim.o.expandtab = true
|
||||
|
||||
-- Visible line breaks
|
||||
vim.o.list = true
|
||||
vim.o.listchars = 'eol:¬'
|
||||
|
||||
-- Relative line numbers
|
||||
vim.o.number = true
|
||||
vim.o.relativenumber = true
|
||||
|
||||
-- 80 character indication
|
||||
vim.o.colorcolumn = '80'
|
||||
|
||||
-- Status window height
|
||||
vim.o.previewheight = 30
|
||||
|
||||
-- Theme
|
||||
vim.o.termguicolors = true
|
||||
vim.cmd.colorscheme('slate')
|
||||
|
||||
-- Keyboard shortcuts
|
||||
vim.keymap.set('n', '<c-n>', ':bn<cr>', { silent = true })
|
||||
vim.keymap.set('n', '<c-p>', ':bp<cr>', { silent = true })
|
||||
vim.keymap.set('n', '<c-l>', ':noh<cr><c-l>')
|
||||
vim.keymap.set('n', 'gp', "'[V']", { remap = true })
|
||||
vim.keymap.set('i', '<c-b>', '{}<left>', { silent = true } )
|
||||
vim.keymap.set('i', '<c-b> ', '{ }<left><left>', { silent = true } )
|
||||
vim.keymap.set('i', '<c-b><cr>', '{<cr>}O', { silent = true } )
|
||||
vim.keymap.set('i', '<c-space>', '<space>', { remap = true })
|
||||
|
||||
-- Add command to show help in current window
|
||||
vim.api.nvim_create_user_command('Help', function(a)
|
||||
-- Create empty 'help' buffer
|
||||
vim.cmd.enew()
|
||||
vim.o.buftype = 'help'
|
||||
local buf = vim.fn.bufnr('%')
|
||||
|
||||
-- Show help and handle errors
|
||||
ok, msg = pcall(vim.cmd.help, a.fargs[1] or "help.txt")
|
||||
if not ok then vim.notify(msg, vim.log.levels.ERROR); vim.cmd.bp() end
|
||||
|
||||
-- Wipe out empty buffer if not taken over
|
||||
if vim.fn.bufnr('%') ~= buf then vim.cmd.bwipeout(buf) end
|
||||
end, { nargs = '?', bar = true, complete = 'help' })
|
||||
|
||||
-- Add command line abbreviation if at start of line
|
||||
vim.cmd.cabbrev { 'help',
|
||||
'<c-r>=(getcmdtype() == ":" && getcmdpos() == 1) ? "Help" : "help"<cr>'
|
||||
}
|
||||
|
||||
-- Source init directory
|
||||
vim.cmd 'runtime! init/*.lua'
|
||||
7
core/shell/inputrc
Normal file
7
core/shell/inputrc
Normal file
@@ -0,0 +1,7 @@
|
||||
set editing-mode vi
|
||||
|
||||
$if mode=vi
|
||||
set keymap vi-insert
|
||||
Control-l: clear-screen
|
||||
Control-r: vi-put
|
||||
$endif
|
||||
24
core/shell/profile
Normal file
24
core/shell/profile
Normal file
@@ -0,0 +1,24 @@
|
||||
# Set editor
|
||||
EDITOR='nvim'
|
||||
alias vim='nvim'
|
||||
alias vi='nvim'
|
||||
|
||||
# Configure history
|
||||
HISTCONTROL=ignoreboth
|
||||
unset HISTFILE
|
||||
|
||||
# Handy aliases
|
||||
alias la='ls -A'
|
||||
alias ll='la -l'
|
||||
alias ..='cd ..'
|
||||
alias e='exit'
|
||||
|
||||
# Git branch helper
|
||||
git_branch_prompt() {
|
||||
local branch="$(git branch --show-current 2> /dev/null)"
|
||||
[[ -z "$branch" ]] || echo "[${branch}]"
|
||||
}
|
||||
|
||||
# Colorful command prompt
|
||||
PS1='\[\e[33m\][\[\e[0m\]\W\[\e[33m\]]\[\e[32m\]$(git_branch_prompt)\[\e[33m\]\$\[\e[37m\] '
|
||||
trap 'printf \\e[0m' DEBUG
|
||||
83
core/shell/tmux.conf
Normal file
83
core/shell/tmux.conf
Normal file
@@ -0,0 +1,83 @@
|
||||
# Set default shell
|
||||
set -g default-shell /bin/bash
|
||||
|
||||
# Increase history size
|
||||
set -g history-limit 50000
|
||||
|
||||
# Disable escape delay
|
||||
set-option -sg escape-time 0
|
||||
|
||||
# Enable mouse and focus events
|
||||
set -g mouse on
|
||||
set -g focus-events on
|
||||
|
||||
################
|
||||
# Key bindings #
|
||||
################
|
||||
|
||||
# Change prefix
|
||||
set-option -g prefix C-a
|
||||
|
||||
# Remap split commands
|
||||
unbind '"'
|
||||
unbind %
|
||||
bind s split-window -v
|
||||
bind v split-window -h
|
||||
|
||||
# Remap pane selection
|
||||
unbind Up
|
||||
unbind Down
|
||||
unbind Left
|
||||
unbind Right
|
||||
|
||||
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
|
||||
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|l?n?vim?x?)(diff)?$'"
|
||||
bind-key -n 'M-h' if-shell "$is_vim" { send-keys M-h } { if-shell -F '#{pane_at_left}' {} { select-pane -L } }
|
||||
bind-key -n 'M-j' if-shell "$is_vim" { send-keys M-j } { if-shell -F '#{pane_at_bottom}' {} { select-pane -D } }
|
||||
bind-key -n 'M-k' if-shell "$is_vim" { send-keys M-k } { if-shell -F '#{pane_at_top}' {} { select-pane -U } }
|
||||
bind-key -n 'M-l' if-shell "$is_vim" { send-keys M-l } { if-shell -F '#{pane_at_right}' {} { select-pane -R } }
|
||||
|
||||
# Remap resize
|
||||
unbind C-Up
|
||||
unbind C-Down
|
||||
unbind C-Left
|
||||
unbind C-Right
|
||||
unbind M-Up
|
||||
unbind M-Down
|
||||
unbind M-Left
|
||||
unbind M-Right
|
||||
bind -nr M-K resize-pane -U
|
||||
bind -nr M-J resize-pane -D
|
||||
bind -nr M-H resize-pane -L
|
||||
bind -nr M-L resize-pane -R
|
||||
|
||||
##########
|
||||
# Design #
|
||||
##########
|
||||
|
||||
# Borders
|
||||
set -g pane-border-style 'fg=colour12'
|
||||
set -g pane-active-border-style 'fg=colour12'
|
||||
|
||||
# Statusbar
|
||||
set -g status-position bottom
|
||||
set -g status-justify left
|
||||
set -g status-style 'bg=colour235'
|
||||
set -g status-left ''
|
||||
|
||||
# Command line and messages
|
||||
set -g message-style 'bg=color235'
|
||||
set -g display-time 4000
|
||||
|
||||
# Tabs
|
||||
setw -g window-status-current-style 'bg=colour238 bold'
|
||||
setw -g window-status-current-format ' #[fg=color245]#I#[fg=colour250] #W '
|
||||
setw -g window-status-style 'bg=colour236'
|
||||
setw -g window-status-format ' #[fg=colour240]#I#[fg=colour245] #W '
|
||||
|
||||
# Clock
|
||||
set -g status-right '#[fg=colour0,bg=colour240] %H:%M '
|
||||
set -g status-interval 10
|
||||
|
||||
# Scroll number
|
||||
setw -g mode-style 'fg=colour240'
|
||||
Reference in New Issue
Block a user