diff --git a/ftplugin/java.lua b/ftplugin/java.lua index d726326..e52b79f 100644 --- a/ftplugin/java.lua +++ b/ftplugin/java.lua @@ -19,10 +19,8 @@ keymap('n', 'jt', "lua require'jdtls'.test_nearest_method()", o keymap('n', 'jT', "lua require'jdtls'.test_class()", opts) keymap('n', 'ju', 'JdtUpdateConfig', opts) -keymap('v', 'jv', "lua require('jdtls').extract_variable(true)", - opts) -keymap('v', 'jc', "lua require('jdtls').extract_constant(true)", - opts) +keymap('v', 'jv', "lua require('jdtls').extract_variable(true)", opts) +keymap('v', 'jc', "lua require('jdtls').extract_constant(true)", opts) keymap('v', 'jm', "lua require('jdtls').extract_method(true)", opts) vim.opt_local.shiftwidth = 2 @@ -77,16 +75,13 @@ JAVA_DAP_ACTIVE = true local bundles = { vim.fn.glob( home - .. '/.local/share/nvim/mason/packages/java-debug-adapter/extension/server/com.microsoft.java.debug.plugin-*.jar' + .. '/.local/share/nvim/mason/packages/java-debug-adapter/extension/server/com.microsoft.java.debug.plugin-*.jar' ), } vim.list_extend( bundles, - vim.split( - vim.fn.glob(home .. - '/.local/share/nvim/mason/packages/java-test/extension/server/*.jar'), - '\n') + vim.split(vim.fn.glob(home .. '/.local/share/nvim/mason/packages/java-test/extension/server/*.jar'), '\n') ) local config = { @@ -103,9 +98,9 @@ local config = { '-Declipse.product=org.eclipse.jdt.ls.core.product', '-Dlog.protocol=true', '-Dlog.level=ALL', - '-javaagent:' .. - home .. '/.local/share/nvim/mason/packages/jdtls/lombok.jar', - '-Xms1g', + '-javaagent:' .. home .. '/.local/share/nvim/mason/packages/jdtls/lombok.jar', + '-Xmx512m', + '-Xms100m', '--add-modules=ALL-SYSTEM', '--add-opens', 'java.base/java.util=ALL-UNNAMED', @@ -114,8 +109,7 @@ local config = { -- 💀 '-jar', - vim.fn.glob(home .. - '/.local/share/nvim/mason/packages/jdtls/plugins/org.eclipse.equinox.launcher_*.jar'), + vim.fn.glob(home .. '/.local/share/nvim/mason/packages/jdtls/plugins/org.eclipse.equinox.launcher_*.jar'), -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ -- Must point to the Change this to -- eclipse.jdt.ls installation the actual version @@ -186,8 +180,7 @@ local config = { }, codeGeneration = { toString = { - template = - '${object.className}{${member.name()}=${member.value}, ${otherMembers}}', + template = '${object.className}{${member.name()}=${member.value}, ${otherMembers}}', }, useBlocks = true, }, diff --git a/lua/config/autocmd.lua b/lua/config/autocmd.lua index 3415711..63d152f 100644 --- a/lua/config/autocmd.lua +++ b/lua/config/autocmd.lua @@ -10,8 +10,8 @@ vim.api.nvim_create_autocmd({ 'FileType' }, { vim.api.nvim_create_autocmd({ 'FileType' }, { pattern = { 'cpp', 'cc', 'hpp', 'hh', 'md', 'markdown', 'java' }, callback = function() - vim.opt.ts = 2 - vim.opt.sw = 2 + vim.opt.ts = 4 + vim.opt.sw = 4 vim.opt.expandtab = true end, }) @@ -73,3 +73,10 @@ vim.cmd [[ au ExitPre * :set guicursor=a:hor90 augroup END ]] + +-- Fixes Autocomment +vim.api.nvim_create_autocmd({ 'BufWinEnter' }, { + callback = function() + vim.cmd 'set formatoptions-=cro' + end, +}) diff --git a/lua/config/mappings.lua b/lua/config/mappings.lua index 7aa3fa7..56188ad 100644 --- a/lua/config/mappings.lua +++ b/lua/config/mappings.lua @@ -270,7 +270,7 @@ local mappings = { }, l = { name = 'LSP', - l = { 'Lazy load lsp LspStart ', 'Start LSP' }, + l = { 'Lazy load none-ls.nvim lsp LspStart ', 'Start LSP' }, f = { 'lua vim.lsp.buf.format { async = true }', 'Format' }, i = 'Lsp Info', a = 'Code action', diff --git a/lua/config/options.lua b/lua/config/options.lua index ecabd11..33fdc7a 100644 --- a/lua/config/options.lua +++ b/lua/config/options.lua @@ -4,7 +4,7 @@ local opt = vim.opt g.mapleader = ' ' g.tex_flavor = 'latex' g.c_syntax_for_h = true -vim.cmd([[ +vim.cmd [[ let g:VM_default_mappings = 0 let g:VM_mouse_mappings = 1 let g:VM_leader = {'default': ',', 'visual': ',', 'buffer': ','} @@ -32,7 +32,7 @@ let g:nvimgdb_config_override = { \ 'key_breakpoint': 'b', \ 'set_tkeymaps': "NvimGdbNoTKeymaps", \ } -]]) +]] opt.termguicolors = true opt.mouse = 'nv' @@ -59,6 +59,7 @@ opt.grepprg = 'rg --vimgrep --no-heading --smart-case --hidden' opt.grepformat = '%f:%l:%c:%m' opt.cursorline = true opt.cursorlineopt = 'number' +vim.opt.formatoptions:remove("c") vim.api.nvim_create_user_command('Cd', 'lcd %:p:h', { nargs = 0 }) vim.api.nvim_create_user_command('Grep', 'silent grep! | TroubleToggle quickfix', { nargs = '+' }) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index b24fec0..3a67ea5 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -8,12 +8,12 @@ return { { 'mg979/vim-visual-multi', event = 'VeryLazy' }, { 'rush-rs/tree-sitter-asm', ft = 'asm' }, { 'jghauser/mkdir.nvim', lazy = false }, - { - 'jakewvincent/mkdnflow.nvim', - dependencies = 'nvim-lua/plenary.nvim', - ft = 'markdown', - opts = {}, - }, + -- { + -- 'jakewvincent/mkdnflow.nvim', + -- dependencies = 'nvim-lua/plenary.nvim', + -- ft = 'markdown', + -- opts = {}, + -- }, { 'glepnir/dbsession.nvim', cmd = { 'SessionSave', 'SessionDelete', 'SessionLoad' }, diff --git a/lua/plugins/none-ls.lua b/lua/plugins/none-ls.lua new file mode 100644 index 0000000..0fda725 --- /dev/null +++ b/lua/plugins/none-ls.lua @@ -0,0 +1,58 @@ +return { + 'nvimtools/none-ls.nvim', + config = function() + local null_ls = require 'null-ls' + + -- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting + local formatting = null_ls.builtins.formatting + -- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics + local diagnostics = null_ls.builtins.diagnostics + + null_ls.setup { + debug = false, + sources = { + formatting.prettier.with { extra_args = { '--no-semi', '--single-quote', '--jsx-single-quote' } }, + formatting.black.with { extra_args = { '--fast' } }, + formatting.stylua.with { extra_args = { '--quote-style=AutoPreferSingle', '--call-parentheses=None' } }, + -- formatting.clang_format.with { + -- filetypes = { 'c' }, + -- extra_args = { + -- '--style', + -- '{BasedOnStyle: LLVM, IndentWidth: 8, UseTab: Always, BreakBeforeBraces: Linux, AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: false, AlwaysBreakAfterReturnType: AllDefinitions}', + -- -- '{AccessModifierOffset : -2, AllowShortIfStatementsOnASingleLine : Never, AlignConsecutiveMacros : true, AllowShortLoopsOnASingleLine : false, AlwaysBreakTemplateDeclarations : true, Standard : c++20, NamespaceIndentation : All, IndentWidth : 4, TabWidth : 4, BreakBeforeBraces : Linux, AllowShortFunctionsOnASingleLine : Empty, AllowShortBlocksOnASingleLine : Never, FixNamespaceComments : true, PointerAlignment : Right, ColumnLimit : 120, ContinuationIndentWidth : 2, UseTab : Always }', + -- }, + -- }, + -- formatting.clang_format.with { + -- filetypes = { 'cpp' }, + -- extra_args = { + -- '--style', + -- 'google', + -- }, + -- }, + formatting.beautysh, + formatting.latexindent, + formatting.goimports, + formatting.gofumpt, + formatting.sql_formatter, + diagnostics.golangci_lint.with { + extra_args = { + '-E', + 'revive', + '-E', + 'errcheck', + '-E', + 'gosec', + '-E', + 'nilerr', + '-E', + 'nlreturn', + }, + }, + formatting.asmfmt.with { + filetypes = { 'asm', 's' }, + }, + -- diagnostics.flake8 + }, + } + end, +}