Diary and most lsp only available on ccflow, added hostname guard condition

This commit is contained in:
2026-03-04 21:58:23 +01:00
parent 107a257642
commit 2b47d7a9cd
4 changed files with 56 additions and 44 deletions

View File

@@ -6,5 +6,7 @@ require('plugins')
require('colorscheme') require('colorscheme')
require('lsp') require('lsp')
require('keybindings') require('keybindings')
require('diary')
require('layout') require('layout')
if vim.loop.os_gethostname() == 'ccflow' then
require('diary')
end

View File

@@ -1,7 +1,7 @@
local diary_open = function(opts) local diary_open = function(opts)
local date = opts.args ~= '' and opts.args or os.date('%Y-%m-%d') 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 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") vim.fn.mkdir(folder, "p")
local file = string.format('%s/diary-%s-%s.adoc', folder, year, month) local file = string.format('%s/diary-%s-%s.adoc', folder, year, month)
print("file is:", file) print("file is:", file)

View File

@@ -25,14 +25,18 @@ vim.keymap.set('n', '<leader>T', ":Neotree reveal<CR>", { desc = "Neotree Files"
vim.keymap.set('n', '<leader>F', ":Fyler kind=split_left<CR>", { desc = "Fyler Files" }) vim.keymap.set('n', '<leader>F', ":Fyler kind=split_left<CR>", { desc = "Fyler Files" })
-- calendar -- calendar
vim.keymap.set('n', '<leader>c', ":Calendar -split=horizontal -position=below -height=12<CR>", { desc = "Show calendar below" }) vim.keymap.set('n', '<leader>c', ":Calendar -split=horizontal -position=below -height=12<CR>",
{ desc = "Show calendar below" })
vim.keymap.set('n', '<leader>C', ":Calendar -view=year -split=vertical -width=27<CR>", { desc = "Show calendar right" }) vim.keymap.set('n', '<leader>C', ":Calendar -view=year -split=vertical -width=27<CR>", { desc = "Show calendar right" })
-- Open current file in browser (chromium) -- Open current file in browser (chromium)
vim.keymap.set('n', '<space>o', ":silent !chromium '%'<cr>", { desc = "Open in browser" }) vim.keymap.set('n', '<space>o', ":silent !chromium '%'<cr>", { desc = "Open in browser" })
if vim.loop.os_gethostname() == 'ccflow' then
-- Open org file folder in neotree -- Open org file folder in neotree
vim.keymap.set('n', '<leader>of', ':silent :Neotree dir=/home/saschal/Documents/Eigene\\ (Briefe\\ etc.)/org<cr>', { desc = "Open org folder" }) vim.keymap.set('n', '<leader>of', ':silent :Neotree dir=/home/saschal/Documents/Eigene\\ (Briefe\\ etc.)/org<cr>',
{ desc = "Open org folder" })
end
-- toggle colorscheme between dark and light -- toggle colorscheme between dark and light
vim.keymap.set('n', '<leader>m', function() vim.keymap.set('n', '<leader>m', function()

View File

@@ -66,7 +66,8 @@ function LSPRangeFormatFunction()
}) })
end end
local enable_this_lsp = {}
if vim.loop.os_gethostname() == 'ccflow' then
-- VUE and Typescript as of vue-language-server 3.0.x -- VUE and Typescript as of vue-language-server 3.0.x
-- taken from: -- taken from:
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md#vtsls -- https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md#vtsls
@@ -92,7 +93,7 @@ local vtsls_config = {
vim.lsp.config('vtsls', vtsls_config) vim.lsp.config('vtsls', vtsls_config)
-- enable this list of lsps -- enable this list of lsps
local enable_this_lsp = { enable_this_lsp = {
'vue_ls', 'vue_ls',
'vtsls', 'vtsls',
'gopls', 'gopls',
@@ -106,6 +107,11 @@ local enable_this_lsp = {
'basedpyright', 'basedpyright',
'wgsl_analyzer', 'wgsl_analyzer',
} }
else
-- any lsp which should be enabled in all situations
enable_this_lsp = {
}
end
for l in pairs(enable_this_lsp) do for l in pairs(enable_this_lsp) do
vim.lsp.enable(enable_this_lsp[l]) vim.lsp.enable(enable_this_lsp[l])