1
0
Fork 0

Upgrade versions, add pyenv

main
Ambrose Chua 2023-01-20 11:31:39 +08:00
parent f56649c486
commit 7f4b5a9d2a
22 changed files with 192 additions and 80 deletions

View File

@ -17,82 +17,94 @@ call plug#begin()
" language server protocol
Plug 'prabirshrestha/vim-lsp'
Plug 'mattn/vim-lsp-settings'
Plug 'prabirshrestha/asyncomplete.vim'
Plug 'prabirshrestha/asyncomplete-lsp.vim'
"Plug 'neovim/nvim-lspconfig'
"Plug 'prabirshrestha/vim-lsp'
"Plug 'mattn/vim-lsp-settings'
"Plug 'prabirshrestha/asyncomplete.vim'
"Plug 'prabirshrestha/asyncomplete-lsp.vim'
Plug 'williamboman/mason.nvim'
Plug 'williamboman/mason-lspconfig.nvim'
Plug 'neovim/nvim-lspconfig'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-cmdline'
Plug 'hrsh7th/nvim-cmp'
autocmd FileType * nmap gD <plug>(lsp-definition)
autocmd FileType * nmap gd <plug>(lsp-peek-definition)
autocmd FileType * nmap gY <plug>(lsp-type-definition)
autocmd FileType * nmap gy <plug>(lsp-peek-type-definition)
autocmd FileType * nmap gr <plug>(lsp-references)
autocmd FileType * nmap gf <plug>(lsp-document-symbol-search)
autocmd FileType * nmap gF <plug>(lsp-workspace-symbol-search)
autocmd FileType * nmap gk <plug>(lsp-next-diagnostic)
" snippets
autocmd FileType * nmap <leader>f <plug>(lsp-document-format)
autocmd FileType * nmap <leader>k <plug>(lsp-code-action)
autocmd FileType * nmap <leader>x <plug>(lsp-code-lens)
autocmd FileType * nmap <leader>n <plug>(lsp-rename)
Plug 'hrsh7th/cmp-vsnip'
Plug 'hrsh7th/vim-vsnip'
function! SplitTerm(height, cmd)
split
exe "resize " . a:height
exe "terminal " . a:cmd
endfunction
"autocmd FileType * nmap gD <plug>(lsp-definition)
"autocmd FileType * nmap gd <plug>(lsp-peek-definition)
"autocmd FileType * nmap gY <plug>(lsp-type-definition)
"autocmd FileType * nmap gy <plug>(lsp-peek-type-definition)
"autocmd FileType * nmap gr <plug>(lsp-references)
"autocmd FileType * nmap gf <plug>(lsp-document-symbol-search)
"autocmd FileType * nmap gF <plug>(lsp-workspace-symbol-search)
"autocmd FileType * nmap gk <plug>(lsp-next-diagnostic)
"
"autocmd FileType * nmap <leader>f <plug>(lsp-document-format)
"autocmd FileType * nmap <leader>k <plug>(lsp-code-action)
"autocmd FileType * nmap <leader>x <plug>(lsp-code-lens)
"autocmd FileType * nmap <leader>n <plug>(lsp-rename)
"
"function! SplitTerm(height, cmd)
" split
" exe "resize " . a:height
" exe "terminal " . a:cmd
"endfunction
" rust
autocmd FileType rust nmap <leader>t :call SplitTerm(16, "cargo test")<CR>
autocmd FileType rust nmap <leader>b :call SplitTerm(16, "cargo build")<CR>
autocmd FileType rust nmap <leader>r :call SplitTerm(16, "cargo run")<CR>
autocmd FileType rust nmap K <plug>(lsp-hover)
"autocmd FileType rust nmap <leader>t :call SplitTerm(16, "cargo test")<CR>
"autocmd FileType rust nmap <leader>b :call SplitTerm(16, "cargo build")<CR>
"autocmd FileType rust nmap <leader>r :call SplitTerm(16, "cargo run")<CR>
"autocmd FileType rust nmap K <plug>(lsp-hover)
" go
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
let g:go_highlight_types = 1
let g:go_highlight_fields = 1
let g:go_highlight_functions = 1
let g:go_highlight_function_calls = 1
let g:go_highlight_operators = 1
let g:go_highlight_extra_types = 1
let g:go_highlight_build_constraints = 1
let g:go_highlight_generate_tags = 1
let g:go_metalinter_autosave = 1
let g:go_fmt_command = "goimports"
let g:go_list_type_commands = {"GoMetaLinterAutoSave": "quickfix"}
let g:go_def_mapping_enabled = 0
autocmd FileType go nmap gD <Plug>(go-def)
autocmd FileType go nmap gd <Plug>(go-def-split)
autocmd FileType go nmap gY <Plug>(go-def-type)
autocmd FileType go nmap gy <Plug>(go-def-type-split)
autocmd FileType go nmap <leader>a <Plug>(go-alternate-edit)
autocmd FileType go nmap <leader>t <Plug>(go-test)
autocmd FileType go nmap <Leader>c <Plug>(go-coverage-toggle)
autocmd FileType go nmap <leader>b <Plug>(go-build)
autocmd FileType go nmap <leader>r <Plug>(go-run)
autocmd FileType go nmap K <Plug>(go-doc)
"Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
"let g:go_highlight_types = 1
"let g:go_highlight_fields = 1
"let g:go_highlight_functions = 1
"let g:go_highlight_function_calls = 1
"let g:go_highlight_operators = 1
"let g:go_highlight_extra_types = 1
"let g:go_highlight_build_constraints = 1
"let g:go_highlight_generate_tags = 1
"let g:go_metalinter_autosave = 1
"let g:go_fmt_command = "goimports"
"let g:go_list_type_commands = {"GoMetaLinterAutoSave": "quickfix"}
"let g:go_def_mapping_enabled = 0
"autocmd FileType go nmap gD <Plug>(go-def)
"autocmd FileType go nmap gd <Plug>(go-def-split)
"autocmd FileType go nmap gY <Plug>(go-def-type)
"autocmd FileType go nmap gy <Plug>(go-def-type-split)
"autocmd FileType go nmap <leader>a <Plug>(go-alternate-edit)
"autocmd FileType go nmap <leader>t <Plug>(go-test)
"autocmd FileType go nmap <Leader>c <Plug>(go-coverage-toggle)
"autocmd FileType go nmap <leader>b <Plug>(go-build)
"autocmd FileType go nmap <leader>r <Plug>(go-run)
"autocmd FileType go nmap K <Plug>(go-doc)
" javascript & typescript
autocmd FileType javascript,typescript nmap <leader>t :call SplitTerm(16, "npm test")<CR>
autocmd FileType javascript,typescript nmap <leader>b :call SplitTerm(16, "npm run build")<CR>
autocmd FileType javascript,typescript nmap <leader>r :call SplitTerm(16, "npm start")<CR>
autocmd FileType javascript,typescript nmap K <plug>(lsp-hover)
"autocmd FileType javascript,typescript nmap <leader>t :call SplitTerm(16, "npm test")<CR>
"autocmd FileType javascript,typescript nmap <leader>b :call SplitTerm(16, "npm run build")<CR>
"autocmd FileType javascript,typescript nmap <leader>r :call SplitTerm(16, "npm start")<CR>
"autocmd FileType javascript,typescript nmap K <plug>(lsp-hover)
" vue
Plug 'posva/vim-vue'
"Plug 'posva/vim-vue'
" more language servers
if executable('astro-ls')
" npm install --global @astrojs/language-server
au User lsp_setup call lsp#register_server({'name': 'astro-ls', 'cmd': {server_info->['astro-ls']}, 'allowlist': ['astro']})
endif
"if executable('astro-ls')
" " npm install --global @astrojs/language-server
" au User lsp_setup call lsp#register_server({'name': 'astro-ls', 'cmd': {server_info->['astro-ls']}, 'allowlist': ['astro']})
"endif
" git
@ -241,3 +253,7 @@ let g:netrw_winsize=25
" spellcheck
set spell spelllang=en_gb
" code completion using language server protocol
lua require("lsp")

