Rewrite the remaining neovim config in lua

This commit is contained in:
Eugen Wissner 2025-01-10 18:56:19 +01:00
parent 889af814fc
commit 96b0313c36
Signed by: belka
GPG Key ID: A27FDC1E8EE902C0
6 changed files with 256 additions and 237 deletions

View File

@ -0,0 +1,4 @@
vim.bo.tabstop = 8
vim.bo.expandtab = true
vim.bo.softtabstop = 4
vim.bo.shiftwidth = 4

View File

@ -23,59 +23,59 @@ end
-- See `:help vim.lsp.start_client` for an overview of the supported `config` options.
local config = {
on_attach = on_attach, -- We pass our on_attach keybindings to the configuration map
flags = {
debounce_text_changes = 150,
},
on_attach = on_attach, -- We pass our on_attach keybindings to the configuration map
flags = {
debounce_text_changes = 150,
},
-- The command that starts the language server
-- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line
cmd = {
'java',
-- The command that starts the language server
-- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line
cmd = {
'java',
'-Declipse.application=org.eclipse.jdt.ls.core.id1',
'-Dosgi.bundles.defaultStartLevel=4',
'-Declipse.product=org.eclipse.jdt.ls.core.product',
'-Dlog.protocol=true',
'-Dlog.level=ALL',
'-Xms1g',
'--add-modules=ALL-SYSTEM',
'--add-opens', 'java.base/java.util=ALL-UNNAMED',
'--add-opens', 'java.base/java.lang=ALL-UNNAMED',
'-Declipse.application=org.eclipse.jdt.ls.core.id1',
'-Dosgi.bundles.defaultStartLevel=4',
'-Declipse.product=org.eclipse.jdt.ls.core.product',
'-Dlog.protocol=true',
'-Dlog.level=ALL',
'-Xms1g',
'--add-modules=ALL-SYSTEM',
'--add-opens', 'java.base/java.util=ALL-UNNAMED',
'--add-opens', 'java.base/java.lang=ALL-UNNAMED',
'-jar', jdtls_home .. '/plugins/org.eclipse.equinox.launcher_1.6.900.v20240613-2009.jar',
'-configuration', jdtls_home .. '/config_linux',
'-data', os.getenv('HOME') .. '/.cache/jdtls/' .. project_name
},
'-jar', jdtls_home .. '/plugins/org.eclipse.equinox.launcher_1.6.900.v20240613-2009.jar',
'-configuration', jdtls_home .. '/config_linux',
'-data', os.getenv('HOME') .. '/.cache/jdtls/' .. project_name
},
-- This is the default if not provided, you can remove it. Or adjust as needed.
-- One dedicated LSP server & client will be started per unique root_dir
root_dir = vim.fs.root(0, {'.git', 'mvnw', 'gradlew', 'build.gradle'}),
-- This is the default if not provided, you can remove it. Or adjust as needed.
-- One dedicated LSP server & client will be started per unique root_dir
root_dir = vim.fs.root(0, {'.git', 'mvnw', 'gradlew', 'build.gradle'}),
-- Here you can configure eclipse.jdt.ls specific settings
-- See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request
-- for a list of options
settings = {
java = {
signatureHelp = { enabled = true },
jdt = {
ls = {
androidSupport = { enabled = true },
}
}
}
},
-- Here you can configure eclipse.jdt.ls specific settings
-- See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request
-- for a list of options
settings = {
java = {
signatureHelp = { enabled = true },
jdt = {
ls = {
androidSupport = { enabled = true },
}
}
}
},
-- Language server `initializationOptions`
-- You need to extend the `bundles` with paths to jar files
-- if you want to use additional eclipse.jdt.ls plugins.
--
-- See https://github.com/mfussenegger/nvim-jdtls#java-debug-installation
--
-- If you don't plan on using the debugger or other eclipse.jdt.ls plugins you can remove this
init_options = {
bundles = {}
},
-- Language server `initializationOptions`
-- You need to extend the `bundles` with paths to jar files
-- if you want to use additional eclipse.jdt.ls plugins.
--
-- See https://github.com/mfussenegger/nvim-jdtls#java-debug-installation
--
-- If you don't plan on using the debugger or other eclipse.jdt.ls plugins you can remove this
init_options = {
bundles = {}
}
}
-- This starts a new client & server,
-- or attaches to an existing client & server depending on the `root_dir`.

View File

@ -0,0 +1,3 @@
vim.bo.expandtab = true
vim.bo.tabstop = 4
vim.bo.shiftwidth = 4

112
.config/nvim/init.lua Normal file
View File

