diff --git a/dot_config/nvim/lua/empty_misc.lua b/dot_config/nvim/lua/empty_misc.lua new file mode 100644 index 0000000..72d61cd --- /dev/null +++ b/dot_config/nvim/lua/empty_misc.lua @@ -0,0 +1,25 @@ +-- Any copyright is dedicated to the Public Domain. +-- +-- https://creativecommons.org/publicdomain/zero/1.0/ + +function file_exists(file) + -- some error codes: + -- 13 : EACCES - Permission denied + -- 17 : EEXIST - File exists + -- 20 : ENOTDIR - Not a directory + -- 21 : EISDIR - Is a directory + -- + local isok, errstr, errcode = os.rename(file, file) + if isok == nil then + if errcode == 13 then + -- Permission denied, but it exists + return true + end + return false + end + return true +end + +function dir_exists(path) + return file_exists(path .. "/") +end diff --git a/dot_config/nvim/lua/plugins.lua b/dot_config/nvim/lua/plugins.lua index ab8f8e0..08b3b70 100644 --- a/dot_config/nvim/lua/plugins.lua +++ b/dot_config/nvim/lua/plugins.lua @@ -24,9 +24,16 @@ require("lazy").setup({ "jaawerth/fennel.vim", "Olical/conjure", "Olical/aniseed", + "neovim/nvim-lspconfig", + "williamboman/mason.nvim", + "williamboman/mason-lspconfig.nvim", + "mfussenegger/nvim-dap", + "nvim-neotest/nvim-nio", + { "rcarriga/nvim-dap-ui", requires = {"mfussenegger/nvim-dap", "nvim-neotest/nvim-nio"} }, { "yorickpeterse/vim-paper", lazy = true }, { "junegunn/fzf", name = "fzf", dir = "~/.fzf", build = "./install --all" }, { "fatih/vim-go" }, + { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" }, }) ------------------------------------------------------ diff --git a/dot_config/nvim/lua/settings.lua b/dot_config/nvim/lua/settings.lua index 02f94d6..8fe1257 100644 --- a/dot_config/nvim/lua/settings.lua +++ b/dot_config/nvim/lua/settings.lua @@ -1,6 +1,9 @@ -- Any copyright is dedicated to the Public Domain. -- https://creativecommons.org/publicdomain/zero/1.0/ +require('misc') + +-- Status line is always shown vim.opt.laststatus = 2 -- Show full tags when doing search completion @@ -45,27 +48,28 @@ vim.opt.numberwidth = 3 -- Allow hidden buffers vim.opt.hidden = true - -vim.opt.termguicolors = true - + -- Create backups -vim.opt.backup = true -vim.cmd([[ - try - set backupdir=$HOME/.local/share/nvim/backups/ - set directory=$HOME/.local/share/nvim/backups/ - catch - endtry -]]) +local backupdir = "/home/steveno/.local/share/nvim/backups" +if dir_exists(backupdir) then + vim.opt.backup = true + vim.opt.backupdir = backupdir + vim.opt.directory = backupdir +else + vim.print("ERROR: Failed to set backupdir to " .. backupdir) + return +end -- color scheme +vim.opt.termguicolors = true vim.cmd([[ let &t_8f = "\[38:2;%lu;%lu;%lum" let &t_8b = "\[48:2;%lu;%lu;%lum" set t_Co=256 - colorscheme paper ]]) +vim.cmd.colorscheme('paper') + -- Python vim.g.python3_host_prog = "/usr/bin/python3"