nvim and tmux config

This commit is contained in:
Daniel Lundin 2021-07-22 10:32:46 +02:00
parent 5f5e10b73d
commit bc77f74e5a
10 changed files with 146 additions and 39 deletions

View file

@ -13,14 +13,14 @@ tmux:
styles: styles:
clear: '#[fg=default]' clear: '#[fg=default]'
state: '#[bg=red,fg=white]' state: '#[bg=red,fg=white]'
branch: '#[fg=#9ccc65,bg=#1b5e20] ' branch: '#[fg=#9ccc65,bg=#2E7D32] '
remote: '#[fg=cyan]' remote: '#[fg=cyan]'
staged: '#[fg=green]' staged: '#[fg=green]'
conflict: '#[fg=red]' conflict: '#[fg=red]'
modified: '#[fg=#fdd835,bg=#1b5e20]' modified: '#[fg=#fdd835,bg=#2E7D32]'
untracked: '#[fg=#ff7043,bg=#1b5e20]' untracked: '#[fg=#ff7043,bg=#2E7D32]'
stashed: '#[fg=#ffcdd2]' stashed: '#[fg=#ffcdd2]'
clean: '#[fg=#4caf50,bg=#1b5e20]' clean: '#[fg=#4caf50,bg=#2E7D32]'
layout: [branch, divergence, ' ', flags, '#[fg=#212121]▕'] layout: [branch, divergence, ' ', flags, '#[fg=#212121]▕']
options: options:
branch_max_len: 0 branch_max_len: 0

View file

@ -1,5 +1,8 @@
lua require("init") lua require("init")
set title
set titlestring=%F%m\ %r\ %y
function s:recompile_plugins() function s:recompile_plugins()
luafile % luafile %
PackerCompile PackerCompile

View file