@ -0,0 +1,112 @@
vim.opt.tabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = false
vim.opt.ignorecase = true
vim.opt.smartcase = true
vim.opt.ruler = true
vim.opt.backup = false
vim.opt.number = true
vim.opt.colorcolumn = "120"
vim.opt.exrc = true
vim.opt.secure = true
vim.opt.hidden = true
vim.opt.completeopt = { 'menu', 'menuone', 'noselect' }
vim.opt.shortmess:append('c')
-- Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
-- delays and poor user experience.
vim.opt.updatetime = 300
-- Always show the signcolumn, otherwise it would shift the text each time
-- diagnostics appear/become resolved.
-- Recently vim can merge signcolumn and number column into one
vim.opt.signcolumn = 'yes'
vim.opt.mouse = 'a' -- " Enable mouse in all modes.
--
-- Packer
--
vim.cmd [[packadd packer.nvim]]
require'packer'.startup(function()
-- Packer can manage itself
use 'wbthomason/packer.nvim'
use 'mfussenegger/nvim-dap'
use 'airblade/vim-gitgutter'
use 'neovim/nvim-lspconfig'
use 'dense-analysis/ale'
use 'liuchengxu/vista.vim' -- Tag bar.
use {
'nvim-treesitter/nvim-treesitter',
run = ':TSUpdate'
}
-- Git.
use 'tpope/vim-fugitive'
use {
'sindrets/diffview.nvim',
requires = {'nvim-lua/plenary.nvim'}
}
-- File browser.
use {
'kyazdani42/nvim-tree.lua',
requires = {'nvim-tree/nvim-web-devicons'} -- optional, for file icon
}
use {
'nvim-telescope/telescope.nvim',
requires = {'nvim-lua/plenary.nvim'}
}
use 'nvim-telescope/telescope-ui-select.nvim'
use {
'kevinhwang91/nvim-ufo',
requires = {'kevinhwang91/promise-async'}
}
-- Theme.
use 'qaptoR-nvim/chocolatier.nvim'
use {
'nvim-lualine/lualine.nvim',
requires = {'nvim-tree/nvim-web-devicons'} -- optional, for status line icons
}
-- Syntax.
use 'leafOfTree/vim-vue-plugin'
use 'mfussenegger/nvim-jdtls'
use 'dart-lang/dart-vim-plugin'
use {
'akinsho/flutter-tools.nvim',
requires = {
'nvim-lua/plenary.nvim'
}
}
use 'vim-vdebug/vdebug'
-- nvim-cmp
use 'dcampos/nvim-snippy'
use 'hrsh7th/cmp-nvim-lsp'
use 'hrsh7th/nvim-cmp'
use 'dcampos/cmp-snippy'
use 'hrsh7th/cmp-path'
use 'hrsh7th/cmp-buffer'
end)
require'plugins'
require'lspserver'
--
-- Theme
--
vim.cmd('colorscheme chocolatier')
vim.opt.termguicolors = true
-- Mappings.
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
local opts = { noremap = true, silent = true }
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)

View File

@ -0,0 +1,77 @@
require'lsphelp'
local nvim_lsp = require('lspconfig')
nvim_lsp['hls'].setup {
on_attach = default_on_attach,
capabilities = capabilities,
flags = {
debounce_text_changes = 150,
},
settings = {
haskell = {
plugin = {
stan = {
globalOn = false
}
}
}
}
}
nvim_lsp['intelephense'].setup {
on_attach = default_on_attach,
flags = {
debounce_text_changes = 150
},
init_options = {
licenceKey = os.getenv('HOME') .. '/Documents/Schluessel/intelephense.key',
storagePath = '/tmp/intelephense'
},
capabilities = capabilities,
settings = {
intelephense = {
environment = {
phpVersion = '8.2.0'
}
}
}
}
nvim_lsp['clangd'].setup {
on_attach = default_on_attach,
capabilities = capabilities
}
require("flutter-tools").setup {
outline = {
open_cmd = "Vista"
},
lsp = {
on_attach = default_on_attach,
capabilities = capabilities
}
}
nvim_lsp['twiggy_language_server'].setup {
on_attach = default_on_attach,
capabilities = capabilities,
settings = {
twiggy = {
framework = 'symfony',
phpExecutable = '/usr/bin/php',
symfonyConsolePath = 'bin/console',
diagnostics = {
twigCsFixer = false
}
}
}
}
vim.g.vim_vue_plugin_config = {
syntax = {
template = {'html'},
script = {'javascript'},
style = {'css'},
},
full_syntax = {},
initial_indent = {},
attribute = 0,
keyword = 0,
foldexpr = 0,
debug = 0
}

View File

