Skip to content

Commit

Permalink
Merge pull request #7 from timchurchard/feature/wordgrinder
Browse files Browse the repository at this point in the history
Dockerfile/ Install wordgrinder and fix coc.nvim config
  • Loading branch information
timchurchard authored Aug 6, 2024
2 parents bdb2be8 + f48145e commit 0e32ff7
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 12 deletions.
19 changes: 13 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ RUN apt install -y python3 python3-venv && \

ENV PATH=$PATH:/opt/venv/bin

# Install wordgrinder (https://github.com/davidgiven/wordgrinder)
RUN apt install -y ninja-build libncursesw5-dev zlib1g-dev libglfw3-dev build-essential pkg-config xxd python3 python3-pil && \
mkdir -p /usr/local/man/man1/ && \
git clone https://github.com/davidgiven/wordgrinder.git wordgrinder.git && \
cd wordgrinder.git && make && make install

# Install neovim: https://github.com/neovim/neovim/wiki/Installing-Neovim
ENV VIM_COMMIT=v0.10.0
RUN apt install -y luajit ruby-dev && \
Expand All @@ -62,8 +68,8 @@ RUN apt install -y ripgrep fd-find
RUN apt-get autoclean -y && apt-get autoremove -y && apt-get clean -y

# Install golang
ENV GOLANG_URL=https://golang.org/dl/go1.21.11.linux-amd64.tar.gz
ENV GOLANG_SHA256=54a87a9325155b98c85bc04dc50298ddd682489eb47f486f2e6cb0707554abf0
ENV GOLANG_URL=https://golang.org/dl/go1.21.12.linux-amd64.tar.gz
ENV GOLANG_SHA256=121ab58632787e18ae0caa8ae285b581f9470d0f6b3defde9e1600e211f583c5

RUN curl -o golang.tgz -L ${GOLANG_URL} && \
echo "$GOLANG_SHA256 golang.tgz" > golang.tgz.sha256 && \
Expand Down Expand Up @@ -121,7 +127,7 @@ RUN curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubu
RUN mkdir -p ~/.config/nvim/plugged && cd ~/.config/nvim/plugged && \
git clone --depth 1 https://github.com/stevearc/aerial.nvim.git && \
git clone --depth 1 https://github.com/nvim-lua/plenary.nvim.git && \
git clone --branch 0.1.5 --depth 1 https://github.com/nvim-telescope/telescope.nvim.git && \
git clone --branch 0.1.8 --depth 1 https://github.com/nvim-telescope/telescope.nvim.git && \
git clone --depth 1 https://github.com/windwp/nvim-autopairs.git && \
git clone --depth 1 https://github.com/ntpeters/vim-better-whitespace.git && \
git clone --depth 1 https://github.com/neovim/nvim-lspconfig.git && \
Expand All @@ -132,7 +138,7 @@ RUN mkdir -p ~/.config/nvim/plugged && cd ~/.config/nvim/plugged && \
git clone --depth 1 https://github.com/ray-x/guihua.lua.git && \
git clone --depth 1 https://github.com/ray-x/lsp_signature.nvim.git && \
git clone --depth 1 https://github.com/ray-x/go.nvim.git && \
git clone --depth 1 https://github.com/neoclide/coc.nvim.git && \
git clone --branch release --depth 1 https://github.com/neoclide/coc.nvim.git && \
git clone --depth 1 https://github.com/kyazdani42/nvim-web-devicons.git && \
git clone --depth 1 https://github.com/kyazdani42/nvim-tree.lua.git && \
git clone --depth 1 https://github.com/vim-airline/vim-airline.git && \
Expand All @@ -157,11 +163,12 @@ COPY files/vimrc .config/nvim/
COPY files/init.vim .config/nvim/
COPY files/coc-settings.json .config/nvim/

RUN zsh -c ". $NVM_DIR/nvm.sh && cd ~/.config/nvim/plugged/coc.nvim && npm ci"
RUN zsh -c ". $NVM_DIR/nvm.sh && cd ~/.config/nvim/plugged/coc.nvim && npm install && npm ci"

