initial commit

This commit is contained in:
Tim
2024-08-21 22:20:18 +02:00
commit d40ca7274a
17 changed files with 308 additions and 0 deletions

11
after/plugin/remaps.lua Normal file
View File

@@ -0,0 +1,11 @@
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
vim.keymap.set('n', '<leader>fh', builtin.help_tags, {})
vim.keymap.set('n', '<leader>q', ':q<CR>', {})
vim.keymap.set('n', '<leader>w', ':w<CR>', {})
vim.keymap.set('n', '<leader>c', ':noh<CR>', {})

48
init.lua Normal file
View File

@@ -0,0 +1,48 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
vim.g.mapleader = " "
require("lazy").setup("plugins")
-- line numbers
vim.opt.rnu = true
vim.opt.nu = true
-- search
vim.opt.smartcase = true
vim.opt.ignorecase = true
-- tabstops
vim.opt.ts = 2
vim.opt.sw = 2
--folding
vim.opt.foldmethod = "indent"
vim.opt.foldlevel = 99
--clipboard
vim.opt.clipboard = "unnamedplus"
-- colortheme
vim.opt.termguicolors = true
vim.api.nvim_create_autocmd('TextYankPost', {
-- group = vim.api.nvim_create_augroup('highlight_yank' ),
desc = 'Hightlight selection on yank',
pattern = '*',
callback = function()
vim.highlight.on_yank { higroup = 'IncSearch', timeout = 500 }
end,
})

24
lazy-lock.json Normal file
View File

@@ -0,0 +1,24 @@
{
"LuaSnip": { "branch": "master", "commit": "50fcf17db7c75af80e6b6109acfbfb4504768780" },
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
"conform.nvim": { "branch": "master", "commit": "069e971295a34a810484b7b2ef54b3c735214181" },
"copilot.vim": { "branch": "release", "commit": "1dcaf72099b436b5832d6117d9cd7a4a098a8d77" },
"everforest": { "branch": "master", "commit": "9dbd4d1c3255ed801e515f2ed388f4c6ceb62f6e" },
"lazy.nvim": { "branch": "main", "commit": "eb4957442e3182f051b0ae11da32e06d22c190e3" },
"lsp-zero.nvim": { "branch": "v3.x", "commit": "16de3b18c5f7b6230d89b8e64ce9a4801b6f8d08" },
"lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "8db12610bcb7ce67013cfdfaba4dd47a23c6e851" },
"mason.nvim": { "branch": "main", "commit": "0950b15060067f752fde13a779a994f59516ce3d" },
"nvim-cmp": { "branch": "main", "commit": "5260e5e8ecadaf13e6b82cf867a909f54e15fd07" },
"nvim-comment": { "branch": "main", "commit": "e9ac16ab056695cad6461173693069ec070d2b23" },
"nvim-jdtls": { "branch": "master", "commit": "40e8494e04c1bcd5dd6c0d0bc187d2d10965017d" },
"nvim-lspconfig": { "branch": "master", "commit": "92166b89ab4b3d60f24e58170cac53b7141fd032" },
"nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" },
"nvim-treesitter": { "branch": "master", "commit": "c5cbd3ec74f6f5ddbac939e6f24b99fe78262b4c" },
"nvim-ts-autotag": { "branch": "main", "commit": "6eb4120a1aadef07ac312f1c4bc6456712220007" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "cb064386e667def1d241317deed9fd1b38f0dc2e" },
"nvim-web-devicons": { "branch": "master", "commit": "b4b302d6ae229f67df7a87ef69fa79473fe788a9" },
"oil.nvim": { "branch": "master", "commit": "e5312c3a801e7274fa14e6a56aa10a618fed80c3" },
"plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" },
"telescope.nvim": { "branch": "master", "commit": "54930e1abfc94409e1bb9266e752ef8379008592" }
}

5
lua/plugins/autotag.lua Normal file
View File

@@ -0,0 +1,5 @@
return {
'windwp/nvim-ts-autotag',
lazy = false,
config = true,
}

15
lua/plugins/comment.lua Normal file
View File

@@ -0,0 +1,15 @@
return {
'terrortylor/nvim-comment',
lazy = false,
config = function()
require('nvim_comment').setup({
hook = function()
require('ts_context_commentstring.internal').update_commentstring()
end,
})
end,
dependencies = {
-- To customize commentstring for e.g. svelte files, as the commentstring is depending on cursor position
'JoosepAlviste/nvim-ts-context-commentstring'
}
}

6
lua/plugins/copilot.lua Normal file
View File

@@ -0,0 +1,6 @@
return {
"github/copilot.vim",
config = function()
vim.g.copilot_filetypes = { markdown = true }
end,
}

26
lua/plugins/format.lua Normal file
View File

@@ -0,0 +1,26 @@
return {
'stevearc/conform.nvim',
lazy = false,
opts = {
notify_on_error = true,
formatters_by_ft = {
svelte = { "prettier" },
vue = { "prettier" },
},
format_on_save = {
lsp_fallback = true,
timeout_ms = 1500,
},
},
config = function(_, opts)
local plug = require('conform')
plug.setup(opts)
-- vim.api.nvim_create_autocmd("BufWritePre", {
-- pattern = "*",
-- callback = function(args)
-- plug.format({ bufnr = args.buf })
-- end,
-- })
end,
}