@ -1,98 +1,3 @@
set ts=4
set sw=4
set noet
set ignorecase
set smartcase
set ruler
set nobackup
set number
set colorcolumn=120
set exrc
set secure
set hidden
"set completeopt=menuone,noinsert,noselect
set completeopt=menu,menuone,noselect
set shortmess+=c
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
" delays and poor user experience.
set updatetime=300
" Always show the signcolumn, otherwise it would shift the text each time
" diagnostics appear/become resolved.
" Recently vim can merge signcolumn and number column into one
set signcolumn=yes
set mouse=a " Enable mouse in all modes.
lua << EOF
require'lsphelp'
--
-- Packer
--
vim.cmd [[packadd packer.nvim]]
require('packer').startup(function()
-- Packer can manage itself
use 'wbthomason/packer.nvim'
use 'mfussenegger/nvim-dap'
use 'airblade/vim-gitgutter'
use 'neovim/nvim-lspconfig'
use 'dense-analysis/ale'
use 'liuchengxu/vista.vim' -- Tag bar.
-- Git.
use 'tpope/vim-fugitive'
use {
'sindrets/diffview.nvim',
requires = {'nvim-lua/plenary.nvim'}
}
-- File browser.
use {
'kyazdani42/nvim-tree.lua',
requires = {'nvim-tree/nvim-web-devicons'} -- optional, for file icon
}
use {
'nvim-telescope/telescope.nvim',
requires = {'nvim-lua/plenary.nvim'}
}
use 'nvim-telescope/telescope-ui-select.nvim'
use {
'kevinhwang91/nvim-ufo',
requires = {'kevinhwang91/promise-async'}
}
-- Theme.
use 'EdenEast/nightfox.nvim'
-- Status line.
use {
'nvim-lualine/lualine.nvim',
requires = {'nvim-tree/nvim-web-devicons'} -- optional, for status line icons
}
-- Syntax.
use 'leafOfTree/vim-vue-plugin'
use 'mfussenegger/nvim-jdtls'
use 'dart-lang/dart-vim-plugin'
use {
'akinsho/flutter-tools.nvim',
requires = {
'nvim-lua/plenary.nvim'
}
}
use 'vim-vdebug/vdebug'
-- nvim-cmp
use 'dcampos/nvim-snippy'
use 'hrsh7th/cmp-nvim-lsp'
use 'hrsh7th/nvim-cmp'
use 'dcampos/cmp-snippy'
use 'hrsh7th/cmp-path'
use 'hrsh7th/cmp-buffer'
end)
--
-- ALE
--
@ -161,94 +66,6 @@ capabilities.textDocument.foldingRange = {
lineFoldingOnly = true
}
--
-- LSPConfig
--
local nvim_lsp = require('lspconfig')
-- Mappings.
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
local opts = { noremap=true, silent=true }
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
nvim_lsp['hls'].setup {
on_attach = default_on_attach,
capabilities = capabilities,
flags = {
debounce_text_changes = 150,
},
settings = {
haskell = {
plugin = {
stan = {
globalOn = false
}
}
}
}
}
nvim_lsp['intelephense'].setup {
on_attach = default_on_attach,
flags = {
debounce_text_changes = 150
},
init_options = {
licenceKey = os.getenv('HOME') .. '/Documents/Schluessel/intelephense.key',
storagePath = '/tmp/intelephense'
},
capabilities = capabilities,
settings = {
intelephense = {
environment = {
phpVersion = '8.2.0'
}
}
}
}
nvim_lsp['clangd'].setup {
on_attach = default_on_attach,
capabilities = capabilities
}
require("flutter-tools").setup {
outline = {
open_cmd = "Vista"
},
lsp = {
on_attach = default_on_attach,
capabilities = capabilities
}
}
nvim_lsp['twiggy_language_server'].setup {
on_attach = default_on_attach,
capabilities = capabilities,
settings = {
twiggy = {
framework = 'symfony',
phpExecutable = '/usr/bin/php',
symfonyConsolePath = 'bin/console',
diagnostics = {
twigCsFixer = false
}
}
}
}
vim.g.vim_vue_plugin_config = {
syntax = {
template = {'html'},
script = {'javascript'},
style = {'css'},
},
full_syntax = {},
initial_indent = {},
attribute = 0,
keyword = 0,
foldexpr = 0,
debug = 0
}
--
-- Telescope
--
@ -280,12 +97,6 @@ vim.api.nvim_set_keymap('n', '<C-n>', ':NvimTreeToggle<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>r', ':NvimTreeRefresh<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>n', ':NvimTreeFindFile<CR>', { noremap = true })
--
-- Theme
--
vim.cmd('colorscheme duskfox')
vim.opt.termguicolors = true
--
-- Lualine
--
@ -371,4 +182,16 @@ dap.configurations.cpp = {
--
vim.g.vdebug_options = { port = '9000' }
EOF
--
-- Treesitter
--
require'nvim-treesitter.configs'.setup {
ensure_installed = { 'haskell', 'php', 'lua' },
highlight = {
enable = true,
additional_vim_regex_highlighting = false
},
indent = {
enable = true
}
}