diff --git a/kitty/kitty.conf b/kitty/kitty.conf index d206e50..66d7707 100644 --- a/kitty/kitty.conf +++ b/kitty/kitty.conf @@ -6,7 +6,7 @@ #: individual font faces and even specify special fonts for particular #: characters. -font_family SF Mono Powerline +font_family SF Mono # bold_font auto # italic_font auto # bold_italic_font auto @@ -49,6 +49,7 @@ font_size 11.3 # symbol_map +symbol_map U+23FB-U+23FE,U+2665,U+26A1,U+2B58,U+E000-U+E00A,U+E0A0-U+E0A3,U+E0B0-U+E0D4,U+E200-U+E2A9,U+E300-U+E3E3,U+E5FA-U+E6AA,U+E700-U+E7C5,U+EA60-U+EBEB,U+F000-U+F2E0,U+F300-U+F32F,U+F400-U+F4A9,U+F500-U+F8FF,U+F0001-U+F1AF0 Symbols Nerd Font Mono #: E.g. symbol_map U+E0A0-U+E0A3,U+E0C0-U+E0C7 PowerlineSymbols #: Map the specified Unicode codepoints to a particular font. Useful diff --git a/nvim/after/ftplugin/html.lua b/nvim/after/ftplugin/html.lua new file mode 100644 index 0000000..5afd310 --- /dev/null +++ b/nvim/after/ftplugin/html.lua @@ -0,0 +1,5 @@ +vim.g.html_indent_inctags = "html,body,head,tbody,div" +vim.g.html_indent_script1 = "inc" +vim.b.softtabstop = 2 +vim.b.shiftwidth = 2 +vim.b.tabstop = 2 diff --git a/nvim/ftplugin/javascript.lua b/nvim/after/ftplugin/javascript.lua similarity index 100% rename from nvim/ftplugin/javascript.lua rename to nvim/after/ftplugin/javascript.lua diff --git a/nvim/ftplugin/lua.lua b/nvim/after/ftplugin/lua.lua similarity index 100% rename from nvim/ftplugin/lua.lua rename to nvim/after/ftplugin/lua.lua diff --git a/nvim/after/ftplugin/python.lua b/nvim/after/ftplugin/python.lua new file mode 100644 index 0000000..ac800e0 --- /dev/null +++ b/nvim/after/ftplugin/python.lua @@ -0,0 +1,20 @@ +vim.api.nvim_create_autocmd("InsertCharPre", { + pattern = { "*.py" }, + group = vim.api.nvim_create_augroup("py-fstring", { clear = true }), + callback = function(params) + if vim.v.char ~= "{" then return end + + local node = vim.treesitter.get_node({}) + + if not node then return end + + if node:type() ~= "string" then node = node:parent() end + + if not node or node:type() ~= "string" then return end + local row, col, _, _ = vim.treesitter.get_node_range(node) + local first_char = vim.api.nvim_buf_get_text(params.buf, row, col, row, col + 1, {})[1] + if first_char == "f" then return end + + vim.api.nvim_input("m'" .. row + 1 .. "gg" .. col + 1 .. "|if`'la") + end, +}) diff --git a/nvim/ftplugin/rst.lua b/nvim/after/ftplugin/rst.lua similarity index 100% rename from nvim/ftplugin/rst.lua rename to nvim/after/ftplugin/rst.lua diff --git a/nvim/after/ftplugin/rust.lua b/nvim/after/ftplugin/rust.lua new file mode 100644 index 0000000..43531be --- /dev/null +++ b/nvim/after/ftplugin/rust.lua @@ -0,0 +1,2 @@ +-- vim.g.rustfmt_autosave = 0 +-- vim.g.syntastic_rust_checkers = {} diff --git a/nvim/after/ftplugin/tmux.lua b/nvim/after/ftplugin/tmux.lua new file mode 100644 index 0000000..1ed0ded --- /dev/null +++ b/nvim/after/ftplugin/tmux.lua @@ -0,0 +1,5 @@ +-- vim.keymap.set("n", "s", "(tmux_source_file)", { silent = true, noremap = true }) +-- vim.keymap.set("n", "K", "(tmux_show_man_floatwin)", { silent = true, noremap = true }) +-- vim.keymap.set("n", "g!!", "(tmux_execute_cursorline)", { silent = true, noremap = true }) +-- vim.keymap.set("n", "g!", "(tmux_execute_selection)", { silent = true, noremap = true }) + diff --git a/nvim/ftplugin/yaml.lua b/nvim/after/ftplugin/yaml.lua similarity index 100% rename from nvim/ftplugin/yaml.lua rename to nvim/after/ftplugin/yaml.lua diff --git a/nvim/ftdetect/vcf.lua b/nvim/ftdetect/vcf.lua new file mode 100644 index 0000000..405b312 --- /dev/null +++ b/nvim/ftdetect/vcf.lua @@ -0,0 +1,6 @@ +vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, { + pattern = "*.vcf", + callback = function() + vim.bo.filetype = 'vcf' + end +}) diff --git a/nvim/ftplugin/html.lua b/nvim/ftplugin/html.lua deleted file mode 100644 index 27be732..0000000 --- a/nvim/ftplugin/html.lua +++ /dev/null @@ -1,5 +0,0 @@ -vim.g.html_indent_inctags = 'html,body,head,tbody,div' -vim.g.html_indent_script1 = 'inc' -vim.b.softtabstop = 2 -vim.b.shiftwidth = 2 -vim.b.tabstop = 2 diff --git a/nvim/ftplugin/rust.lua b/nvim/ftplugin/rust.lua deleted file mode 100644 index 4f2438d..0000000 --- a/nvim/ftplugin/rust.lua +++ /dev/null @@ -1,2 +0,0 @@ -vim.g.rustfmt_autosave = 0 -vim.g.syntastic_rust_checkers = {} diff --git a/nvim/ftplugin/tmux.lua b/nvim/ftplugin/tmux.lua deleted file mode 100644 index fcce459..0000000 --- a/nvim/ftplugin/tmux.lua +++ /dev/null @@ -1,5 +0,0 @@ -vim.keymap.set("n", "s", "(tmux_source_file)", { silent = true, noremap = true }) -vim.keymap.set("n", "K", "(tmux_show_man_floatwin)", { silent = true, noremap = true }) -vim.keymap.set("n", "g!!", "(tmux_execute_cursorline)", { silent = true, noremap = true }) -vim.keymap.set("n", "g!", "(tmux_execute_selection)", { silent = true, noremap = true }) - diff --git a/nvim/init.lua b/nvim/init.lua index 957d0b6..90a1240 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -1,51 +1,12 @@ --------------------------------------------------------------------------------- --- TODO --------------------------------------------------------------------------------- --- light theme --- hot reload colors --- breaks statusline? --- filetype autocmds --- nvim-lsp --- individual LSPs: js, tex --- key mapping updates --- set root_dir = lspconfig.util.root_pattern('.git') as global default for lsps - --------------------------------------------------------------------------------- --- bootstrap lazy.nvim --------------------------------------------------------------------------------- - -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not vim.loop.fs_stat(lazypath) then - vim.fn.system({ - "git", - "clone", - "--filter=blob:none", - "https://github.com/folke/lazy.nvim.git", - "--branch=stable", - lazypath, - }) +local load = function(mod) + package.loaded[mod] = nil + require(mod) end -vim.opt.rtp:prepend(lazypath) - --------------------------------------------------------------------------------- --- utilities --------------------------------------------------------------------------------- --- https://oroques.dev/notes/neovim-init - -require("load_plugins") -require("lsp") -require("options") -require("mappings") -require("theme") -require("utils") -require("treesitter") +load("user.settings") +load("user.commands") +load("user.mappings") +require("user.plugins") --------------------------------------------------------------------------------- --- TeX ftplugin? --------------------------------------------------------------------------------- --- TODO: --- compile shortcut --- au FileType tex let b:AutoPairs = {'(':')', '[':']', '{':'}', '"':'"', '"""':'"""'} --- let g:surround_{char2nr('c')} = "\\\1command\1{\r}" --- aucmd to re-enable syntax highlighting +-- must be after plugin config +pcall(vim.cmd.colorscheme, "tokyonight") diff --git a/nvim/lua/load_plugins.lua b/nvim/lua/load_plugins.lua deleted file mode 100644 index 2ebf062..0000000 --- a/nvim/lua/load_plugins.lua +++ /dev/null @@ -1,159 +0,0 @@ -require("lazy").setup({ - -- theme - { - "folke/tokyonight.nvim", - }, - -- { - -- "jsstevenson/tokyonight.nvim", - -- branch = "new-colors" - -- }, - { - "nvim-lualine/lualine.nvim", - config = function() - require("plugins.status_line") - end, - }, - { - "akinsho/nvim-bufferline.lua", - dependencies = { { "kyazdani42/nvim-web-devicons" } }, - config = function() - require("bufferline").setup({}) - end, - }, - { - "mechatroner/rainbow_csv", - ft = { "csv", "tsv" }, - }, - -- https://github.com/akinsho/toggleterm.nvim - -- { - -- "voldikss/vim-floaterm", - -- config = function() - -- require("plugins.floaterm") - -- end, - -- }, - { - "rrethy/vim-hexokinase", - build = "make hexokinase", - }, - - -- telescope - { - "nvim-telescope/telescope.nvim", - tag = "0.1.2", - dependencies = { - { "nvim-lua/plenary.nvim" }, - }, - config = function() - require("plugins.telescope") - end, - }, - { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, - - ---- text objects & formatting - ---- use 'wellle/targets.vim' - ---- use 'michaeljsmith/vim-indent-object' - { - "Vimjas/vim-python-pep8-indent", - ft = { "python" }, - }, - ---- try https://github.com/junegunn/vim-easy-align as well? - { - "godlygeek/tabular", - ft = { "tex", "markdown" }, - }, - { - "numToStr/Comment.nvim", - config = function() - require("Comment").setup() - end, - }, - { "tpope/vim-surround" }, - -- https://github.com/windwp/nvim-autopairs ? - { "jiangmiao/auto-pairs" }, - { - "jpalardy/vim-slime", - ft = { "python", "racket", "javascript", "javascriptreact" }, - config = function() - require("plugins.slime") - end, - }, - - ---- treesitter stuff - { - "nvim-treesitter/nvim-treesitter", - }, - { - "RRethy/nvim-treesitter-endwise", - }, - { - "windwp/nvim-ts-autotag", - }, - { - "nvim-treesitter/playground", - }, - - ---- LSP things - { - "neovim/nvim-lspconfig", - dependencies = { - { "hrsh7th/cmp-nvim-lsp" }, - { "hrsh7th/cmp-buffer" }, - { "hrsh7th/nvim-cmp" }, - { "hrsh7th/vim-vsnip" }, - { "hrsh7th/vim-vsnip-integ" }, - -- Plug 'hrsh7th/cmp-path' # TODO look at - -- Pug 'hrsh7th/cmp-cmdline' - { "williamboman/mason.nvim" }, - { "williamboman/mason-lspconfig.nvim" }, - }, - }, - - ---- git - ---- vim-fugitive, someday? - { - "rhysd/conflict-marker.vim", - config = function() - require("plugins.conflict_marker") - end, - }, - { - "lewis6991/gitsigns.nvim", - config = function() - require("gitsigns").setup() - end, - }, - - ---- language-specific - { - "nicwest/vim-http", - ft = { "http" }, - }, - { - "wlangstroth/vim-racket", - ft = { "racket" }, - }, - { - "rust-lang/rust.vim", - ft = { "rust" }, - }, - { - "lervag/vimtex", - ft = { "tex" }, - }, - { - "NTBBloodbath/rest.nvim", - requires = { "nvim-lua/plenary.nvim" }, - config = function() - require("plugins.nvim-rest") - end, - }, - { - -- "~/code/nvim-tmux/", - "jsstevenson/nvim-tmux", - ft = { "tmux" }, - requires = { "nvim-lua/plenary.nvim" }, - config = function() - require("nvim_tmux").setup() - end, - }, -}) diff --git a/nvim/lua/lsp.lua b/nvim/lua/lsp.lua deleted file mode 100644 index b2fdda7..0000000 --- a/nvim/lua/lsp.lua +++ /dev/null @@ -1,325 +0,0 @@ --------------------------------------------------------------------------------- --- top-level --------------------------------------------------------------------------------- -require("mason").setup({ - PATH = "prepend", - ui = { - border = "single", - }, -}) - -local capabilities_cmp = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()) - --------------------------------------------------------------------------------- --- basic functions --------------------------------------------------------------------------------- --- hover -vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "single" }) - --- diagnostics -vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { - virtual_text = false, - signs = true, - update_in_insert = true, -}) - --- vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with( --- vim.lsp.handlers.signature_help, { border = "single" } --- ) - --------------------------------------------------------------------------------- --- mappings --- TODO rewrite as autocmd --- if client.server_capabilities.hoverProvider then ... etc --------------------------------------------------------------------------------- - -local on_attach = function(_, _) - local options = { silent = true, buffer = true } - - vim.keymap.set("n", "K", function() - vim.lsp.buf.hover() - end, options) - vim.keymap.set("n", "gD", function() - vim.lsp.buf.declaration() - end, options) - vim.keymap.set("n", "gd", function() - vim.lsp.buf.definition() - end, options) - vim.keymap.set("n", "gi", function() - vim.lsp.buf.implementation() - end, options) - vim.keymap.set("n", "", function() - vim.lsp.buf.code_action() - end, options) - -- vim.keymap.set("n", '', function() vim.lsp.buf.signature_help() end, options) - vim.keymap.set("n", "f", function() - vim.lsp.buf.format() - end, options) - vim.keymap.set("n", "r", function() - vim.lsp.buf.rename() - end) - vim.keymap.set("n", "a", function() - vim.lsp.buf.code_action() - end) - vim.keymap.set("n", "", function() - vim.diagnostic.goto_next({ popup_opts = { border = "single" } }) - end, options) - vim.keymap.set("n", "", function() - vim.diagnostic.goto_prev({ popup_opts = { border = "single" } }) - end, options) -end - --------------------------------------------------------------------------------- --- completion --------------------------------------------------------------------------------- - -vim.cmd("set completeopt=menuone,noinsert,noselect") -vim.cmd("set shortmess+=c") - -local cmp = require("cmp") - -cmp.setup({ - snippet = { - expand = function(args) - vim.fn["vsnip#anonymous"](args.body) - end, - }, - mapping = { - [""] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), - [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.complete(), - [""] = cmp.mapping.close(), - [""] = cmp.mapping.confirm({ select = false }), - }, - sources = { - { name = "nvim_lsp" }, - { name = "vsnip" }, - { name = "buffer" }, - }, - window = { - documentation = { - maxheight = 50, - }, - }, -}) - --------------------------------------------------------------------------------- --- json --------------------------------------------------------------------------------- -local options_json = { - on_attach = on_attach, - capabilities = capabilities_cmp, - settings = { - json = { - format = false, - }, - }, -} - --------------------------------------------------------------------------------- --- html --------------------------------------------------------------------------------- -local options_html = { - on_attach = on_attach, - capabilities = capabilities_cmp, -} - --------------------------------------------------------------------------------- --- julia --------------------------------------------------------------------------------- -local options_julia = { - on_attach = on_attach, - capabilities = capabilities_cmp, -} - --------------------------------------------------------------------------------- --- python --------------------------------------------------------------------------------- -local options_pyright = { - on_attach = on_attach, - capabilities = capabilities_cmp, - settings = { - pyright = { - exclude = { - "**/build", - }, - }, - }, -} - -local options_python = { - on_attach = on_attach, - capabilities = capabilities_cmp, - settings = { - pylsp = { - plugins = { - pycodestyle = { enabled = false }, - pyflakes = { enabled = false }, - yapf = { enabled = false }, - flake8 = { enabled = true }, - }, - }, - }, -} - --------------------------------------------------------------------------------- --- rust --------------------------------------------------------------------------------- --- https://sharksforarms.dev/posts/neovim-rust/ -local options_rust = { - on_attach = on_attach, - capabilities = capabilities_cmp, - settings = { - ["rust-analyzer"] = { - assist = { - importMergeBehavior = "last", - importPrefix = "by_self", - }, - cargo = { - loadOutDirsFromCheck = true, - }, - procMacro = { - enable = true, - }, - }, - }, -} - --------------------------------------------------------------------------------- --- lua --------------------------------------------------------------------------------- --- USER = vim.fn.expand("$USER") --- --- local sumneko_root_path = "" --- local sumneko_binary = "" --- --- sumneko_binary = "/Users/" --- .. USER --- .. "/.local/share/nvim/lsp_servers/sumneko_lua/extension/server/bin/lua-language-server" --- sumneko_root_path = "/Users/" .. USER .. "/.local/share/nvim/lsp_servers/sumneko_lua/extension/server" - -local options_lua = { - on_attach = on_attach, - -- cmd = { sumneko_binary, "-E", sumneko_root_path .. "/main.lua" }, - capabilities = capabilities_cmp, - settings = { - Lua = { - runtime = { - version = "LuaJIT", - path = vim.split(package.path, ";"), - }, - diagnostics = { - globals = { "vim" }, - }, - workspace = { - -- Make the server aware of Neovim runtime files - library = { - [vim.fn.expand("$VIMRUNTIME/lua")] = true, - [vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true, - }, - }, - format = { - enable = false, - }, - }, - }, -} - --------------------------------------------------------------------------------- --- ruby --------------------------------------------------------------------------------- -local options_ruby = { - on_attach = on_attach, - capabilities = capabilities_cmp, - settings = { - solargraph = { - diagnostics = true, - }, - }, -} - --------------------------------------------------------------------------------- --- efm --------------------------------------------------------------------------------- -local prettier_options = { - formatCommand = 'prettier "${INPUT}"', - formatStdin = true, - -- env = { - -- string.format("PRETTIERD_DEFAULT_CONFIG=%s", vim.fn.expand("~/.prettierrc.json")), - -- }, -} - -local options_efm = { - init_options = { - documentFormatting = true, - }, - settings = { - rootMarkers = { ".git/" }, - languages = { - lua = { - { formatCommand = "stylua -", formatStdin = true }, - }, - python = { - { - formatCommand = "black --quiet -", - formatStdin = true, - }, - { - formatCommand = "isort --quiet -", - formatStdin = true, - }, - -- { - -- lintCommand = "flake8 -", - -- lintStdin = true, - -- lintFormats = { "%f:%l:%c: %m" }, - -- }, - }, - yaml = { prettier_options }, - html = { prettier_options }, - css = { prettier_options }, - json = { - prettier_options, - }, - javascript = { prettier_options }, - graphql = { prettier_options }, - }, - }, - -- filetypes = { "lua", "python", "yaml", "html", "css", "json", "javascript", "graphql" }, -} - --------------------------------------------------------------------------------- --- initialize --------------------------------------------------------------------------------- -local lspconfig = require("lspconfig") - -require("mason-lspconfig").setup_handlers({ - function(server_name) - lspconfig[server_name].setup({}) - end, - ["lua_ls"] = function() - lspconfig.lua_ls.setup(options_lua) - end, - ["solargraph"] = function() - lspconfig.solargraph.setup(options_ruby) - end, - ["pyright"] = function() - lspconfig.pyright.setup(options_pyright) - end, - ["html"] = function() - lspconfig.html.setup(options_html) - end, - ["jsonls"] = function() - lspconfig.jsonls.setup(options_json) - end, - ["rust_analyzer"] = function() - lspconfig.rust_analyzer.setup(options_rust) - end, - ["efm"] = function() - lspconfig.efm.setup(options_efm) - end, - ["julials"] = function() - lspconfig.julials.setup(options_julia) - end, -}) diff --git a/nvim/lua/lua-ls.lua b/nvim/lua/lua-ls.lua deleted file mode 100644 index e69de29..0000000 diff --git a/nvim/lua/mappings.lua b/nvim/lua/mappings.lua deleted file mode 100644 index 0324cd2..0000000 --- a/nvim/lua/mappings.lua +++ /dev/null @@ -1,40 +0,0 @@ --- https://vim.fandom.com/wiki/Map_semicolon_to_colon -vim.keymap.set("", ";", ":") -vim.keymap.set("", ";;", ":") -- TODO fix? - --- map esc to clear -vim.keymap.set("", "", ":noh") - --- easy edit config files -vim.keymap.set("", "ev", ":edit $MYVIMRC", { silent = true }) -vim.keymap.set("", "sv", ":luafile $MYVIMRC", { silent = true }) - --- buffer movement -vim.keymap.set("", "", ":bp", { silent = true }) -vim.keymap.set("", "", ":bn", { silent = true }) - --- comment.nvim -vim.keymap.set("v", "", "gc", { silent = true }) - --- telescope -local telescope = require("telescope.builtin") -vim.keymap.set("n", "ff", function() - telescope.find_files() -end, { silent = true }) -vim.keymap.set("n", "fg", function() - telescope.live_grep() -end, { silent = true }) -vim.keymap.set("n", "gr", function() - telescope.lsp_references() -end, { silent = true }) -vim.keymap.set("n", "fh", function() - telescope.help_tags() -end, { silent = true }) - --- floaterm -vim.keymap.set("t", "", "") -vim.keymap.set("n", "", ":FloatermToggle") -vim.keymap.set("t", "", ":FloatermToggle") - --- misc -vim.keymap.set("n", "", "zz", { silent = true }) diff --git a/nvim/lua/packer_plugins.lua b/nvim/lua/packer_plugins.lua deleted file mode 100644 index 446d513..0000000 --- a/nvim/lua/packer_plugins.lua +++ /dev/null @@ -1,176 +0,0 @@ -return require("packer").startup({ - function(use) - use("wbthomason/packer.nvim") - - -- appearance - use({ - -- "folke/tokyonight.nvim", - "jsstevenson/tokyonight.nvim", - branch = "new-colors", - }) - use({ - "hoob3rt/lualine.nvim", - config = function() - require("plugins.status_line") - end, - }) - use({ - "akinsho/nvim-bufferline.lua", - tag = "v2.*", - requires = { { "kyazdani42/nvim-web-devicons" } }, - config = function() - require("bufferline").setup({}) - end, - }) - use({ - "voldikss/vim-floaterm", - config = function() - require("plugins.floaterm") - end, - }) - use({ - "mechatroner/rainbow_csv", - ft = { "csv", "tsv" }, - }) - use({ - "rrethy/vim-hexokinase", - run = "cd ~/.local/share/nvim/site/pack/packer/start/vim-hexokinase && make hexokinase", - }) - - -- general - use({ - "b0o/mapx.nvim", - config = function() - require("mapx").setup({}) - end, - }) - - -- telescope - use({ - "nvim-telescope/telescope.nvim", - requires = { - { "nvim-lua/plenary.nvim" }, - { - "nvim-telescope/telescope-fzf-native.nvim", - run = "make", - }, - }, - config = function() - require("plugins.telescope") - end, - }) - - -- text objects & formatting - -- use 'wellle/targets.vim' - -- use 'michaeljsmith/vim-indent-object' - use({ - "Vimjas/vim-python-pep8-indent", - ft = { "python" }, - }) - -- try https://github.com/junegunn/vim-easy-align as well? - use({ - "godlygeek/tabular", - ft = { "tex", "markdown" }, - }) - use({ - "numToStr/Comment.nvim", - config = function() - require("Comment").setup() - end, - }) - use("tpope/vim-surround") - -- https://github.com/windwp/nvim-autopairs ? - use("jiangmiao/auto-pairs") - use({ - "jpalardy/vim-slime", - -- ft = {'python', 'racket', 'javascript', 'javascriptreact'}, - config = function() - require("plugins.slime") - end, - }) - - -- treesitter stuff - use({ - "nvim-treesitter/nvim-treesitter", - }) - use({ - "RRethy/nvim-treesitter-endwise", - }) - use({ - "windwp/nvim-ts-autotag", - }) - use({ - "nvim-treesitter/playground", - }) - - -- LSP things - use({ - "neovim/nvim-lspconfig", - requires = { - { "hrsh7th/cmp-nvim-lsp" }, - { "hrsh7th/cmp-buffer" }, - { "hrsh7th/nvim-cmp" }, - { "hrsh7th/vim-vsnip" }, - { "hrsh7th/vim-vsnip-integ" }, - -- Plug 'hrsh7th/cmp-path' # TODO look at - -- Plug 'hrsh7th/cmp-cmdline' - { "williamboman/mason.nvim" }, - { "williamboman/mason-lspconfig.nvim" }, - }, - }) - - -- git - -- vim-fugitive, someday? - use({ - "rhysd/conflict-marker.vim", - config = function() - require("plugins.conflict_marker") - end, - }) - use({ - "lewis6991/gitsigns.nvim", - config = function() - require("gitsigns").setup() - end, - }) - - -- language-specific - use({ - "nicwest/vim-http", - ft = { "http" }, - }) - use({ - "wlangstroth/vim-racket", - ft = { "racket" }, - }) - use({ - "rust-lang/rust.vim", - ft = { "rust" }, - }) - use({ - "lervag/vimtex", - ft = { "tex" }, - }) - use({ - "NTBBloodbath/rest.nvim", - requires = { "nvim-lua/plenary.nvim" }, - config = function() - require("plugins.nvim-rest") - end, - }) - use({ - -- "~/code/nvim-tmux/", - "jsstevenson/nvim-tmux", - ft = { "tmux" }, - requires = { "nvim-lua/plenary.nvim" }, - config = function() - require("nvim_tmux").setup() - end, - }) - end, - config = { - display = { - open_fn = require("packer.util").float, - }, - }, -}) diff --git a/nvim/lua/plugins/bufferline.lua b/nvim/lua/plugins/bufferline.lua new file mode 100644 index 0000000..1b9fca9 --- /dev/null +++ b/nvim/lua/plugins/bufferline.lua @@ -0,0 +1,28 @@ +local Plugin = { "akinsho/bufferline.nvim" } + +Plugin.event = "VeryLazy" + +Plugin.opts = { + options = { + mode = "buffers", + -- offsets = { + -- { filetype = "NvimTree" }, + -- }, + diagnostics = "nvim_lsp", + diagnostics_indicator = function(count, level) + local icon = level:match("error") and " " or " " + return " " .. icon .. count + end + }, + highlights = { + buffer_selected = { + italic = false, + }, + indicator_selected = { + fg = { attribute = "fg", highlight = "Function" }, + italic = false, + }, + }, +} + +return Plugin diff --git a/nvim/lua/plugins/cmp.lua b/nvim/lua/plugins/cmp.lua new file mode 100644 index 0000000..67a7d8e --- /dev/null +++ b/nvim/lua/plugins/cmp.lua @@ -0,0 +1,116 @@ +-- TODO +-- * figure out snippets - https://lsp-zero.netlify.app/v3.x/template/opinionated.html +local Plugin = { "hrsh7th/nvim-cmp" } + +Plugin.dependencies = { + -- Sources + { "hrsh7th/cmp-buffer" }, + { "hrsh7th/cmp-path" }, + { "hrsh7th/cmp-nvim-lsp" }, + -- {'saadparwaiz1/cmp_luasnip'}, + + -- Snippets + -- {'L3MON4D3/LuaSnip'}, + -- {'rafamadriz/friendly-snippets'}, + + -- Misc + { "windwp/nvim-autopairs" }, +} + +Plugin.event = "InsertEnter" + +function Plugin.config() + vim.opt.completeopt = { "menu", "menuone", "noselect" } + + local cmp = require("cmp") + -- local luasnip = require('luasnip') + -- require('luasnip.loaders.from_vscode').lazy_load() + + local select_opts = { behavior = cmp.SelectBehavior.Insert } + local cmp_autopairs = require("nvim-autopairs.completion.cmp") + cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) + + cmp.setup({ + -- snippet = { + -- expand = function(args) + -- luasnip.lsp_expand(args.body) + -- end + -- }, + sources = { + { name = "path" }, + { name = "nvim_lsp" }, + { name = "buffer", keyword_length = 3 }, + -- {name = 'luasnip', keyword_length = 2}, + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + formatting = { + fields = { "menu", "abbr", "kind" }, + format = function(entry, item) + local menu_icon = { + nvim_lsp = "λ", + luasnip = "⋗", + buffer = "Ω", + path = "🖫", + } + + item.menu = menu_icon[entry.source.name] + return item + end, + }, + mapping = { + [""] = cmp.mapping.select_prev_item(select_opts), + [""] = cmp.mapping.select_next_item(select_opts), + + -- [''] = cmp.mapping.select_prev_item(select_opts), + -- [''] = cmp.mapping.select_next_item(select_opts), + + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + + [""] = cmp.mapping.abort(), + [""] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping.confirm({ select = false }), + + -- [''] = cmp.mapping(function(fallback) + -- if luasnip.jumpable(1) then + -- luasnip.jump(1) + -- else + -- fallback() + -- end + -- end, {'i', 's'}), + -- + -- [''] = cmp.mapping(function(fallback) + -- if luasnip.jumpable(-1) then + -- luasnip.jump(-1) + -- else + -- fallback() + -- end + -- end, {'i', 's'}), + + [""] = cmp.mapping(function(fallback) + local col = vim.fn.col(".") - 1 + + if cmp.visible() then + cmp.select_next_item(select_opts) + elseif col == 0 or vim.fn.getline("."):sub(col, col):match("%s") then + fallback() + else + cmp.complete() + end + end, { "i", "s" }), + + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item(select_opts) + else + fallback() + end + end, { "i", "s" }), + }, + }) +end + +return Plugin diff --git a/nvim/lua/plugins/colorizer.lua b/nvim/lua/plugins/colorizer.lua new file mode 100644 index 0000000..b7eb7d1 --- /dev/null +++ b/nvim/lua/plugins/colorizer.lua @@ -0,0 +1,4 @@ +local Plugin = {"norcalli/nvim-colorizer.lua"} +-- needs explicit require() in config function to initialize properly +Plugin.config = function() require("colorizer").setup() end +return Plugin diff --git a/nvim/lua/plugins/conflict_marker.lua b/nvim/lua/plugins/conflict_marker.lua deleted file mode 100644 index 990b0c7..0000000 --- a/nvim/lua/plugins/conflict_marker.lua +++ /dev/null @@ -1 +0,0 @@ -vim.g.conflict_marker_enable_mappings = 0 diff --git a/nvim/lua/plugins/floaterm.lua b/nvim/lua/plugins/floaterm.lua deleted file mode 100644 index e398529..0000000 --- a/nvim/lua/plugins/floaterm.lua +++ /dev/null @@ -1,3 +0,0 @@ -vim.g.floaterm_width = 0.8 -vim.g.floaterm_height = 0.85 -vim.g.floaterm_autoclose = 1 diff --git a/nvim/lua/plugins/init.lua b/nvim/lua/plugins/init.lua new file mode 100644 index 0000000..a02851a --- /dev/null +++ b/nvim/lua/plugins/init.lua @@ -0,0 +1,18 @@ +local Plugins = { + -- {'tpope/vim-fugitive'}, + -- {'wellle/targets.vim'}, + -- {'tpope/vim-repeat'}, + { + "folke/tokyonight.nvim", + lazy = false, + priority = 1000, + }, + { "windwp/nvim-autopairs", event = "InsertEnter", opts = {} }, + { "Vimjas/vim-python-pep8-indent" }, + { "jsstevenson/nvim-tmux", opts = {} }, + { "kylechui/nvim-surround", opts = {} }, + { "lewis6991/gitsigns.nvim", opts = {} }, + { "rhysd/conflict-marker.vim" }, +} + +return Plugins diff --git a/nvim/lua/plugins/lsp/conform.lua b/nvim/lua/plugins/lsp/conform.lua new file mode 100644 index 0000000..b2cef72 --- /dev/null +++ b/nvim/lua/plugins/lsp/conform.lua @@ -0,0 +1,15 @@ +-- TODO +-- * biome for js +-- * something else for html, css, yaml +-- * some way to rely on local ruff/whatever install if available instead of mason-provided +require("conform").setup({ + default_format_opts = { + lsp_format = "fallback", + }, + formatters_by_ft = { + lua = { "stylua", lsp_format = "never" }, + rust = { "rustfmt", lsp_format = "never" }, + }, +}) +-- must be after require("conform") +require("mason-conform").setup({ ignore_install = { "ruff" } }) diff --git a/nvim/lua/plugins/lsp/lua_ls.lua b/nvim/lua/plugins/lsp/lua_ls.lua new file mode 100644 index 0000000..32d6ec3 --- /dev/null +++ b/nvim/lua/plugins/lsp/lua_ls.lua @@ -0,0 +1,33 @@ +local lspconfig = require("lspconfig") +local lsp_capabilities = require("cmp_nvim_lsp").default_capabilities() + +local runtime_path = vim.split(package.path, ";") +table.insert(runtime_path, "lua/?.lua") +table.insert(runtime_path, "lua/?/init.lua") + +lspconfig.lua_ls.setup({ + capabilities = lsp_capabilities, + settings = { + Lua = { + runtime = { + version = "LuaJIT", + path = runtime_path, + }, + diagnostics = { + -- Get the language server to recognize the `vim` global + globals = { "vim" }, + }, + workspace = { + library = { + -- Make the server aware of Neovim runtime files + vim.fn.expand("$VIMRUNTIME/lua"), + vim.fn.stdpath("config") .. "/lua", + }, + checkThirdParty = false, + }, + telemetry = { + enable = false, + }, + }, + }, +}) diff --git a/nvim/lua/plugins/lsp/mason.lua b/nvim/lua/plugins/lsp/mason.lua new file mode 100644 index 0000000..194d103 --- /dev/null +++ b/nvim/lua/plugins/lsp/mason.lua @@ -0,0 +1,16 @@ +require("mason").setup({ + ui = { + border = "single", + }, +}) +require("mason-lspconfig").setup({ + ensure_installed = { "pyright", "rust_analyzer", "lua_ls", "ruff" }, + handlers = { + function(server_name) + require("lspconfig")[server_name].setup({}) + end, + ["lua_ls"] = function() + require("plugins.lsp.lua_ls") + end, + }, +}) diff --git a/nvim/lua/plugins/lspzero.lua b/nvim/lua/plugins/lspzero.lua new file mode 100644 index 0000000..3a4eaf9 --- /dev/null +++ b/nvim/lua/plugins/lspzero.lua @@ -0,0 +1,61 @@ +local Plugin = { "VonHeikemen/lsp-zero.nvim" } + +Plugin.dependencies = { + { "neovim/nvim-lspconfig" }, + { "hrsh7th/cmp-nvim-lsp" }, + { "hrsh7th/nvim-cmp" }, + { "williamboman/mason.nvim" }, + { "williamboman/mason-lspconfig.nvim" }, + { "stevearc/conform.nvim" }, + { "zapling/mason-conform.nvim" }, +} +Plugin.cmd = { "LspInfo", "LspInstall", "LspUnInstall" } +Plugin.event = { "BufReadPre", "BufNewFile" } + +function Plugin.init() + vim.diagnostic.config({ + virtual_text = false, + severity_sort = true, + float = { + border = "single", + -- source = 'always', + }, + signs = { + text = { + [vim.diagnostic.severity.ERROR] = "✘", + [vim.diagnostic.severity.WARN] = "▲", + [vim.diagnostic.severity.HINT] = "⚑", + [vim.diagnostic.severity.INFO] = "»", + }, + }, + }) + + vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "single" }) + vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = "single" }) +end + +function Plugin.config() + local lsp_zero = require("lsp-zero") + lsp_zero.ui({ float_border = "single" }) + local lsp_capabilities = require("cmp_nvim_lsp").default_capabilities() -- TODO use for other lang servers + + lsp_zero.on_attach(function(client, bufnr) + lsp_zero.default_keymaps({ buffer = bufnr }) + + vim.keymap.set("n", "", "lua vim.diagnostic.goto_prev()", { buffer = bufnr }) + vim.keymap.set("n", "", "lua vim.diagnostic.goto_next()", { buffer = bufnr }) + vim.keymap.set("n", "r", "lua vim.lsp.buf.rename()", { buffer = bufnr }) + + vim.g.lsp_zero_ui_float_border = "single" + end) + + -- setup MUST go mason -> conform -> mason-conform + require("plugins.lsp.mason") + require("plugins.lsp.conform") + + vim.keymap.set("n", "f", function() + require("conform").format({ async = true, lsp_fallback = true }) + end) +end + +return Plugin diff --git a/nvim/lua/plugins/lualine.lua b/nvim/lua/plugins/lualine.lua new file mode 100644 index 0000000..0b327b7 --- /dev/null +++ b/nvim/lua/plugins/lualine.lua @@ -0,0 +1,35 @@ +-- TODO +-- * don't use different backgrounds for each section +-- * just use a minimal line separator +-- * provide full path for file? +local Plugin = { "nvim-lualine/lualine.nvim" } +Plugin.dependencies = { "nvim-tree/nvim-web-devicons", lazy = true } + +function Plugin.config() + -- TODO add more flexible options for other kinds of files? + -- ideally target prompt under PS1 var but that doesn't seem to be working right now + local function environment_name() + local ps1 = os.getenv("VIRTUAL_ENV_PROMPT") + if ps1 then + return ps1 + else + return "" + end + end + + require("lualine").setup({ + options = { + theme = "tokyonight", + }, + sections = { + lualine_a = { "mode" }, + lualine_b = { {"branch", use_mode_colors = false } }, + lualine_c = { environment_name }, + lualine_x = { "encoding" }, + lualine_y = { "filetype" }, + lualine_z = { {"filename", color = {}} }, + }, + }) +end + +return Plugin diff --git a/nvim/lua/plugins/nvim-rest.lua b/nvim/lua/plugins/nvim-rest.lua deleted file mode 100644 index 920d588..0000000 --- a/nvim/lua/plugins/nvim-rest.lua +++ /dev/null @@ -1,24 +0,0 @@ -require("rest-nvim").setup({ - -- Open request results in a horizontal split - result_split_horizontal = false, - -- Keep the http file buffer above|left when split horizontal|vertical - result_split_in_place = false, - -- Skip SSL verification, useful for unknown certificates - skip_ssl_verification = false, - -- Highlight request on run - highlight = { - enabled = true, - timeout = 150, - }, - result = { - -- toggle showing URL, HTTP info, headers at top the of result window - show_url = true, - show_http_info = true, - show_headers = true, - }, - -- Jump to request line on run - jump_to_request = false, - env_file = ".env", - custom_dynamic_variables = {}, - yank_dry_run = true, -}) diff --git a/nvim/lua/plugins/slime.lua b/nvim/lua/plugins/slime.lua deleted file mode 100644 index b7fe5c5..0000000 --- a/nvim/lua/plugins/slime.lua +++ /dev/null @@ -1,2 +0,0 @@ -vim.g.slime_target = "tmux" -vim.g.slime_python_ipython = 1 diff --git a/nvim/lua/plugins/status_line.lua b/nvim/lua/plugins/status_line.lua deleted file mode 100644 index f00cd3b..0000000 --- a/nvim/lua/plugins/status_line.lua +++ /dev/null @@ -1,27 +0,0 @@ -local present, lualine = pcall(require, "lualine") -if not present then - return -end - -local function environment_name() - local ps1 = os.getenv("PS1") - if ps1 then - return string.match(ps1, "%((.+)%) ") - else - return "" - end -end - -lualine.setup({ - options = { - theme = "tokyonight", - }, - sections = { - lualine_a = { "mode" }, - lualine_b = { "branch" }, - lualine_c = { environment_name }, - lualine_x = { "encoding" }, - lualine_y = { "filetype" }, - lualine_z = { "filename" }, - }, -}) diff --git a/nvim/lua/plugins/telescope.lua b/nvim/lua/plugins/telescope.lua index 2e02363..29e303a 100644 --- a/nvim/lua/plugins/telescope.lua +++ b/nvim/lua/plugins/telescope.lua @@ -1,32 +1,51 @@ -local previewers = require("telescope.previewers") -local actions = require("telescope.actions") +local Plugin = { "nvim-telescope/telescope.nvim" } -require("telescope").setup({ - defaults = { - file_sorter = require("telescope.sorters").get_fzy_sorter, - prompt_prefix = " >", - file_previewer = previewers.vim_buffer_cat.new, - grep_previewer = previewers.vim_buffer_vimgrep.new, - mappings = { - i = { - [""] = false, - [""] = false, - [""] = actions.close, +Plugin.dependencies = { + { "nvim-lua/plenary.nvim" }, + { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, +} + +Plugin.cmd = { "Telescope" } + +function Plugin.init() + vim.keymap.set("n", "ff", "Telescope find_files", { silent = true }) + vim.keymap.set("n", "fg", "Telescope live_grep", { silent = true }) + vim.keymap.set("n", "fd", "Telescope diagnostics", { silent = true }) + vim.keymap.set("n", "fh", "Telescope help_tags", { silent = true }) + vim.keymap.set("n", "gr", "Telescope lsp_references", { silent = true }) + -- vim.keymap.set('n', '?', 'Telescope oldfiles') + -- vim.keymap.set('n', '', 'Telescope buffers') + vim.keymap.set('n', 'fs', 'Telescope current_buffer_fuzzy_find') + -- vim.keymap.set('n', 'fh', 'Telescope help_tags') +end + +function Plugin.config() + local telescope = require("telescope") + telescope.load_extension("fzf") + + local previewers = require("telescope.previewers") + local actions = require("telescope.actions") + telescope.setup({ + defaults = { + file_previewer = previewers.vim_buffer_cat.new, + grep_previewer = previewers.vim_buffer_vimgrep.new, + mappings = { + i = { + [""] = false, + [""] = false, + [""] = actions.close, + }, }, + layout_strategy = "vertical", }, - layout_strategy = "vertical", file_ignore_patterns = { "node_modules", "site-packages", "build", + "dist", + ".venv", }, - }, - extensions = { - fzf = { - fuzzy = true, - override_generic_sorter = true, - override_file_sorter = true, - case_mode = "smart_case", - }, - }, -}) + }) +end + +return Plugin diff --git a/nvim/lua/treesitter.lua b/nvim/lua/plugins/treesitter.lua similarity index 52% rename from nvim/lua/treesitter.lua rename to nvim/lua/plugins/treesitter.lua index e625bd4..1d4c038 100644 --- a/nvim/lua/treesitter.lua +++ b/nvim/lua/plugins/treesitter.lua @@ -1,38 +1,71 @@ -local ts = require("nvim-treesitter.configs") -ts.setup({ +local Plugin = { "nvim-treesitter/nvim-treesitter" } + +Plugin.dependencies = { + { "RRethy/nvim-treesitter-endwise" }, + { "nvim-treesitter/playground" }, +} + +-- Plugin.dependencies = { +-- {'nvim-treesitter/nvim-treesitter-textobjects'} +-- } + +Plugin.opts = { + highlight = { + enable = true, + disable = { "tex", "html" }, + }, + -- textobjects = { + -- select = { + -- enable = true, + -- lookahead = true, + -- keymaps = { + -- ['af'] = '@function.outer', + -- ['if'] = '@function.inner', + -- ['ac'] = '@class.outer', + -- ['ic'] = '@class.inner', + -- } + -- }, + -- }, ensure_installed = { "bash", "bibtex", "c", "cmake", "comment", - "cpp", "css", "graphql", + "haskell", "html", "http", - "java", "javascript", - "jsdoc", "json", - "jsonc", + "julia", "julia", "lua", "make", "python", + "query", "ruby", "rust", + "scala", "scss", "sparql", + "sql", "toml", "tsx", + "tsx", "typescript", "vim", + "vimdoc", "yaml", - "query", }, - highlight = { enable = true, disable = { "tex", "html" } }, - indent = { enable = true, disable = { "rust", "lua", "python", "ruby" } }, + endwise = { + enable = true, + }, + indent = { + enable = true, + disable = { "python", "yaml" }, + }, incremental_selection = { enable = true, keymaps = { @@ -42,17 +75,14 @@ ts.setup({ node_decremental = "", }, }, - endwise = { - enable = true, - }, autotag = { enable = true, }, playground = { enable = true, disable = {}, - updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code - persist_queries = false, -- Whether the query persists across vim sessions + updatetime = 25, + persist_queries = false, keybindings = { toggle_query_editor = "o", toggle_hl_groups = "i", @@ -66,4 +96,10 @@ ts.setup({ show_help = "?", }, }, -}) +} + +function Plugin.config(name, opts) + require("nvim-treesitter.configs").setup(opts) +end + +return Plugin diff --git a/nvim/lua/theme.lua b/nvim/lua/theme.lua deleted file mode 100644 index 25c8960..0000000 --- a/nvim/lua/theme.lua +++ /dev/null @@ -1,6 +0,0 @@ -vim.g.Hexokinase_optOutPatterns = { "colour_names" } - -vim.g.tokyonight_style = "storm" -vim.g.tokyonight_dark_float = false -vim.g.tokyonight_colors = {} -vim.cmd("colorscheme tokyonight") diff --git a/nvim/lua/types.lua b/nvim/lua/types.lua deleted file mode 100644 index b11b4f9..0000000 --- a/nvim/lua/types.lua +++ /dev/null @@ -1,12 +0,0 @@ --- put this file somewhere in your nvim config, like: ~/.config/nvim/lua/types.lua --- DONT require this file anywhere. It's simply there for the lsp server. - --- this code seems weird, but it hints the lsp server to merge the required packages in the vim global variable -vim = require("vim.shared") -vim = require("vim.uri") -vim = require("vim.inspect") - --- let sumneko know where the sources are for the global vim runtime -vim.lsp = require("vim.lsp") -vim.treesitter = require("vim.treesitter") -vim.highlight = require("vim.highlight") diff --git a/nvim/lua/user/commands.lua b/nvim/lua/user/commands.lua new file mode 100644 index 0000000..155695e --- /dev/null +++ b/nvim/lua/user/commands.lua @@ -0,0 +1,9 @@ +local group = vim.api.nvim_create_augroup("user_cmds", { clear = true }) + +-- reload config +-- vim.api.nvim_create_user_command('ReloadConfig', 'source $MYVIMRC', {}) + +-- delete trailing whitespace on save +vim.api.nvim_create_autocmd("BufWritePre", { command = "%s/\\s\\+$//e", group = group }) + +-- convert tabs to spaces for certain filetypes (opt in) diff --git a/nvim/lua/user/mappings.lua b/nvim/lua/user/mappings.lua new file mode 100644 index 0000000..0f06f61 --- /dev/null +++ b/nvim/lua/user/mappings.lua @@ -0,0 +1,15 @@ +vim.g.mapleader = " " + +-- https://vim.fandom.com/wiki/Map_semicolon_to_colon +vim.keymap.set("", ";", ":") +vim.keymap.set("", ";;", ":") -- TODO fix? + +-- map esc to clear +vim.keymap.set("", "", ":noh") + +-- buffer movement +vim.keymap.set("", "", ":bp", { silent = true }) +vim.keymap.set("", "", ":bn", { silent = true }) + +-- center on jump +vim.keymap.set("n", "", "zz", { silent = true }) diff --git a/nvim/lua/user/plugins.lua b/nvim/lua/user/plugins.lua new file mode 100644 index 0000000..5ecd224 --- /dev/null +++ b/nvim/lua/user/plugins.lua @@ -0,0 +1,37 @@ +-- Initialize and set up Lazy +local lazy = {} + +function lazy.install(path) + if not vim.loop.fs_stat(path) then + print("Installing lazy.nvim....") + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + path, + }) + end +end + +function lazy.setup(plugins) + if vim.g.plugins_ready then + return + end + + -- You can "comment out" the line below after lazy.nvim is installed + -- lazy.install(lazy.path) + + vim.opt.rtp:prepend(lazy.path) + + require("lazy").setup(plugins, lazy.opts) + vim.g.plugins_ready = true +end + +lazy.path = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +lazy.opts = { + change_detection = { enabled = false} +} + +lazy.setup({ { import = "plugins" } }) diff --git a/nvim/lua/options.lua b/nvim/lua/user/settings.lua similarity index 94% rename from nvim/lua/options.lua rename to nvim/lua/user/settings.lua index dee10fe..f2508f8 100644 --- a/nvim/lua/options.lua +++ b/nvim/lua/user/settings.lua @@ -16,7 +16,7 @@ opt("w", "cc", "80,88") opt("w", "cursorline", true) opt("o", "syntax", "disable") -- theoretically treesitter covers this better opt("o", "showmode", false) -- ???? -cmd("set signcolumn=yes:1") -- for lsp issues? +cmd("set signcolumn=yes:1") -- for lsp issues? TODO return to this opt("b", "expandtab", true) --opt("b", "fileencoding", "utf-8") @@ -42,7 +42,6 @@ local disabled_built_ins = { "spellfile_plugin", "tutor", } - for _, plugin in pairs(disabled_built_ins) do vim.g["loaded_" .. plugin] = 1 end diff --git a/nvim/lua/utils.lua b/nvim/lua/utils.lua deleted file mode 100644 index 6b5da98..0000000 --- a/nvim/lua/utils.lua +++ /dev/null @@ -1,3 +0,0 @@ --- delete trailing whitespace on save -local group = vim.api.nvim_create_augroup("EraseWhitespace", { clear = true }) -vim.api.nvim_create_autocmd("BufWritePre", { command = "%s/\\s\\+$//e", group = group }) diff --git a/nvim/syntax/vcf.vim b/nvim/syntax/vcf.vim new file mode 100644 index 0000000..688fbd2 --- /dev/null +++ b/nvim/syntax/vcf.vim @@ -0,0 +1,42 @@ +"General idea: +" highlights per column +" Some kind of alternating gray for info column or for keys? +" +"if exists('b:current_syntax') | finish| endif + +"syntax match header "##.*" +"syntax match chromHeader "#CHROM" nextgroup=posHeader +"syntax match chrom "^[^\t#]\+" nextgroup=pos +"syntax match posHeader "^\t]\+" contained +"syntax match pos "[^\t]\+" + +"syntax region record start="^[^#]" end="$" contains=chrom,pos +" +"syntax match chrom "^[^#\t]*" nextgroup=pos containedin=record +"syntax match pos "[\t ][^\t]\+" nextgroup=id containedin=record +"syntax match id "[\t ][^\t]\+" nextgroup=ref containedin=record +"syntax match ref "[\t ][^\t]\+" nextgroup=alt containedin=record +"syntax match alt "[\t ][^\t]\+" nextgroup=qual containedin=record +"syntax match qual "[\t ][^\t]\+" nextgroup=filter containedin=record +"syntax match filter "[\t ][^\t]\+" nextgroup=infoInit containedin=record +" +"syntax match infoInit "[\t ][^;]\+" nextgroup=infoAlt containedin=record +"syntax match format "[\t ][^\t]\+" nextgroup=samples containedin=record + +"syntax region header start="^##" end="$" +" +"syntax match generalInfo "^##.*$" containedin=header + + +" TODO alternate samples??? + +"hi def link generalInfo SpecialKey +" +"hi def link chrom Constant +"hi def link pos String +"hi def link id Operator +"hi def link ref @string.escape +"hi def link alt Typedef +"hi def link qual Error +"hi def link filter Removed +"hi def link infoInit SpecialKey diff --git a/utils/update_nvim_bg.sh b/utils/update_nvim_bg.sh deleted file mode 100755 index 424bb46..0000000 --- a/utils/update_nvim_bg.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/zsh - -for _pane in $(tmux list-panes -a -F '#{pane_id}'); do - if [[ $(tmux display-message -t $_pane -p -F '#{pane_current_command}') = "nvim" ]]; then - tmux send-keys -t $_pane Escape ':call SetTheme()' Enter - fi -done