Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
sheeaza committed Jul 18, 2020
1 parent 08b4c4a commit af85395
Show file tree
Hide file tree
Showing 5 changed files with 455 additions and 0 deletions.
66 changes: 66 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
FROM alpine:latest as build

RUN apk add -U --no-cache build-base ncurses-dev py3-pip python3-dev git bash cmake

WORKDIR /root/tmp/
# gtags
RUN wget https://ftp.gnu.org/pub/gnu/global/global-6.6.4.tar.gz && tar xvf global-6.6.4.tar.gz && \
cd global-6.6.4 && ./configure && make -j8 && make install-exec DESTDIR=/root/tmp/global/install

COPY pyreq.txt /root/tmp/
RUN pip install -r pyreq.txt --prefix=/root/tmp/pipinstall

#Leaderf plugin that need build
RUN git clone https://github.com/Yggdroot/LeaderF.git && cd LeaderF && ./install.sh

#################################### deploy ##############################
# ssh rg git nvim fish fzf tmux gtags
FROM alpine:latest as deploy

COPY --from=build /root/tmp/global/install/usr/local/bin/ /usr/local/bin/
COPY --from=build /root/tmp/pipinstall /usr/

RUN apk add -U --no-cache \
neovim git \
fish tmux openssh-client bash \
tree curl less ripgrep perl py3-pip tar npm findutils tig ctags

ENV LANG=C.UTF-8 LANGUAGE=C.UTF-8 LC_ALL=C.UTF-8
# TERM
ENV TERM=xterm-256color

#tmux config
WORKDIR /root/
RUN git clone https://github.com/gpakosz/.tmux.git && ln -s -f .tmux/.tmux.conf && cp .tmux/.tmux.conf.local .
COPY tmux.conf.local /root/.tmux.conf.local

#nvim
RUN npm install -g neovim
RUN sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
WORKDIR /root/.config/nvim/
RUN git clone https://github.com/sheeaza/nvim.config.git .
RUN nvim --headless +PlugInstall +qall && nvim --headless '+CocInstall -sync coc-clangd' +qall
COPY --from=build /root/tmp/LeaderF/autoload/leaderf/python/ /root/.local/share/nvim/plugged/LeaderF/autoload/leaderf/python/
ENV VIRTUAL=nvim
ENV EDITOR=nvim

# fish
RUN curl -L https://get.oh-my.fish | fish
RUN fish -c 'omf install clearance' && fish -c 'set -Ux EDITOR nvim' && fish -c 'set -Ux VISUAL nvim' && \
fish -c 'alias -s l="ls --group-directories-first"' && \
fish -c 'alias -s la="l -a"' && fish -c 'alias -s ll="l -lh"' && fish -c 'alias -s lla="ll -a"' && \
fish -c 'alias -s git-root="cd (git rev-parse --show-toplevel)"' && \
fish -c 'set -U fish_user_paths /root/bin $fish_user_paths' && \
mkdir -p /root/.local/share/fish/generated_completions #see https://github.com/fish-shell/fish-shell/issues/7183
COPY fish_prompt.fish /root/.local/share/omf/themes/clearance/fish_prompt.fish

# fzf
RUN git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf && ~/.fzf/install --all

# switch shell to fish
RUN sed -i 's/\/root:\/bin\/ash/\/root:\/usr\/bin\/fish/g' /etc/passwd

RUN apk add -U --no-cache clang-extra-tools
WORKDIR /root/
ENTRYPOINT ["/usr/bin/fish"]
26 changes: 26 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: '3.8'
services:
dev:
image: kungfury:1.0
init: true
volumes:
- type: bind
source: ~/.ssh
target: /root/.ssh
- type: bind
source: ~/.gitconfig
target: /root/.gitconfig
- type: bind
source: ~/
target: /root/workspace
- type: bind
source: ~/bin
target: /root/bin
- type: volume
source: home
target: /root/
tty: true
stdin_open: true

volumes:
home:
61 changes: 61 additions & 0 deletions fish_prompt.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# name: clearance
# ---------------
# Based on idan. Display the following bits on the left:
# - Virtualenv name (if applicable, see https://github.com/adambrenecki/virtualfish)
# - Current directory name
# - Git branch and dirty state (if inside a git repo)

function _git_branch_name
echo (command git symbolic-ref HEAD 2> /dev/null | sed -e 's|^refs/heads/||')
end

function _git_is_dirty
echo (command git diff --ignore-submodules HEAD 2> /dev/null)
end

function fish_prompt
set -l last_status $status

set -l cyan (set_color cyan)
set -l yellow (set_color yellow)
set -l red (set_color red)
set -l blue (set_color blue)
set -l green (set_color green)
set -l normal (set_color normal)

set -l cwd $blue(pwd | sed "s:^$HOME:~:")

# Output the prompt, left to right

# Add a newline before new prompts
echo -e ''

# Display [venvname] if in a virtualenv
if set -q VIRTUAL_ENV
echo -n -s (set_color -b cyan black) '[' (basename "$VIRTUAL_ENV") ']' $normal ' '
end

# Print pwd or full path
echo -n -s $cwd $normal

# Show git branch and status
if [ (_git_branch_name) ]
set -l git_branch (_git_branch_name)

if [ (_git_is_dirty) ]
set git_info '(' $yellow $git_branch "±" $normal ')'
else
set git_info '(' $green $git_branch $normal ')'
end
echo -n -s ' · ' $git_info $normal
end

set -l prompt_color $red
if test $last_status = 0
set prompt_color $normal
end

# Terminate with a nice prompt char
echo -e ''
echo -e -n -s $prompt_color '' $normal
end
1 change: 1 addition & 0 deletions pyreq.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pynvim>=0.4.1
Loading

0 comments on commit af85395

Please sign in to comment.