86
.config/nvim/lua/lsp.lua Normal file
View File

@ -0,0 +1,86 @@
-- Mappings.
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
local opts = { noremap=true, silent=true }
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer
local on_attach = function(client, bufnr)
-- Enable completion triggered by <c-x><c-o>
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions
local bufopts = { noremap=true, silent=true, buffer=bufnr }
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts)
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
vim.keymap.set('n', '<space>wl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, bufopts)
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
vim.keymap.set('n', '<space>x', vim.lsp.codelens.run, bufopts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
vim.keymap.set('n', '<space>f', function() vim.lsp.buf.format { async = true } end, bufopts)
end
-- Add additional capabilities supported by nvim-cmp
local capabilities = require('cmp_nvim_lsp').default_capabilities()
-- Configure LSP servers
local lspconfig = require('lspconfig')
require('mason').setup()
require('mason-lspconfig').setup()
require('mason-lspconfig').setup_handlers {
function (server_name)
lspconfig[server_name].setup {
on_attach = on_attach,
capabilities = capabilities,
}
end
}
-- Configure nvim-cmp
local cmp = require('cmp')
cmp.setup {
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
mapping = cmp.mapping.preset.insert({
['<C-u>'] = cmp.mapping.scroll_docs(-4),
['<C-d>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end, { 'i', 's' }),
}),
sources = {
{ name = 'nvim_lsp' },
},
}

View File

@ -1,4 +1,4 @@
FROM alpine:3.14
FROM alpine:3.17
RUN echo hosts: dns files > /etc/nsswitch.conf
RUN apk add --no-cache --update \

View File

@ -1,4 +1,4 @@
FROM alpine:3.14
FROM alpine:3.17
RUN echo hosts: dns files > /etc/nsswitch.conf
RUN apk add --no-cache --update \

View File

@ -1,4 +1,4 @@
FROM alpine:3.14
FROM alpine:3.17
RUN echo hosts: dns files > /etc/nsswitch.conf
RUN apk add --no-cache --update \

View File

@ -1,4 +1,4 @@
FROM alpine:3.14
FROM alpine:3.17
RUN echo hosts: dns files > /etc/nsswitch.conf
RUN apk add --no-cache --update \

View File

@ -1,4 +1,4 @@
FROM node:current-alpine3.14
FROM node:current-alpine3.17
RUN echo hosts: dns files > /etc/nsswitch.conf
RUN apk add --no-cache --update \

View File

@ -1,4 +1,4 @@
FROM alpine:3.14
FROM alpine:3.17
RUN echo hosts: dns files > /etc/nsswitch.conf
RUN apk add --no-cache --update \

View File

@ -1,4 +1,4 @@
FROM alpine:3.14
FROM alpine:3.17
RUN echo hosts: dns files > /etc/nsswitch.conf
RUN apk add --no-cache --update \

View File

@ -1,4 +1,4 @@
FROM alpine:3.14
FROM alpine:3.17
RUN echo hosts: dns files > /etc/nsswitch.conf
RUN apk add --no-cache --update \

View File

@ -1,4 +1,4 @@
FROM fedora:34
FROM fedora:37
RUN dnf install -y \
zsh \

View File

@ -1,4 +1,4 @@
FROM fedora:34
FROM fedora:37
RUN dnf install -y \
zsh \

View File

@ -1,4 +1,4 @@
FROM fedora:34
FROM fedora:37
RUN dnf install -y \
zsh \

View File

@ -1,4 +1,4 @@
FROM fedora:34
FROM fedora:37
RUN dnf install -y \
zsh \

View File

@ -1,4 +1,4 @@
FROM fedora:34
FROM fedora:37
RUN dnf install -y \
zsh \

View File

@ -1,4 +1,4 @@
FROM fedora:34
FROM fedora:37
RUN dnf install -y \
zsh \

View File

@ -1,4 +1,4 @@
FROM ubuntu:21.04
FROM ubuntu:22.04
RUN apt-get update \
&& apt-get install -y \

View File

@ -1,4 +1,4 @@
FROM ubuntu:21.04
FROM ubuntu:22.04
RUN apt-get update \
&& apt-get install -y \

View File

@ -1,4 +1,4 @@
FROM ubuntu:21.04
FROM ubuntu:22.04
RUN apt-get update \
&& apt-get install -y \

View File

@ -1,4 +1,4 @@
FROM ubuntu:21.04
FROM ubuntu:22.04
RUN apt-get update \
&& apt-get install -y \

1
.gitignore vendored
View File

@ -25,6 +25,7 @@
!.config/nvim/colors
!.config/nvim/skel
!.config/nvim/init.vim
!.config/nvim/lua
!.config/skhd
!.config/sway
.config/sway/enabled/*

17
.zshrc
View File

@ -64,10 +64,16 @@ if [[ -d "$HOME/.deno" ]]; then
export DENO_INSTALL="$HOME/.deno"
export PATH="$DENO_INSTALL/bin:$PATH"
fi
if [[ -d "$HOME/.nvm" ]]; then
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
export PYENV_ROOT="$HOME/.pyenv"
if [[ -d "$PYENV_ROOT" ]]; then
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
fi
export NVM_DIR="$HOME/.nvm"
if [[ -d "$NVM_DIR" ]]; then
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
fi
if [[ -f "$(which ruby 2>/dev/null)" ]]; then
export PATH="$(ruby -e 'puts Gem.user_dir')/bin:$PATH"
@ -502,3 +508,6 @@ if [[ -f "$(which gpgconf 2>/dev/null)" ]]; then
echo UPDATESTARTUPTTY | gpg-connect-agent >/dev/null 2>&1
}
fi
# add Pulumi to the PATH
export PATH=$PATH:$HOME/.pulumi/bin