diff --git a/.gitmodules b/.gitmodules index 41a8ccb..db264ea 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "scripts/vim/bundles/vim-plug"] path = scripts/vim/bundles/vim-plug url = https://github.com/junegunn/vim-plug +[submodule "scripts/nvim/bundles/vim-plug"] + path = scripts/nvim/bundles/vim-plug + url = https://github.com/junegunn/vim-plug.git diff --git a/scripts/nvim/bundles/vim-plug b/scripts/nvim/bundles/vim-plug new file mode 160000 index 0000000..d80f495 --- /dev/null +++ b/scripts/nvim/bundles/vim-plug @@ -0,0 +1 @@ +Subproject commit d80f495fabff8446972b8695ba251ca636a047b0 diff --git a/scripts/nvim/init.lua b/scripts/nvim/init.lua new file mode 100644 index 0000000..c9472a2 --- /dev/null +++ b/scripts/nvim/init.lua @@ -0,0 +1,56 @@ +local o = vim.opt + +o.compatible = false +o.number = true + +o.cmdheight = 2 + +o.tabstop = 2 +o.shiftwidth = 2 +o.expandtab = true + +vim.cmd('source ~/.config/nvim/bundles/vim-plug/plug.vim') + +local Plug = vim.fn['plug#'] +vim.call('plug#begin') + +Plug 'prabirshrestha/vim-lsp' +Plug 'mattn/vim-lsp-settings' +Plug 'williamboman/mason.nvim' +Plug 'mfussenegger/nvim-jdtls' + +-- Plug('neoclide/coc.nvim', {branch = 'release'}) + +vim.call('plug#end') + +require('mason').setup() + +-- local executable = vim.fn[': + +vim.api.nvim_create_autocmd({'LspAttach'}, { + pattern = { '*.c', '*.cpp' }, + callback = function() + -- vim.api.nvim_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') + if (vim.fn['executable']('clangd')) then + vim.lsp.start({ + name = 'clangd', + cmd = {'clangd'} + }) + end + + o.omnifunc = vim.lsp.omnifunc + end +}) + +vim.api.nvim_create_autocmd({'FileType'}, { + pattern = { 'java' }, + callback = function() + local config = { + cmd = { vim.fn.expand('~/.local/share/nvim/mason/bin/jdtls') }, + root_dir = vim.fs.dirname(vim.fs.find({ 'gradlew', '.git', 'mvnw' }, { upward = true })[1]), + } + require('jdtls').start_or_attach(config) + o.omnifunc = 'v:lua.vim.lsp.omnifunc' + end +}) + diff --git a/scripts/nvim/lua/testmodule.lua b/scripts/nvim/lua/testmodule.lua new file mode 100644 index 0000000..0457117 --- /dev/null +++ b/scripts/nvim/lua/testmodule.lua @@ -0,0 +1,3 @@ +local foo = 1 + +print(string.format('Hello foo: %d', foo))