From 2b47d7a9cde63cb98ebf32b6f58297f32eeb81ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sascha=20L=C3=BCdecke?= Date: Wed, 4 Mar 2026 21:58:23 +0100 Subject: [PATCH] Diary and most lsp only available on ccflow, added hostname guard condition --- init.lua | 4 ++- lua/diary.lua | 2 +- lua/keybindings.lua | 16 ++++++---- lua/lsp.lua | 78 ++++++++++++++++++++++++--------------------- 4 files changed, 56 insertions(+), 44 deletions(-) diff --git a/init.lua b/init.lua index b6f2067..9336e3d 100644 --- a/init.lua +++ b/init.lua @@ -6,5 +6,7 @@ require('plugins') require('colorscheme') require('lsp') require('keybindings') -require('diary') require('layout') +if vim.loop.os_gethostname() == 'ccflow' then + require('diary') +end diff --git a/lua/diary.lua b/lua/diary.lua index 92e7cd7..0ee26c2 100644 --- a/lua/diary.lua +++ b/lua/diary.lua @@ -1,7 +1,7 @@ local diary_open = function(opts) local date = opts.args ~= '' and opts.args or os.date('%Y-%m-%d') local year, month = date:match('(%d%d%d%d)-(%d%d)') - local folder = string.format('~/.diary/asciidoc/%s', year) + local folder = vim.fs.joinpath(vim.env.HOME, string.format('.diary/asciidoc/%s', year)) vim.fn.mkdir(folder, "p") local file = string.format('%s/diary-%s-%s.adoc', folder, year, month) print("file is:", file) diff --git a/lua/keybindings.lua b/lua/keybindings.lua index 46eae8c..d28c294 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -25,22 +25,26 @@ vim.keymap.set('n', 'T', ":Neotree reveal", { desc = "Neotree Files" vim.keymap.set('n', 'F', ":Fyler kind=split_left", { desc = "Fyler Files" }) -- calendar -vim.keymap.set('n', 'c', ":Calendar -split=horizontal -position=below -height=12", { desc = "Show calendar below" }) +vim.keymap.set('n', 'c', ":Calendar -split=horizontal -position=below -height=12", + { desc = "Show calendar below" }) vim.keymap.set('n', 'C', ":Calendar -view=year -split=vertical -width=27", { desc = "Show calendar right" }) -- Open current file in browser (chromium) vim.keymap.set('n', 'o', ":silent !chromium '%'", { desc = "Open in browser" }) --- Open org file folder in neotree -vim.keymap.set('n', 'of', ':silent :Neotree dir=/home/saschal/Documents/Eigene\\ (Briefe\\ etc.)/org', { desc = "Open org folder" }) +if vim.loop.os_gethostname() == 'ccflow' then + -- Open org file folder in neotree + vim.keymap.set('n', 'of', ':silent :Neotree dir=/home/saschal/Documents/Eigene\\ (Briefe\\ etc.)/org', + { desc = "Open org folder" }) +end -- toggle colorscheme between dark and light vim.keymap.set('n', 'm', function() if vim.opt.background:get() == "dark" then vim.o.background = "light" - else + else vim.o.background = "dark" - end + end end, { desc = "Toggle dark/light mode" }) -- @@ -115,7 +119,7 @@ vim.keymap.set('i', '', ":m +1", { desc = "Move current line do ------------------------------------------ vim.keymap.set('n', 'q', "gwap", { desc = "Wrap paragraph" }) vim.keymap.set('n', '', ":silent! nohls", { desc = "Clear search" }) -vim.keymap.set('i', '', 'dW', {desc = "Delete word right" }) +vim.keymap.set('i', '', 'dW', { desc = "Delete word right" }) -- horizontally scroll with mouse vim.keymap.set('n', '', 'zh') diff --git a/lua/lsp.lua b/lua/lsp.lua index 2ddd3df..7344359 100644 --- a/lua/lsp.lua +++ b/lua/lsp.lua @@ -66,46 +66,52 @@ function LSPRangeFormatFunction() }) end - --- VUE and Typescript as of vue-language-server 3.0.x --- taken from: --- https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md#vtsls -local vue_language_server_path = '/home/saschal/.config/yarn/global/node_modules' -local vue_plugin = { - name = '@vue/typescript-plugin', - location = vue_language_server_path, - languages = { 'vue' }, - configNamespace = 'typescript', -} -local vtsls_config = { - settings = { - vtsls = { - tsserver = { - globalPlugins = { - vue_plugin, +local enable_this_lsp = {} +if vim.loop.os_gethostname() == 'ccflow' then + -- VUE and Typescript as of vue-language-server 3.0.x + -- taken from: + -- https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md#vtsls + local vue_language_server_path = '/home/saschal/.config/yarn/global/node_modules' + local vue_plugin = { + name = '@vue/typescript-plugin', + location = vue_language_server_path, + languages = { 'vue' }, + configNamespace = 'typescript', + } + local vtsls_config = { + settings = { + vtsls = { + tsserver = { + globalPlugins = { + vue_plugin, + }, }, }, }, - }, - filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' }, -} -vim.lsp.config('vtsls', vtsls_config) + filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' }, + } + vim.lsp.config('vtsls', vtsls_config) --- enable this list of lsps -local enable_this_lsp = { - 'vue_ls', - 'vtsls', - 'gopls', - 'bashls', - 'html', - 'lua_ls', - 'jsonls', -- arch extra: vscode-json-languageserver - 'kotlin_lsp', -- arch aur: kotlin-lsp-bin - 'lemminx', -- arch aur: lemminx - 'clangd', - 'basedpyright', - 'wgsl_analyzer', -} + -- enable this list of lsps + enable_this_lsp = { + 'vue_ls', + 'vtsls', + 'gopls', + 'bashls', + 'html', + 'lua_ls', + 'jsonls', -- arch extra: vscode-json-languageserver + 'kotlin_lsp', -- arch aur: kotlin-lsp-bin + 'lemminx', -- arch aur: lemminx + 'clangd', + 'basedpyright', + 'wgsl_analyzer', + } +else + -- any lsp which should be enabled in all situations + enable_this_lsp = { + } +end for l in pairs(enable_this_lsp) do vim.lsp.enable(enable_this_lsp[l])