RUN nvim +:PlugInstall +:qa \
nvim +:GoInstallBinaries +:qa \
nvim "+:TSInstall go" +:qa
nvim "+:TSInstall go" +:qa \
nvim "+:CocInstall coc-json coc-tsserver coc-go" +:qa

# Copy in final bits for /opt
COPY files/entrypoint.sh /opt/
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Portable IDE for golang with neovim, tmux, & zsh in docker.
Based on [ubuntu](https://hub.docker.com/_/ubuntu) docker image. Extra tools:
- [aws cli v2](https://github.com/aws/aws-cli/tree/v2)
- [terraform](https://www.terraform.io/) (1.4.5) and [terragrunt](https://terragrunt.gruntwork.io/) v0.45.4
- github [cli](https://github.com/cli/cli) (gh)
- [github cli](https://github.com/cli/cli) (gh)

**Note** I built a docker image full of useful tools and setup for me. I do not care about size. Be aware the build and final image is large.

Expand Down Expand Up @@ -51,8 +51,9 @@ vim-go is installed with [gofumpt](https://github.com/mvdan/gofumpt) as the defa

### golang

go 1.21.7 is installed with related tools like [golangci-lint](https://github.com/golangci/golangci-lint) and [delve](https://github.com/go-delve/delve.
go 1.21.12 is installed with related tools like [golangci-lint](https://github.com/golangci/golangci-lint) and [delve](https://github.com/go-delve/delve.

### other

- [rexi](https://github.com/royreznik/rexi) CLI tool for testing regex
- [rexi](https://github.com/royreznik/rexi) TUI tool for testing regex
- [wordgriner](https://github.com/davidgiven/wordgrinder) TUI for word processing
2 changes: 1 addition & 1 deletion files/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ fi
chown -R ubuntu: /home/ubuntu/.??* &

# Step down to ubuntu user
gosu ubuntu sh -c "nvim -s /tmp/gib.txt ; if [ ! -z \"$GIT_USER_NAME\" ]; then git config --global user.name \"$GIT_USER_NAME\"; git config --global user.email \"$GIT_USER_EMAIL\"; fi; cd /workspace ; mkdir -p .vim-tmp ; tmux -u -2 $@"
gosu ubuntu sh -c "if [ ! -z \"$GIT_USER_NAME\" ]; then git config --global user.name \"$GIT_USER_NAME\"; git config --global user.email \"$GIT_USER_EMAIL\"; fi; cd /workspace ; mkdir -p .vim-tmp ; tmux -u -2 $@"
18 changes: 16 additions & 2 deletions files/init.vim
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,20 @@ nnoremap <leader>fg <cmd>Telescope live_grep<cr>
nnoremap <leader>fb <cmd>Telescope buffers<cr>
nnoremap <leader>fh <cmd>Telescope help_tags<cr>
" enable "enter to complete" in coc
" inoremap <silent><expr> <cr> coc#pum#visible() ? coc#pum#confirm() : "\<CR>"

" use <tab> to trigger completion and navigate to the next complete item
function! CheckBackspace() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction

inoremap <silent><expr> <Tab>
\ coc#pum#visible() ? coc#pum#next(1) :
\ CheckBackspace() ? "\<Tab>" :
\ coc#refresh()
" toggle the tag bar
nnoremap <silent> <leader>a :AerialToggle float<cr>
Expand Down Expand Up @@ -244,8 +258,8 @@ require("toggleterm").setup{

require 'go'.setup({
goimports = 'gopls', -- if set to 'gopls' will use golsp format
gofmt = 'gopls', -- if set to gopls will use golsp format
--max_line_len = 160,
gofmt = 'gofmt', -- if set to gopls will use golsp format
max_line_len = 160,
tag_transform = false, -- gomodifytag overwrite eg snakecase camelcase
test_dir = '',
comment_placeholder = ' ',
Expand Down

0 comments on commit 0e32ff7

Please sign in to comment.