@ -42,15 +42,14 @@ vim.fn.sign_define(
local on_attach = function() local on_attach = function()
require("folding").on_attach() require("folding").on_attach()
require "lsp_signature".on_attach() -- Note: add in lsp client on-attach
end end
-- simple setups -- -- simple setups --
local servers = { local servers = {
"bashls", "bashls",
"cssls",
"dockerls", "dockerls",
"gopls", "gopls",
"html",
"jsonls", "jsonls",
-- "sql", -- "sql",
"sumneko_lua", "sumneko_lua",
@ -105,6 +104,25 @@ local yaml_is_k8s = function(bufnr)
return false return false
end end
lspconfig.cssls.setup {
cmd = { "css-languageserver", "--stdio" },
filetypes = { "css" },
settings = {}
}
lspconfig.html.setup {
cmd = { "vscode-html-languageserver", "--stdio" },
filetypes = { "html" },
init_options = {
configurationSection = { "html", "css", "javascript" },
embeddedLanguages = {
css = true,
javascript = true,
}
},
settings = {}
}
lspconfig.yamlls.setup { lspconfig.yamlls.setup {
settings = { settings = {
yaml = { yaml = {
@ -148,3 +166,72 @@ lspconfig.yamlls.setup {
} }
} }
} }
-- npm install -g typescript typescript-language-server
require'lspconfig'.tsserver.setup({
on_attach = function(client, bufnr)
client.resolved_capabilities.document_formatting = false
on_attach(client)
require'lsp_signature'.on_attach({
bind = false, -- This is mandatory, otherwise border config won't get registered.
-- If you want to hook lspsaga or other signature handler, pls set to false
doc_lines = 2, -- will show two lines of comment/doc(if there are more than two lines in doc, will be truncated);
-- set to 0 if you DO NOT want any API comments be shown
-- This setting only take effect in insert mode, it does not affect signature help in normal
-- mode, 10 by default
floating_window = true, -- show hint in a floating window, set to false for virtual text only mode
fix_pos = false, -- set to true, the floating window will not auto-close until finish all parameters
hint_enable = false, -- virtual hint enable
hint_prefix = "🐼 ", -- Panda for parameter
hint_scheme = "String",
use_lspsaga = true, -- set to true if you want to use lspsaga popup
hi_parameter = "Search", -- how your parameter will be highlight
max_height = 12, -- max height of signature floating_window, if content is more than max_height, you can scroll down
-- to view the hiding contents
max_width = 120, -- max_width of signature floating_window, line will be wrapped if exceed max_width
handler_opts = {
border = "single" -- double, single, shadow, none
},
extra_trigger_chars = {} -- Array of extra characters that will trigger signature completion, e.g., {"(", ","}
})
local ts_utils = require("nvim-lsp-ts-utils")
ts_utils.setup {
debug = false,
disable_commands = false,
enable_import_on_completion = false,
import_all_timeout = 5000, -- ms
-- eslint
eslint_enable_code_actions = true,
eslint_enable_disable_comments = true,
eslint_bin = 'eslint_d',
eslint_config_fallback = nil,
eslint_enable_diagnostics = true,
-- formatting
enable_formatting = true,
formatter = 'prettier',
formatter_config_fallback = nil,
-- parentheses completion
complete_parens = false,
signature_help_in_parens = false,
-- update imports on file move
update_imports_on_move = true,
require_confirmation_on_move = true,
watch_dir = nil,
}
ts_utils.setup_client(client)
vim.api.nvim_buf_set_keymap(bufnr, "n", "<Leader>co", ":TSLspOrganize<CR>", { silent = true })
vim.api.nvim_buf_set_keymap(bufnr, "n", "qq", ":TSLspFixCurrent<CR>", { silent = true })
vim.api.nvim_buf_set_keymap(bufnr, "n", "<Leader>cR", ":TSLspRenameFile<CR>", { silent = true })
vim.api.nvim_buf_set_keymap(bufnr, "n", "<Leader>ci", ":TSLspImportAll<CR>", { silent = true })
end
})

View file

@ -7,8 +7,9 @@ telescope.setup {
defaults = { defaults = {
layout_strategy = "flex", layout_strategy = "flex",
-- layout_defaults = {flip_columns = 160}, -- layout_defaults = {flip_columns = 160},
preview_cutoff = 10, layout_config = {
results_height = 10, preview_cutoff = 10,
},
mappings = { mappings = {
i = { i = {
["<CR>"] = actions.select_default + actions.center, ["<CR>"] = actions.select_default + actions.center,

View file

@ -2,7 +2,6 @@ vim.cmd[[set undofile]]
vim.cmd[[set completeopt-=preview]] vim.cmd[[set completeopt-=preview]]
vim.cmd[[set viewoptions-=options]] vim.cmd[[set viewoptions-=options]]
vim.g.mapleader = ',' vim.g.mapleader = ','
vim.o.clipboard = 'unnamed'
vim.o.hidden = true vim.o.hidden = true
vim.o.mouse = 'a' vim.o.mouse = 'a'
vim.o.splitbelow = true vim.o.splitbelow = true

View file

@ -3,6 +3,8 @@ return require('packer').startup(function()
use 'pierreglaser/folding-nvim' use 'pierreglaser/folding-nvim'
use 'tjdevries/colorbuddy.vim' use 'tjdevries/colorbuddy.vim'
use 'wbthomason/packer.nvim' use 'wbthomason/packer.nvim'
use 'ray-x/lsp_signature.nvim'
use 'jose-elias-alvarez/nvim-lsp-ts-utils'
use { use {
'b3nj5m1n/kommentary', 'b3nj5m1n/kommentary',
@ -72,7 +74,7 @@ return require('packer').startup(function()
use { use {
"lukas-reineke/indent-blankline.nvim", "lukas-reineke/indent-blankline.nvim",
branch = "lua", branch = "master",
config = function() config = function()
-- vim.wo.colorcolumn = "100" -- vim.wo.colorcolumn = "100"
vim.g.indent_blankline_char = "" vim.g.indent_blankline_char = ""
@ -122,10 +124,12 @@ return require('packer').startup(function()
map('n', '<space>', '<cmd>lua require("telescope.builtin").oldfiles()<CR>') map('n', '<space>', '<cmd>lua require("telescope.builtin").oldfiles()<CR>')
map('n', '<leader>e', '<cmd>lua require("telescope.builtin").git_files()<CR>') map('n', '<leader>e', '<cmd>lua require("telescope.builtin").git_files()<CR>')
map('n', '<leader>g', '<cmd>lua require("telescope.builtin").git_status()<CR>') map('n', '<leader>g', '<cmd>lua require("telescope.builtin").git_status()<CR>')
map('n', '<leader>a', '<cmd>lua require("telescope.builtin").lsp_code_actions()<CR>')
map('n', '<leader>s', '<cmd>lua require("telescope.builtin").lsp_document_symbols()<CR>') map('n', '<leader>s', '<cmd>lua require("telescope.builtin").lsp_document_symbols()<CR>')
map('n', '<leader>t', '<cmd>lua require("telescope.builtin").treesitter()<CR>') map('n', '<leader>t', '<cmd>lua require("telescope.builtin").treesitter()<CR>')
map('n', '<leader>/', '<cmd>lua require("telescope.builtin").live_grep()<CR>') map('n', '<leader>/', '<cmd>lua require("telescope.builtin").live_grep()<CR>')
map('n', '<leader>.', '<cmd>lua require("telescope.builtin").file_browser()<CR>') map('n', '<leader>.', '<cmd>lua require("telescope.builtin").file_browser()<CR>')
map('n', '<leader>p', '<cmd>lua require("telescope.builtin").registers()<CR>')
map('n', 'gr', '<cmd>lua require("telescope.builtin").lsp_references()<CR>') map('n', 'gr', '<cmd>lua require("telescope.builtin").lsp_references()<CR>')
map('n', 'gd', '<cmd>lua require("telescope.builtin").lsp_definitions()<CR>') map('n', 'gd', '<cmd>lua require("telescope.builtin").lsp_definitions()<CR>')
map('n', 'g/', '<cmd>lua require("telescope.builtin").lsp_document_symbols()<CR>') map('n', 'g/', '<cmd>lua require("telescope.builtin").lsp_document_symbols()<CR>')
@ -149,6 +153,18 @@ return require('packer').startup(function()
end end
} }
use {
"ray-x/go.nvim",
config = function()
require('go').setup({
comment_placeholder = ''
})
vim.cmd("autocmd FileType go nmap <Leader>c :lua require('go.comment').gen()<cr>")
vim.cmd("autocmd BufWritePre *.go :silent! lua require('go.format').gofmt()")
vim.cmd('autocmd BufWritePre (InsertLeave?) <buffer> lua vim.lsp.buf.formatting_sync(nil,500)')
end
}
use { use {
"onsails/lspkind-nvim", "onsails/lspkind-nvim",
config = function() config = function()
@ -165,7 +181,7 @@ return require('packer').startup(function()
end end
} }
--[[ use { use {
"cuducos/yaml.nvim", "cuducos/yaml.nvim",
ft = {"yaml"}, ft = {"yaml"},
requires = { requires = {
@ -176,5 +192,4 @@ return require('packer').startup(function()
require("yaml_nvim").init() require("yaml_nvim").init()
end end
} }
]]
end) end)

View file

@ -1,12 +1,8 @@
add_newline = false add_newline = false
format = """\ format = """\
$hostname\
$directory\ $directory\
$git_branch\ ($character)\
$git_status\
$git_state\
( $character)\
""" """
[character] [character]

View file

@ -101,6 +101,7 @@ signingkey = 79020DB026385D4C
[init] [init]
defaultBranch = main defaultBranch = main
[url "git@github.com:"] [url "git@github.com:"]
insteadOf = https://github.com/ insteadOf = https://github.com/
insteadOf = https://github.com/ insteadOf = https://github.com/

View file

@ -19,7 +19,7 @@ set -g update-environment "XAUTHORITY DISPLAY WINDOWID SSH_ASKPASS SSH_AGENT_PID
set -g default-command zsh set -g default-command zsh
set -g history-limit 100000 set -g history-limit 100000
set-option -g default-terminal "tmux-direct" set-option -g default-terminal "tmux"
set -ga terminal-overrides ",*:Tc" # true colous support set -ga terminal-overrides ",*:Tc" # true colous support
set -as terminal-overrides ',*:sitm=\E[3m' # Italics support for older ncurses set -as terminal-overrides ',*:sitm=\E[3m' # Italics support for older ncurses
# set -as terminal-overrides ',*:smxx=\E[9m' # Strikeout # set -as terminal-overrides ',*:smxx=\E[9m' # Strikeout
@ -64,11 +64,11 @@ bind-key -n C-\\ copy-mode \; send -X search-backward " % "\; send -X search-aga
setw -g window-status-format "" setw -g window-status-format ""
setw -g window-status-current-format "" setw -g window-status-current-format ""
setw -g window-status-separator "" setw -g window-status-separator ""
set -g status-style "bg=#3e3e3e,fg=#c0c0c0" set -g status-style "bg=#f0f0f0,fg=#000000"
set -g status-left-length 0 set -g status-left-length 0
set -g status-right-length 0 set -g status-right-length 0
set -g status-left '#{?#{==:#W,1},  #T,#[bg=#263238,fg=#707070] #W#[fg=#212121]▕#[bg=#3e3e3e,fg=#a0a0a0] #{=|145|…:pane_current_path}}' set -g status-left '#{?#{==:#I,1},#[bg=#99aabb]  #[bg=#ccddee]#[fg=#445566] #T #[fg=#ccddee]#[bg=#f0f0f0]🭬,#[bg=#cccccc,fg=#ffffff] #I#[fg=#fcfcfc]▕#[bg=#f0f0f0,fg=#777777] #{=|145|…:pane_current_path}}'
set -g status-right '#{?#{==:#W,1},,#[fg=#f7f7f7]#{@starship}#[fg=#212121]▕#[fg=#f7f7f7]#(~/go/bin/gitmux -cfg ~/.config/gitmux/gitmux.yaml "#{pane_current_path}")}#[bg=#263238,fg=#707070] #(date +%%H:%%M) ' set -g status-right '#{?#{==:#I,1},,#[fg=#07f7f7]#{@starship}#[fg=#fcfcfc]▕#[fg=#f7f7f7]#(~/go/bin/gitmux -cfg ~/.config/gitmux/gitmux.yaml "#{pane_current_path}")}#[bg=#cccccc,fg=#ffffff] #(date +%%H:%%M) '
set -g set-titles on set -g set-titles on
set -g set-titles-string "#H - #T" set -g set-titles-string "#H - #T"

41
.zshrc
View file

@ -5,8 +5,6 @@ zplug "plugins/git", from:oh-my-zsh
zplug "zsh-users/zsh-completions" zplug "zsh-users/zsh-completions"
zplug 'zsh-users/zsh-syntax-highlighting', defer:2 zplug 'zsh-users/zsh-syntax-highlighting', defer:2
zplug 'zsh-users/zsh-history-substring-search', defer:3 zplug 'zsh-users/zsh-history-substring-search', defer:3
# zplug 'zsh-users/zsh-autosuggestions'
# zplug 'Aloxaf/fzf-tab'
if ! zplug check --verbose; then if ! zplug check --verbose; then
printf "Install? [y/N]: " printf "Install? [y/N]: "
@ -44,10 +42,6 @@ setopt extended_glob
setopt ksh_glob setopt ksh_glob
setopt null_glob setopt null_glob
# ## Completion
autoload -Uz compinit
compinit
## Autosuggest ## Autosuggest
# ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#D7CCC8,italic" # ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#D7CCC8,italic"
# ZSH_AUTOSUGGEST_USE_ASYNC=1 # ZSH_AUTOSUGGEST_USE_ASYNC=1
@ -134,7 +128,7 @@ export NVIM_LISTEN_ADDRESS=/tmp/nvimsocket
e () e ()
{ {
nvr --nostart --remote $(readlink -f "$@") nvr --nostart --remote $(readlink -f "$@")
echo -e "\x1b]2;$(_title) $(date +%s):nvim\x1b\\" tmux select-window -t1
} }
## fzf ## fzf
@ -152,19 +146,29 @@ command -v kubectl >/dev/null 2>&1 && source <(kubectl completion zsh)
export PATH=$HOME/.krew/bin:$PATH export PATH=$HOME/.krew/bin:$PATH
## linkerd ## linkerd
command -v linkerd >/dev/null 2>&1 && source <(linkerd completion zsh) if [ ! -f "${fpath[1]}/_linkerd" ]; then
command -v linkerd >/dev/null 2>&1 && linkerd completion zsh > "${fpath[1]}/_linkerd"
fi
## Flux ## Flux
command -v flux >/dev/null 2>&1 && source <(flux completion zsh) if [ ! -f "${fpath[1]}/_flux" ]; then
command -v flux >/dev/null 2>&1 && source <(flux completion zsh)
fi
## Tekton cli ## Tekton cli
command -v tkn >/dev/null 2>&1 && source <(tkn completion zsh) if [ ! -f "${fpath[1]}/_tkn" ]; then
command -v tkn >/dev/null 2>&1 && tkn completion zsh > "${fpath[1]}/_tkn"
fi
## kapp ## kapp
command -v kapp >/dev/null 2>&1 && source <(kapp completion zsh) if [ ! -f "${fpath[1]}/_kapp" ]; then
command -v kapp >/dev/null 2>&1 && kapp completion zsh --tty=false > "${fpath[1]}/_kapp"
fi
## talos cli ## talos cli
command -v talosctl >/dev/null 2>&1 && source <(talosctl completion zsh) if [ ! -f "${fpath[1]}/_talosctl" ]; then
command -v talosctl >/dev/null 2>&1 && talosctl completion zsh > "${fpath[1]}/_talosctl"
fi
## Google Cloud ## Google Cloud
[ -f /opt/google-cloud-sdk/completion.zsh.inc ] && source /opt/google-cloud-sdk/completion.zsh.inc [ -f /opt/google-cloud-sdk/completion.zsh.inc ] && source /opt/google-cloud-sdk/completion.zsh.inc
@ -172,14 +176,16 @@ command -v talosctl >/dev/null 2>&1 && source <(talosctl completion zsh)
# hack until gcloud works with python 3.9 # hack until gcloud works with python 3.9
export CLOUDSDK_PYTHON=python2 export CLOUDSDK_PYTHON=python2
## Golang ## Golang
export PATH=$HOME/go/bin:$PATH export PATH=$HOME/go/bin:$PATH
GOPROXY=https://proxy.golang.org/ GOPROXY=https://athens.aarn.shelman.io
## Ansible ## Ansible
export ANSIBLE_NOCOWS=1 export ANSIBLE_NOCOWS=1
## Docker
export DOCKER_BUILDKIT=1
## PostgreSQL Operator ## PostgreSQL Operator
export PATH=/home/dln/.pgo/pgo:$PATH export PATH=/home/dln/.pgo/pgo:$PATH
@ -193,8 +199,7 @@ export PGO_NAMESPACE=pgo
export PATH=$HOME/bin:$PATH export PATH=$HOME/bin:$PATH
#autoload -U +X bashcompinit && bashcompinit # ## Completion
complete -o nospace -C /usr/bin/vault vault
autoload -Uz compinit autoload -Uz compinit
compinit compinit -i