From 120fad689431b1c7da8e78a012c9a413e48f44a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Dudr?= Date: Mon, 8 Aug 2022 16:41:11 +0200 Subject: [PATCH] sync --- bin/executable_make_certs | 2 + dot_config/containers/storage.conf.tmpl | 4 +- dot_config/nginx/nginx.conf.tmpl | 32 +++++++- dot_config/nvim/init.lua | 104 +++++++++++++++++++----- dot_config/private_mc/mc.ext | 11 +-- 5 files changed, 122 insertions(+), 31 deletions(-) diff --git a/bin/executable_make_certs b/bin/executable_make_certs index 019f57d..3c0808f 100644 --- a/bin/executable_make_certs +++ b/bin/executable_make_certs @@ -4,6 +4,7 @@ set -e doms=( 'localhost' + 'local3000.localhost' 'djinn1.localhost' '*.gdpr.localhost' '*.up123.localhost' @@ -28,6 +29,7 @@ doms=( '*.katalogy.localhost' '*.vizit-core.localhost' '*.vizit.localhost' + '*.vizit-virtualni-recepce.localhost' '*.vizitpresentation.localhost' '*.booking-core.localhost' '*.nicerice.localhost' diff --git a/dot_config/containers/storage.conf.tmpl b/dot_config/containers/storage.conf.tmpl index eb6d5b6..7aa54cd 100644 --- a/dot_config/containers/storage.conf.tmpl +++ b/dot_config/containers/storage.conf.tmpl @@ -1,7 +1,7 @@ [storage] driver = "overlay" - runroot = "/run/user/1000" - graphroot = "{{.chezmoi.homeDir}}/.local/share/containers/storage" + runroot = "/run/user/{{ .chezmoi.uid }}/containers/" + graphroot = "{{ .chezmoi.homeDir }}/.local/share/containers/storage" # [storage.options] # mount_program = "/usr/bin/fuse-overlayfs" diff --git a/dot_config/nginx/nginx.conf.tmpl b/dot_config/nginx/nginx.conf.tmpl index 03358a0..6053b3d 100644 --- a/dot_config/nginx/nginx.conf.tmpl +++ b/dot_config/nginx/nginx.conf.tmpl @@ -53,11 +53,12 @@ http { # proxy_intercept_errors on; # fastcgi_intercept_errors on; - add_header "Access-Control-Allow-Origin" "*"; + add_header "Access-Control-Allow-Origin" $http_origin; + add_header "Access-Control-Allow-Credentials" true; access_log off; - client_body_temp_path /run/user/{{ .chezmoi.uid }}/nginx/body; - fastcgi_temp_path /run/user/{{ .chezmoi.uid }}/nginx/fastcgi; + client_body_temp_path /run/user/{{ .chezmoi.gid }}/nginx/body; + fastcgi_temp_path /run/user/{{ .chezmoi.gid }}/nginx/fastcgi; server { @@ -344,6 +345,31 @@ http { } } + server { + #server_name _; + server_name local3000.localhost; + + listen 80; + listen [::]:80; + listen 443 ssl http2; + listen [::]:443 ssl http2; + + ssl_certificate {{ .chezmoi.homeDir }}/.config/nginx/ssl/localhost.crt; + ssl_certificate_key {{ .chezmoi.homeDir }}/.config/nginx/ssl/localhost.key; + + + location / { + proxy_pass http://127.0.0.1:3000; + } + + location /api { + proxy_hide_header "Access-Control-Allow-Origin"; + proxy_hide_header "Access-Control-Allow-Credentials"; + proxy_pass https://recepce.vizit-virtualni-recepce.localhost; + } + + } + server { #server_name _; server_name gin.localhost; diff --git a/dot_config/nvim/init.lua b/dot_config/nvim/init.lua index 830dfc5..514c64f 100644 --- a/dot_config/nvim/init.lua +++ b/dot_config/nvim/init.lua @@ -2,7 +2,8 @@ local fn = vim.fn local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim' if fn.empty(fn.glob(install_path)) > 0 then - local packer_bootstrap = fn.system({ 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path }) + local packer_bootstrap = fn.system({ 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', + install_path }) end @@ -11,7 +12,6 @@ require('packer').startup(function(use) use 'wbthomason/packer.nvim' use 'neovim/nvim-lspconfig' - -- use 'glepnir/lspsaga.nvim' use { 'hrsh7th/nvim-cmp', requires = { 'neovim/nvim-lspconfig' } } use { 'hrsh7th/cmp-nvim-lsp', requires = { 'hrsh7th/nvim-cmp' } } use { 'hrsh7th/cmp-buffer', requires = { 'hrsh7th/nvim-cmp' } } @@ -22,7 +22,10 @@ require('packer').startup(function(use) use { 'hrsh7th/cmp-vsnip', requires = { 'hrsh7th/nvim-cmp', 'hrsh7th/vim-vsnip' } } use { 'onsails/lspkind.nvim' } - use { 'simrat39/symbols-outline.nvim', cmd = 'SymbolsOutline' } + use 'ray-x/lsp_signature.nvim' + use { 'RishabhRD/nvim-lsputils', requires = { 'RishabhRD/popfix' } } + use { 'weilbith/nvim-code-action-menu', cmd='CodeActionMenu' } + -- use { 'simrat39/symbols-outline.nvim', cmd = 'SymbolsOutline' } use { 'jose-elias-alvarez/null-ls.nvim', requires = { "nvim-lua/plenary.nvim" } } @@ -136,14 +139,22 @@ vim.cmd([[ --- OPTIONS }}} --- LSP {{{ --- local saga = require('lspsaga').init_lsp_saga() - +--[[ vim.api.nvim_create_autocmd('LspAttach', { + callback = function(args) + local client = vim.lsp.get_client_by_id(args.data.client_id) + if client.server_capabilities.hoverProvider then + vim.keymap.set('n', 'K', vim.lsp.buf.hover, { buffer = args.buf }) + end + end, +}) + ]] local nvim_lsp = require('lspconfig') -local on_attach = function(_, bufnr) +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 + require "lsp_signature".on_attach() -- require'completion'.on_attach() -- Mappings. @@ -159,27 +170,38 @@ local on_attach = function(_, bufnr) buf_set_keymap('n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) buf_set_keymap('n', 'D', 'lua vim.lsp.buf.type_definition()', opts) buf_set_keymap('n', 'rn', 'lua vim.lsp.buf.rename()', opts) - buf_set_keymap('n', 'ca', 'lua vim.lsp.buf.code_action()', opts) + buf_set_keymap('n', 'ca', 'CodeActionMenu', opts) buf_set_keymap('v', 'ca', 'lua vim.lsp.buf.range_code_action()', opts) buf_set_keymap('n', 'gr', 'lua vim.lsp.buf.references()', opts) buf_set_keymap('n', '[d', 'lua vim.diagnostic.goto_prev()', opts) buf_set_keymap('n', ']d', 'lua vim.diagnostic.goto_next()', opts) buf_set_keymap('n', 'q', 'lua vim.diagnostic.setloclist()', opts) - buf_set_keymap('n', "F", "lua vim.lsp.buf.formatting()", opts) - buf_set_keymap('v', "gf", "lua vim.lsp.buf.range_formatting()", opts) + buf_set_keymap('n', 'F', 'lua vim.lsp.buf.formatting()', opts) + buf_set_keymap('v', 'F', 'lua vim.lsp.buf.range_formatting()', opts) end -- Use a loop to conveniently both setup defined servers -- and map buffer local keybindings when the language server attaches -local servers = { 'phpactor', 'gopls', 'clangd', 'zls', 'hls', 'tsserver', 'sumneko_lua' } +local servers = { 'phpactor', 'gopls', 'clangd', 'zls', 'hls', 'tsserver', 'sumneko_lua', 'perlls' } for _, lsp in ipairs(servers) do nvim_lsp[lsp].setup { on_attach = on_attach, capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()), - root_dir = require('lspconfig.util').root_pattern('composer.json') } end +require 'lspconfig'.phpactor.setup { + on_attach = on_attach, + capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()), + + root_dir = function(path) + local u = require('lspconfig.util') + return u.search_ancestors(path, function(p) + return not string.find(p, 'vendor') and u.path.exists(u.path.join(p, 'composer.json')) + end) + end +} + require 'lspconfig'.omnisharp.setup { cmd = { '/usr/bin/omnisharp', '--languageserver', '--hostPID', tostring(pid) }, on_attach = on_attach, @@ -187,7 +209,7 @@ require 'lspconfig'.omnisharp.setup { } require 'lspconfig'.powershell_es.setup { - bundle_path = '/home/sogun/devel/PowerShellEditorServices', + bundle_path = '/home/vladimir/devel/PowerShellEditorServices/module', capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) } @@ -205,7 +227,7 @@ cmp.setup({ { name = 'nvim_lua' }, { name = 'buffer' }, { name = 'path' }, - { name = 'nvim_lsp_signature_help' }, + -- { name = 'nvim_lsp_signature_help' }, }, formatting = { format = require 'lspkind'.cmp_format({ @@ -366,6 +388,19 @@ require 'nvim-treesitter.configs'.setup { }, } +local ts_parsers = require 'nvim-treesitter.parsers'.get_parser_configs() +ts_parsers.xml = { + install_info = { + url = "https://github.com/dorgnarg/tree-sitter-xml", -- local path or git repo + files = {"src/parser.c"}, + -- optional entries: + branch = "main", -- default branch in case of git repo if different from master + generate_requires_npm = false, -- if stand-alone parser without npm dependencies + requires_generate_from_grammar = true, -- if folder contains pre-generated src/parser.c + }, + filetype = "xml", -- if filetype does not match the parser name +} + vim.api.nvim_set_keymap('x', 'iu', ':lua require"treesitter-unit".select()', { noremap = true }) vim.api.nvim_set_keymap('x', 'au', ':lua require"treesitter-unit".select(true)', { noremap = true }) vim.api.nvim_set_keymap('o', 'iu', ':lua require"treesitter-unit".select()', { noremap = true }) @@ -426,22 +461,50 @@ vim.g.rooter_manual_only = 1 -- }}} -- null-ls {{{ -nls = require "null-ls" +local nls = require "null-ls" nls.setup({ on_attach = on_attach, debug = true, sources = { nls.builtins.formatting.xmllint, + nls.builtins.formatting.jq, nls.builtins.diagnostics.sqlfluff, nls.builtins.diagnostics.phpstan.with({ cwd = function(params) -- falls back to root if return value is nil - return params.root:match("jopixel") and "www"; + return params.root:match("jopixel") and not params.root:match("repo") and "www"; end }), nls.builtins.formatting.phpcsfixer.with({ - extra_args = { "--rules", '{ "@Symfony":true, "nullable_type_declaration_for_default_null_value":true, "array_syntax":{"syntax":"short"}, "binary_operator_spaces":{"default":"align_single_space_minimal"}, "fully_qualified_strict_types":false }' } + extra_args = { "--rules", [[ { + "@Symfony":true, + "nullable_type_declaration_for_default_null_value":true, + "array_syntax":{"syntax":"short"}, + "binary_operator_spaces":{ + "default":"single_space", + "operators": { + "=>":"align_single_space_minimal", + "=":"align_single_space_minimal", + "??=":"align_single_space_minimal", + "^=":"align_single_space_minimal", + "|=":"align_single_space_minimal", + "+=":"align_single_space_minimal", + "%=":"align_single_space_minimal", + "&=":"align_single_space_minimal", + "**=":"align_single_space_minimal", + "*=":"align_single_space_minimal", + "-=":"align_single_space_minimal", + ".=":"align_single_space_minimal", + "/=":"align_single_space_minimal", + "<<=":"align_single_space_minimal", + "<=":"align_single_space_minimal", + ">=":"align_single_space_minimal", + ">>=":"align_single_space_minimal" + } + }, + "fully_qualified_strict_types":false + } ]] } }), nls.builtins.diagnostics.shellcheck, nls.builtins.formatting.eslint, @@ -479,16 +542,15 @@ vim.cmd 'highlight link TSVariableBuiltin Identifier' -- {{{ LAYA vim.cmd [[ augroup layaAbbrevs - autocmd BufRead,BufNewFile ~/jopixel/**/*.php iabbrev T $this->obtainer()->translator()->t(); + autocmd BufRead,BufNewFile ~/jopixel/**/*.php iabbrev TR $this->obtainer()->translator()->t(); autocmd BufRead,BufNewFile ~/jopixel/**/*.php iabbrev TI $this->obtainer()->translator()->t() autocmd BufRead,BufNewFile ~/jopixel/**/*.php iabbrev LOG $this->obtainer()->logger()->log(); - autocmd BufRead,BufNewFile ~/jopixel/**/*.php iabbrev DEBUG $this->obtainer()->logger()->log('debug', 'debug',); + autocmd BufRead,BufNewFile ~/jopixel/**/*.php iabbrev DBG $this->obtainer()->logger()->log('debug', 'debug',); autocmd BufRead,BufNewFile ~/jopixel/**/*.php iabbrev PROD $this->producer() - autocmd BufRead,BufNewFile ~/jopixel/**/*.php iabbrev VIEW \laya\view\view - autocmd BufRead,BufNewFile ~/jopixel/**/*.php iabbrev FORM \layalib\view\form\form autocmd BufRead,BufNewFile ~/jopixel/**/*.php iabbrev FILE $this->producer()->file() autocmd BufRead,BufNewFile ~/jopixel/**/*.php iabbrev LINK $this->producer()->link($this, '') - autocmd BufRead,BufNewFile ~/jopixel/**/*.php iabbrev NOTIF $this->obtainer()->notifications() + autocmd BufRead,BufNewFile ~/jopixel/**/*.php iabbrev NW $this->obtainer()->notifications()->warning(); + autocmd BufRead,BufNewFile ~/jopixel/**/*.php iabbrev NS $this->obtainer()->notifications()->success(); augroup END ]] -- }}} LAYA diff --git a/dot_config/private_mc/mc.ext b/dot_config/private_mc/mc.ext index e488cb0..5b5831e 100644 --- a/dot_config/private_mc/mc.ext +++ b/dot_config/private_mc/mc.ext @@ -159,6 +159,11 @@ regex/\.t(ar\.zst|zst)$ shell/.tar.F # Open=%cd %p/utar:// View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar.F +# +# zip +shell/i/.zip + Open=%cd %p/uzip:// + View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view zip # .qpr/.qpk - QNX Neutrino package installer files regex/\.qp[rk]$ @@ -586,7 +591,7 @@ type/^PostScript # PDF type/^PDF - Open=/usr/bin/mupdf %f &>/dev/null & + Open=/usr/bin/mupdf %f View=/usr/bin/mupdf %f # html @@ -741,10 +746,6 @@ shell/i/.arc Extract=arc x %f '*' Extract (with flags)=I=%{Enter any Arc flags:}; if test -n "$I"; then arc x $I %f; fi -# zip -shell/i/.zip - Open=%cd %p/uzip:// - View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view zip # zip type/i/^zip\ archive