38
lua/plugins/lsp-java.lua Normal file
View File

@@ -0,0 +1,38 @@
return {
'mfussenegger/nvim-jdtls',
layz = false,
config = function()
local home = os.getenv('HOME')
local workspace_folder = home .. "/.local/share/eclipse/" .. vim.fn.fnamemodify(root_dir, ":p:h:t")
local config = {
cmd = {
'/usr/bin/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',
'-Xmx1g',
'--add-modules=ALL-SYSTEM',
'--add-opens', 'java.base/java.util=ALL-UNNAMED',
'--add-opens', 'java.base/java.lang=ALL-UNNAMED',
'-javaagent:/usr/share/java/lombok/lombok.jar',
'-jar', home .. '/.local/share/jdtls/plugins/org.eclipse.equinox.launcher_1.6.500.v20230717-2134.jar',
'-configuration', home .. '/.local/share/jdtls/config_linux',
'-data', workspace_folder
},
root_dir = vim.fs.dirname(vim.fs.find({ 'gradlew', 'mvnw', '.git' }, { upward = true })[1]),
}
vim.api.nvim_create_autocmd("FileType", {
pattern = "java",
callback = function()
require('jdtls').start_or_attach(config)
end
})
end,
}

52
lua/plugins/lsp.lua Normal file
View File

@@ -0,0 +1,52 @@
return {
{
'williamboman/mason.nvim',
lazy = false,
config = true,
},
{
'williamboman/mason-lspconfig.nvim',
lazy = false,
config = function()
local lsp_zero = require('lsp-zero')
lsp_zero.extend_lspconfig()
lsp_zero.on_attach(function(_, bufnr)
-- see :help lsp-zero-keybindings
-- to learn the available actions
lsp_zero.default_keymaps({ buffer = bufnr })
end)
require('mason-lspconfig').setup {
ensure_installed = { 'rust_analyzer', 'lua_ls', 'kotlin_language_server' },
handlers = {
lsp_zero.default_setup,
kotlin_language_server = function()
require('lspconfig').kotlin_language_server.setup({
settings = { kotlin = { compiler = { jvm = { target = "17" } } } }
})
end,
} }
end,
},
{ 'VonHeikemen/lsp-zero.nvim' },
{ 'neovim/nvim-lspconfig' },
{ 'hrsh7th/cmp-nvim-lsp' },
{
'hrsh7th/nvim-cmp',
lazy = false,
config = function()
local cmp = require('cmp')
cmp.setup({
mapping = cmp.mapping.preset.insert({
-- add Ctrl+z to default keymap from lsp-zero as replacement to Ctrl+y on german keyboard layout
['<C-z>'] = cmp.mapping.confirm({ select = true }),
})
})
end
},
{ 'L3MON4D3/LuaSnip' },
}

12
lua/plugins/lualine.lua Normal file
View File

@@ -0,0 +1,12 @@
return {
-- status line
'nvim-lualine/lualine.nvim',
lazy = false,
config = true,
opts = {
options = {
theme = "everforest",
},
},
dependencies = { 'nvim-tree/nvim-web-devicons' }
}

4
lua/plugins/maven.lua Normal file
View File

@@ -0,0 +1,4 @@
return {
-- 'TimsDevCorner/vim-maven-plugin',
-- lazy = false
}

7
lua/plugins/notify.lua Normal file
View File

@@ -0,0 +1,7 @@
return {
'rcarriga/nvim-notify',
lazy = false,
config = function()
vim.notify = require('notify')
end,
}

16
lua/plugins/oil.lua Normal file
View File

@@ -0,0 +1,16 @@
return {
'stevearc/oil.nvim',
lazy = false,
config = function()
require('oil').setup({
view_options = {
show_hidden = true,
sort = {
{ "type", "asc" },
{ "name", "asc" },
},
},
})
vim.keymap.set("n", "-", "<CMD>Oil<CR>", { desc = "Open parent directory" })
end,
}

10
lua/plugins/telescope.lua Normal file
View File

@@ -0,0 +1,10 @@
return {
'nvim-telescope/telescope.nvim',
tag = '0.1.3',
opts = {
defaults = {
path_display = { "smart" },
}
},
dependencies = { 'nvim-lua/plenary.nvim' },
}

View File

@@ -0,0 +1,7 @@
return {
"sainnhe/everforest",
priority = 1000, -- make sure to load this before all the other start plugins
config = function()
vim.cmd([[colorscheme everforest]])
end,
}

View File

@@ -0,0 +1,15 @@
return {
-- "folke/tokyonight.nvim",
-- lazy = false,
-- priority = 1000,
-- opts = {
-- style = "moon",
-- on_colors = function(colors)
-- colors.fg_gutter = colors.orange
-- end,
-- },
-- config = function(_, opts)
-- require('tokyonight').setup(opts)
-- vim.cmd([[colorscheme tokyonight]])
-- end,
}

View File

@@ -0,0 +1,12 @@
return {
"nvim-treesitter/nvim-treesitter",
config = function()
require("nvim-treesitter.configs").setup {
auto_install = true,
highlight = {
enable = true,
},
}
vim.cmd([[TSUpdate]])
end
}