onward
This commit is contained in:
parent
03fcc056f0
commit
8b86e7dfd2
5 changed files with 77 additions and 24 deletions
|
@ -314,36 +314,84 @@ nnoremap <silent> g0 <cmd>lua vim.lsp.buf.document_symbol()<CR>
|
|||
nnoremap <silent> gW <cmd>lua vim.lsp.buf.workspace_symbol()<CR>
|
||||
nnoremap <silent> gd <cmd>lua vim.lsp.buf.declaration()<CR>
|
||||
|
||||
:lua << END
|
||||
require'lspconfig'.gopls.setup{
|
||||
}
|
||||
|
||||
require'lspconfig'.jdtls.setup{
|
||||
}
|
||||
:lua << EOF
|
||||
local nvim_lsp = require('lspconfig')
|
||||
local on_attach = function(client, bufnr)
|
||||
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
||||
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||||
|
||||
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
-- Mappings.
|
||||
local opts = { noremap=true, silent=true }
|
||||
buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
||||
buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
||||
buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
||||
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
||||
buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
||||
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
|
||||
buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
|
||||
buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
|
||||
|
||||
-- Set some keybinds conditional on server capabilities
|
||||
if client.resolved_capabilities.document_formatting then
|
||||
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
|
||||
elseif client.resolved_capabilities.document_range_formatting then
|
||||
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts)
|
||||
end
|
||||
|
||||
-- Set autocommands conditional on server_capabilities
|
||||
if client.resolved_capabilities.document_highlight then
|
||||
vim.api.nvim_exec([[
|
||||
hi LspReferenceRead cterm=bold ctermbg=red guibg=LightYellow
|
||||
hi LspReferenceText cterm=bold ctermbg=red guibg=LightYellow
|
||||
hi LspReferenceWrite cterm=bold ctermbg=red guibg=LightYellow
|
||||
augroup lsp_document_highlight
|
||||
autocmd! * <buffer>
|
||||
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
|
||||
autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
|
||||
augroup END
|
||||
]], false)
|
||||
end
|
||||
end
|
||||
|
||||
-- Use a loop to conveniently both setup defined servers
|
||||
-- and map buffer local keybindings when the language server attaches
|
||||
local servers = { "gopls", "jdtls", "vimls", "yamlls" }
|
||||
for _, lsp in ipairs(servers) do
|
||||
nvim_lsp[lsp].setup { on_attach = on_attach }
|
||||
end
|
||||
|
||||
require'lspconfig'.sumneko_lua.setup{
|
||||
cmd = {"lua-language-server"};
|
||||
on_attach = on_attach;
|
||||
}
|
||||
|
||||
require'lspconfig'.terraformls.setup{
|
||||
cmd = {'terraform-ls', 'serve'}
|
||||
cmd = {'terraform-ls', 'serve'};
|
||||
on_attach = on_attach;
|
||||
}
|
||||
EOF
|
||||
|
||||
require'lspconfig'.vimls.setup{
|
||||
}
|
||||
" nmap <tab> <Plug>(completion_smart_tab)
|
||||
" nmap <s-tab> <Plug>(completion_smart_s_tab)
|
||||
" let g:completion_chain_complete_list = [
|
||||
" \{'complete_items': ['lsp', 'buffers', 'snippet']},
|
||||
" \{'mode': '<c-p>'},
|
||||
" \{'mode': '<c-n>'}
|
||||
" \]
|
||||
|
||||
require'lspconfig'.yamlls.setup{
|
||||
}
|
||||
|
||||
END
|
||||
|
||||
nmap <tab> <Plug>(completion_smart_tab)
|
||||
nmap <s-tab> <Plug>(completion_smart_s_tab)
|
||||
let g:completion_chain_complete_list = [
|
||||
\{'complete_items': ['lsp', 'buffers', 'snippet']},
|
||||
\{'mode': '<c-p>'},
|
||||
\{'mode': '<c-n>'}
|
||||
\]
|
||||
let g:completion_matching_strategy_list = ['exact', 'substring', 'fuzzy']
|
||||
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
|
||||
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
|
||||
|
||||
|
||||
" Use <Tab> and <S-Tab> to navigate through popup menu
|
||||
|
|
|
@ -2,11 +2,11 @@ add_newline = false
|
|||
|
||||
format = """
|
||||
$status\
|
||||
$cmd_duration\
|
||||
$jobs\
|
||||
$kubernetes\
|
||||
$gcloud\
|
||||
"""
|
||||
#$cmd_duration\
|
||||
# $git_branch\
|
||||
# $git_commit\
|
||||
# $git_state\
|
||||
|
|
|
@ -21,7 +21,7 @@ rebase = true
|
|||
b = branch -va
|
||||
d = diff --stat -p -C
|
||||
ds = diff --staged --stat -p -C
|
||||
du = !"git --no-pager diff --stat -p -C --color=always | bat"
|
||||
du = !"git --no-pager diff --stat -p -C --color=always"
|
||||
patch = !git --no-pager diff --no-color
|
||||
co = checkout
|
||||
st = status -sb
|
||||
|
|
|
@ -17,8 +17,9 @@ bind-key ] paste-buffer -p
|
|||
|
||||
set -g update-environment "XAUTHORITY DISPLAY WINDOWID SSH_ASKPASS SSH_AGENT_PID SSH_CONNECTION"
|
||||
set -g default-command zsh
|
||||
set -g history-limit 50000
|
||||
set -g history-limit 100000
|
||||
|
||||
set-option -g default-terminal "xterm-direct"
|
||||
set -ga terminal-overrides ",*:Tc" # true colous support
|
||||
set -as terminal-overrides ',*:sitm=\E[3m' # Italics support for older ncurses
|
||||
set -as terminal-overrides ',*:smxx=\E[9m' # Strikeout
|
||||
|
@ -54,6 +55,9 @@ bind C-k clear-history
|
|||
bind -n C-l send-keys C-l \; clear-history
|
||||
bind-key -T copy-mode-vi WheelUpPane select-pane \; send-keys -X -N 1 scroll-up
|
||||
bind-key -T copy-mode-vi WheelDownPane select-pane \; send-keys -X -N 1 scroll-down
|
||||
bind-key / copy-mode \; send-key ?
|
||||
bind-key P 'capture-pane' \; capture-pane -S - \; save-buffer /tmp/tmux \; delete-buffer
|
||||
bind-key -n C-\\ copy-mode \; send -X search-backward " % "\; send -X search-again
|
||||
|
||||
setw -g window-status-format ""
|
||||
setw -g window-status-current-format ""
|
||||
|
|
3
.zshrc
3
.zshrc
|
@ -121,6 +121,7 @@ alias tree='exa --tree'
|
|||
alias v=vgrep
|
||||
alias ve='env EDITOR= vgrep -s'
|
||||
alias xc='xclip -selection clipboard'
|
||||
alias c='cut -c-${COLUMNS}'
|
||||
|
||||
|
||||
## vim
|
||||
|
@ -151,7 +152,7 @@ export PATH=$HOME/.krew/bin:$PATH
|
|||
command -v linkerd >/dev/null 2>&1 && source <(linkerd completion zsh)
|
||||
|
||||
## Flux
|
||||
export FLUX_FORWARD_NAMESPACE=flux
|
||||
command -v flux >/dev/null 2>&1 && source <(flux completion zsh)
|
||||
|
||||
## Google Cloud
|
||||
[ -f /opt/google-cloud-sdk/completion.zsh.inc ] && source /opt/google-cloud-sdk/completion.zsh.inc
|
||||
|
|
Loading…
Reference in a new issue