From 655f3d0ff215b81ea83efcbb2762143b18a50954 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Sun, 29 Dec 2024 11:19:06 +0100 Subject: [PATCH] Add neovim ftdetect files --- .config/nvim/after/ftplugin/fsharp.vim | 3 + .config/nvim/after/ftplugin/haskell.vim | 6 ++ .config/nvim/after/ftplugin/php.vim | 4 ++ .config/nvim/ftdetect/crontab.vim | 1 + .config/nvim/ftdetect/fsharp.vim | 1 + .config/nvim/ftplugin/cpp.vim | 1 + .config/nvim/ftplugin/css.vim | 4 ++ .config/nvim/ftplugin/dart.lua | 3 + .config/nvim/ftplugin/java.lua | 82 +++++++++++++++++++++++++ .config/nvim/ftplugin/javascript.vim | 4 ++ .config/nvim/ftplugin/less.vim | 4 ++ .config/nvim/ftplugin/ruby.vim | 3 + .config/nvim/ftplugin/typescript.vim | 4 ++ .config/nvim/ftplugin/vue.vim | 4 ++ 14 files changed, 124 insertions(+) create mode 100644 .config/nvim/after/ftplugin/fsharp.vim create mode 100644 .config/nvim/after/ftplugin/haskell.vim create mode 100644 .config/nvim/after/ftplugin/php.vim create mode 100644 .config/nvim/ftdetect/crontab.vim create mode 100644 .config/nvim/ftdetect/fsharp.vim create mode 100644 .config/nvim/ftplugin/cpp.vim create mode 100644 .config/nvim/ftplugin/css.vim create mode 100644 .config/nvim/ftplugin/dart.lua create mode 100644 .config/nvim/ftplugin/java.lua create mode 100644 .config/nvim/ftplugin/javascript.vim create mode 100644 .config/nvim/ftplugin/less.vim create mode 100644 .config/nvim/ftplugin/ruby.vim create mode 100644 .config/nvim/ftplugin/typescript.vim create mode 100644 .config/nvim/ftplugin/vue.vim diff --git a/.config/nvim/after/ftplugin/fsharp.vim b/.config/nvim/after/ftplugin/fsharp.vim new file mode 100644 index 0000000..bae27cf --- /dev/null +++ b/.config/nvim/after/ftplugin/fsharp.vim @@ -0,0 +1,3 @@ +set expandtab +set softtabstop=4 +set shiftwidth=4 diff --git a/.config/nvim/after/ftplugin/haskell.vim b/.config/nvim/after/ftplugin/haskell.vim new file mode 100644 index 0000000..8550e33 --- /dev/null +++ b/.config/nvim/after/ftplugin/haskell.vim @@ -0,0 +1,6 @@ +set tabstop=8 +set expandtab +set softtabstop=4 +set shiftwidth=4 +set shiftround +"setlocal omnifunc=v:lua.vim.lsp.omnifunc diff --git a/.config/nvim/after/ftplugin/php.vim b/.config/nvim/after/ftplugin/php.vim new file mode 100644 index 0000000..39bbcdd --- /dev/null +++ b/.config/nvim/after/ftplugin/php.vim @@ -0,0 +1,4 @@ +setlocal expandtab +setlocal tabstop=4 +setlocal shiftwidth=4 +"setlocal omnifunc=v:lua.vim.lsp.omnifunc diff --git a/.config/nvim/ftdetect/crontab.vim b/.config/nvim/ftdetect/crontab.vim new file mode 100644 index 0000000..d85038e --- /dev/null +++ b/.config/nvim/ftdetect/crontab.vim @@ -0,0 +1 @@ +autocmd filetype crontab setlocal nowritebackup diff --git a/.config/nvim/ftdetect/fsharp.vim b/.config/nvim/ftdetect/fsharp.vim new file mode 100644 index 0000000..530693c --- /dev/null +++ b/.config/nvim/ftdetect/fsharp.vim @@ -0,0 +1 @@ +autocmd BufNewFile,BufRead *.fs,*.fsi set filetype=fsharp diff --git a/.config/nvim/ftplugin/cpp.vim b/.config/nvim/ftplugin/cpp.vim new file mode 100644 index 0000000..0714c3e --- /dev/null +++ b/.config/nvim/ftplugin/cpp.vim @@ -0,0 +1 @@ +setlocal et diff --git a/.config/nvim/ftplugin/css.vim b/.config/nvim/ftplugin/css.vim new file mode 100644 index 0000000..7df8467 --- /dev/null +++ b/.config/nvim/ftplugin/css.vim @@ -0,0 +1,4 @@ +setlocal et +setlocal ts=2 +setlocal sts=2 +setlocal sw=2 diff --git a/.config/nvim/ftplugin/dart.lua b/.config/nvim/ftplugin/dart.lua new file mode 100644 index 0000000..3b57b0b --- /dev/null +++ b/.config/nvim/ftplugin/dart.lua @@ -0,0 +1,3 @@ +vim.bo.expandtab = true +vim.bo.tabstop = 2 +vim.bo.shiftwidth = 2 diff --git a/.config/nvim/ftplugin/java.lua b/.config/nvim/ftplugin/java.lua new file mode 100644 index 0000000..0f2af90 --- /dev/null +++ b/.config/nvim/ftplugin/java.lua @@ -0,0 +1,82 @@ +vim.bo.expandtab = true +vim.bo.tabstop = 4 +vim.bo.shiftwidth = 4 + +require'lsphelp' + +local jdtls_home = os.getenv('HOME') .. '/Projects/lsp/eclipse.jdt.ls/org.eclipse.jdt.ls.product/target/repository' +local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t') +local jdtls = require'jdtls' + +-- The on_attach function is used to set key maps after the language server +-- attaches to the current buffer +local on_attach = function(client, bufnr) + default_on_attach(client, bufnr) + + -- Java extensions provided by jdtls + nnoremap("", jdtls.organize_imports, bufopts, "Organize imports") + nnoremap("ev", jdtls.extract_variable, bufopts, "Extract variable") + nnoremap("ec", jdtls.extract_constant, bufopts, "Extract constant") + vim.keymap.set('v', "em", [[lua require('jdtls').extract_method(true)]], + { noremap=true, silent=true, buffer=bufnr, desc = "Extract method" }) +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, + }, + + -- 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', + + '-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'}), + + -- 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 = {} + }, +} +-- This starts a new client & server, +-- or attaches to an existing client & server depending on the `root_dir`. +jdtls.start_or_attach(config) diff --git a/.config/nvim/ftplugin/javascript.vim b/.config/nvim/ftplugin/javascript.vim new file mode 100644 index 0000000..7df8467 --- /dev/null +++ b/.config/nvim/ftplugin/javascript.vim @@ -0,0 +1,4 @@ +setlocal et +setlocal ts=2 +setlocal sts=2 +setlocal sw=2 diff --git a/.config/nvim/ftplugin/less.vim b/.config/nvim/ftplugin/less.vim new file mode 100644 index 0000000..7df8467 --- /dev/null +++ b/.config/nvim/ftplugin/less.vim @@ -0,0 +1,4 @@ +setlocal et +setlocal ts=2 +setlocal sts=2 +setlocal sw=2 diff --git a/.config/nvim/ftplugin/ruby.vim b/.config/nvim/ftplugin/ruby.vim new file mode 100644 index 0000000..c0899ea --- /dev/null +++ b/.config/nvim/ftplugin/ruby.vim @@ -0,0 +1,3 @@ +setlocal expandtab +setlocal tabstop=2 +setlocal shiftwidth=2 diff --git a/.config/nvim/ftplugin/typescript.vim b/.config/nvim/ftplugin/typescript.vim new file mode 100644 index 0000000..7df8467 --- /dev/null +++ b/.config/nvim/ftplugin/typescript.vim @@ -0,0 +1,4 @@ +setlocal et +setlocal ts=2 +setlocal sts=2 +setlocal sw=2 diff --git a/.config/nvim/ftplugin/vue.vim b/.config/nvim/ftplugin/vue.vim new file mode 100644 index 0000000..7df8467 --- /dev/null +++ b/.config/nvim/ftplugin/vue.vim @@ -0,0 +1,4 @@ +setlocal et +setlocal ts=2 +setlocal sts=2 +setlocal sw=2