From 4894ea6588d1725d4d6d5b4a7672a2ad0ed9d0f1 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Thu, 13 Jun 2024 13:22:15 -0500 Subject: [PATCH] add existence checks for neovim --- .../nvim/lua/config/autocmds.lua | 5 ++- .../nvim/lua/config/options.lua | 1 - .../nvim/lua/plugins/language/go.lua | 5 ++- .../nvim/lua/plugins/language/markdown.lua | 33 +++++++++---------- .../nvim/lua/plugins/language/nim.lua | 12 ++++--- .../nvim/lua/plugins/language/nix.lua | 6 +++- .../nvim/lua/plugins/language/nu.lua | 14 +++++--- .../nvim/lua/plugins/language/roc.lua | 7 ++-- .../nvim/lua/plugins/language/rust.lua | 4 +++ .../nvim/lua/plugins/language/zig.lua | 4 +++ 10 files changed, 57 insertions(+), 34 deletions(-) diff --git a/home/private_dot_config/nvim/lua/config/autocmds.lua b/home/private_dot_config/nvim/lua/config/autocmds.lua index b395920..53ca172 100644 --- a/home/private_dot_config/nvim/lua/config/autocmds.lua +++ b/home/private_dot_config/nvim/lua/config/autocmds.lua @@ -6,8 +6,7 @@ vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { command = "set syntax=lua", }) - vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { - pattern = { "*.md"}, - command = "set conceallevel=0" + pattern = { "*.md" }, + command = "set conceallevel=0", }) diff --git a/home/private_dot_config/nvim/lua/config/options.lua b/home/private_dot_config/nvim/lua/config/options.lua index 1e380ad..eb34b14 100644 --- a/home/private_dot_config/nvim/lua/config/options.lua +++ b/home/private_dot_config/nvim/lua/config/options.lua @@ -10,7 +10,6 @@ vim.opt.timeoutlen = 200 vim.g.autoformat = false - -- make .roc files have the correct filetype vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { pattern = { "*.roc" }, diff --git a/home/private_dot_config/nvim/lua/plugins/language/go.lua b/home/private_dot_config/nvim/lua/plugins/language/go.lua index f168fa5..7efa472 100644 --- a/home/private_dot_config/nvim/lua/plugins/language/go.lua +++ b/home/private_dot_config/nvim/lua/plugins/language/go.lua @@ -1,5 +1,8 @@ --- adapted from https://www.lazyvim.org/extras/lang/go +if not vim.fn.executable("go") then + return +end +-- adapted from https://www.lazyvim.org/extras/lang/go return { { "nvim-treesitter/nvim-treesitter", diff --git a/home/private_dot_config/nvim/lua/plugins/language/markdown.lua b/home/private_dot_config/nvim/lua/plugins/language/markdown.lua index 4118f93..a2601b2 100644 --- a/home/private_dot_config/nvim/lua/plugins/language/markdown.lua +++ b/home/private_dot_config/nvim/lua/plugins/language/markdown.lua @@ -1,22 +1,21 @@ return { - require("util").setup_lang({treesitter = {"markdown", "markdown_inline"}}), + require("util").setup_lang({ treesitter = { "markdown", "markdown_inline" } }), { - "iamcco/markdown-preview.nvim", - cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, - build = function() - vim.fn["mkdp#util#install"]() - end, - keys = { - { - "cp", - ft = "markdown", - "MarkdownPreviewToggle", - desc = "Markdown Preview", + "iamcco/markdown-preview.nvim", + cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, + build = function() + vim.fn["mkdp#util#install"]() + end, + keys = { + { + "cp", + ft = "markdown", + "MarkdownPreviewToggle", + desc = "Markdown Preview", + }, }, + config = function() + vim.cmd([[do FileType]]) + end, }, - config = function() - vim.cmd([[do FileType]]) - end, -} - } diff --git a/home/private_dot_config/nvim/lua/plugins/language/nim.lua b/home/private_dot_config/nvim/lua/plugins/language/nim.lua index 16f597c..3edaa8a 100644 --- a/home/private_dot_config/nvim/lua/plugins/language/nim.lua +++ b/home/private_dot_config/nvim/lua/plugins/language/nim.lua @@ -1,3 +1,7 @@ +if not vim.fn.executable("nim") then + return +end + return { require("util").setup_lang({ treesitter = { "nim", "nim_format_string" } }), { @@ -6,8 +10,8 @@ return { servers = { nim_langserver = { mason = false, - } - } - } - } + }, + }, + }, + }, } diff --git a/home/private_dot_config/nvim/lua/plugins/language/nix.lua b/home/private_dot_config/nvim/lua/plugins/language/nix.lua index 2611c59..8183a48 100644 --- a/home/private_dot_config/nvim/lua/plugins/language/nix.lua +++ b/home/private_dot_config/nvim/lua/plugins/language/nix.lua @@ -1,3 +1,7 @@ +if not vim.fn.executable("nix") then + return +end + return { require("util").setup_lang({ treesitter = { "nix" } }), { @@ -8,7 +12,7 @@ return { mason = false, }, -- nil_ls = { - -- mason = false, + -- mason = false, -- }, }, }, diff --git a/home/private_dot_config/nvim/lua/plugins/language/nu.lua b/home/private_dot_config/nvim/lua/plugins/language/nu.lua index 4eeaffa..43c15b5 100644 --- a/home/private_dot_config/nvim/lua/plugins/language/nu.lua +++ b/home/private_dot_config/nvim/lua/plugins/language/nu.lua @@ -1,7 +1,11 @@ +if not vim.fn.executable("nu") then + return +end + return { - "nvim-treesitter/nvim-treesitter", - dependencies = { - { "nushell/tree-sitter-nu" }, - }, - build = ":TSUpdate", + "nvim-treesitter/nvim-treesitter", + dependencies = { + { "nushell/tree-sitter-nu" }, + }, + build = ":TSUpdate", } diff --git a/home/private_dot_config/nvim/lua/plugins/language/roc.lua b/home/private_dot_config/nvim/lua/plugins/language/roc.lua index 41e4bb6..e179341 100644 --- a/home/private_dot_config/nvim/lua/plugins/language/roc.lua +++ b/home/private_dot_config/nvim/lua/plugins/language/roc.lua @@ -1,3 +1,7 @@ +if not vim.fn.executable("roc") then + return +end + -- make .roc files have the correct filetype vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { pattern = { "*.roc" }, @@ -15,8 +19,7 @@ vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { -- } return { - { "nvim-treesitter/nvim-treesitter", opts = { ensure_installed = { "roc" } } - }, + { "nvim-treesitter/nvim-treesitter", opts = { ensure_installed = { "roc" } } }, { "neovim/nvim-lspconfig", opts = { diff --git a/home/private_dot_config/nvim/lua/plugins/language/rust.lua b/home/private_dot_config/nvim/lua/plugins/language/rust.lua index 6c22d9d..8175881 100644 --- a/home/private_dot_config/nvim/lua/plugins/language/rust.lua +++ b/home/private_dot_config/nvim/lua/plugins/language/rust.lua @@ -1,3 +1,7 @@ +if not vim.fn.executable("rust") then + return +end + -- adapted from https://www.lazyvim.org/extras/lang/rust return { { diff --git a/home/private_dot_config/nvim/lua/plugins/language/zig.lua b/home/private_dot_config/nvim/lua/plugins/language/zig.lua index c10d9d7..78884a7 100644 --- a/home/private_dot_config/nvim/lua/plugins/language/zig.lua +++ b/home/private_dot_config/nvim/lua/plugins/language/zig.lua @@ -1,3 +1,7 @@ +if not vim.fn.executable("zig") then + return +end + -- adapted from https://www.lazyvim.org/extras/lang/rust return { {