terminal-life: add asciinema

This commit is contained in:
teutat3s 2022-01-31 17:34:32 +01:00
parent 2690f79f10
commit 19bf284361
Signed by: teutat3s
GPG key ID: 4FA1D3FA524F22C1
2 changed files with 100 additions and 0 deletions

View file

@ -26,6 +26,7 @@ in
home.packages = [
ack
ag
asciinema
bat
exa
fd

View file

@ -0,0 +1,99 @@
diff --git a/modules/terminal-life/nvim/default.nix b/modules/terminal-life/nvim/default.nix
index e46c82e..02102c4 100644
--- a/modules/terminal-life/nvim/default.nix
+++ b/modules/terminal-life/nvim/default.nix
@@ -74,9 +74,7 @@ in
nodePackages.typescript-language-server
nodePackages.vim-language-server
nodePackages.vue-language-server
- nodePackages.vscode-css-languageserver-bin
- nodePackages.vscode-html-languageserver-bin
- nodePackages.vscode-json-languageserver-bin
+ nodePackages.vscode-langservers-extracted
nodePackages.yaml-language-server
python39Packages.python-lsp-server
python3Full
@@ -131,6 +129,7 @@ in
vim-go
vim-javascript
vim-json
+ SchemaStore-nvim
vim-markdown
vim-nix
vim-ruby
diff --git a/modules/terminal-life/nvim/lsp.vim b/modules/terminal-life/nvim/lsp.vim
index 1d5bf4d..83e5d8c 100644
--- a/modules/terminal-life/nvim/lsp.vim
+++ b/modules/terminal-life/nvim/lsp.vim
@@ -40,10 +40,10 @@ lua <<EOF
buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<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)
+ buf_set_keymap('n', '<space>e', '<cmd>lua vim.diagnostic.open_float()<CR>', opts)
+ buf_set_keymap('n', 'g[', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts)
+ buf_set_keymap('n', 'g]', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts)
+ buf_set_keymap('n', '<space>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', opts)
buf_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
end
@@ -51,6 +51,8 @@ lua <<EOF
-- Add additional capabilities supported by nvim-cmp
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
+ -- vscode HTML lsp needs this https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#html
+ capabilities.textDocument.completion.completionItem.snippetSupport = true
for lsp_key, lsp_settings in pairs({
'bashls', ------------------------------- Bash
@@ -76,10 +78,14 @@ lua <<EOF
}
},
['jsonls'] = { -------------------------- JSON
- ['cmd'] = {"json-languageserver", "--stdio"}
+ ['settings'] = {
+ ['json'] = {
+ ['schemas' ] = require('schemastore').json.schemas()
+ }
+ }
},
'phpactor', ----------------------------- PHP
- 'pylsp', --------------------------------- Python
+ 'pylsp', -------------------------------- Python
'rnix', --------------------------------- Nix
'solargraph', --------------------------- Ruby
'rust_analyzer', ------------------------ Rust
@@ -90,7 +96,6 @@ lua <<EOF
['filetypes'] = { "terraform", "hcl", "tf" }
},
'tsserver', ----------------------------- Typescript / JavaScript
- 'angularls', ---------------------------- Angular
'vuels', -------------------------------- Vue
'svelte', ------------------------------- Svelte
['yamlls'] = { -------------------------- YAML
@@ -126,6 +131,13 @@ lua <<EOF
end
end -- ‡
+ -- configure floating diagnostics appearance, symbols
+ local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
+ for type, icon in pairs(signs) do
+ local hl = "DiagnosticSign" .. type
+ vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
+ end
+
-- Set completeopt to have a better completion experience
vim.o.completeopt = 'menuone,noselect'
@@ -184,7 +196,7 @@ let g:diagnostic_trimmed_virtual_text = '40'
let g:diagnostic_insert_delay = 1
" Show diagnostic popup on cursor hold
-autocmd CursorHold * lua vim.lsp.diagnostic.show_line_diagnostics({ focusable = false })
+autocmd CursorHold,CursorHoldI * lua vim.diagnostic.open_float(nil, { focus = false, scope = "cursor" })
" Goto previous/next diagnostic warning/error
" nnoremap <silent> g[ <cmd>PrevDiagnosticCycle<cr>