diff --git a/lua/technoduck/init.lua b/lua/technoduck/init.lua index 6a26e63..3253055 100644 --- a/lua/technoduck/init.lua +++ b/lua/technoduck/init.lua @@ -34,6 +34,7 @@ vim.g.netrw_winsize = 25 'python', 'rust', 'c', + 'lammps', 'lua', 'vim', 'vimdoc', @@ -47,3 +48,26 @@ vim.g.netrw_winsize = 25 vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" end, }) + + +vim.api.nvim_create_autocmd('User', { pattern = 'TSUpdate', + callback = function() + + require('nvim-treesitter.parsers').lammps = { + install_info = { + url = 'https://github.com/ECHOUniverse/tree-sitter-lammps', -- local path or git repo + files = { 'src/parser.c', 'src/scanner.c' }, -- note that some parsers also require src/scanner.c or src/scanner.cc + -- optional entries: + branch = 'main', -- default branch in case of git repo if different from master + generate = false, + generate_from_json = false, + }, + filetype = 'lammps', -- if filetype does not match the parser name + } + end + + +}) + + + diff --git a/lua/technoduck/lazy_plugins/lammps.lua b/lua/technoduck/lazy_plugins/lammps.lua new file mode 100644 index 0000000..8276f17 --- /dev/null +++ b/lua/technoduck/lazy_plugins/lammps.lua @@ -0,0 +1,17 @@ +return { + + vim.filetype.add { + extension = { + lmp = 'lammps', + }, + + pattern = { + -- These are lua matching patterns, not regex + ['.*%.lmp'] = 'lammps', + ['in%..*'] = 'lammps', + ['.*%.in'] = 'lammps', + }, + } + + +} diff --git a/lua/technoduck/lazy_plugins/lsp.lua b/lua/technoduck/lazy_plugins/lsp.lua index 88f5d47..6e9e9cc 100644 --- a/lua/technoduck/lazy_plugins/lsp.lua +++ b/lua/technoduck/lazy_plugins/lsp.lua @@ -30,7 +30,6 @@ return { ensure_installed = { 'lua_ls', 'rust_analyzer', - 'lua_ls', 'marksman', 'jedi_language_server', 'fortls', @@ -141,6 +140,25 @@ return { cmd = { "rust-analyzer" } }) + vim.lsp.config('lmp_lsp', { + filetypes = {'lammps'}, + workspace = false, + root_markers = { 'init.lmp' }, + capabilities = { + + textDocument = { + semanticTokens = { + + multilineTokenSupport = true, + + } + + } + + } + }) + + vim.lsp.enable('lmp_lsp') local cmp = require('cmp') local cmp_autopairs = require('nvim-autopairs.completion.cmp') @@ -197,7 +215,8 @@ return { { name = 'luasnip' }, -- For luasnip users. }, { { name = 'buffer' }, - }) + } + ) }) cmp.setup.cmdline({ '/', '?' }, { mapping = cmp.mapping.preset.cmdline(), diff --git a/lua/technoduck/lazy_plugins/treesitter.lua b/lua/technoduck/lazy_plugins/treesitter.lua index 2d28542..7937e64 100644 --- a/lua/technoduck/lazy_plugins/treesitter.lua +++ b/lua/technoduck/lazy_plugins/treesitter.lua @@ -4,19 +4,27 @@ return { build = ":TSUpdate", lazy = false, config = function() + + + + + + + local nvimt = require('nvim-treesitter') nvimt.install({"javascript", - "typescript", - "python", - "rust", - "c", - "lua", - "vim", - "vimdoc", - "toml", - "query", - "markdown", - "markdown_inline", - 'doxygen' }) - end} + "typescript", + "python", + "rust", + "c", + "lua", + "vim", + "vimdoc", + "toml", + "query", + "markdown", + "markdown_inline", + 'doxygen' }) + end, +}