Compare commits

...

45 Commits

Author SHA1 Message Date
82af4d91d4 find rust-analyzer automatically and display error when not found 2025-09-22 09:50:27 +02:00
f0378b57e6 Update rustaceanvim 2025-09-22 09:40:07 +02:00
c62cbcd80d Update 22.09.2025 replace require('lspconfig') with vim.lsp.config(...) 2025-09-22 08:52:08 +02:00
b0e4d0b4be Remove opencode, ignore doc folder in telescope, remove :W, add mask as runner 2025-08-21 11:58:46 +02:00
4717d2726c Fix opencode plugin not sending message to opencode 2025-08-11 10:21:39 +02:00
f14f03bd88 Fixed copy/paste on wsl, added opencode and minuet 2025-08-11 09:55:50 +02:00
1d563ec9d4 Update 23.05.25 2025-05-23 18:49:36 +02:00
8de9de662f Update 24.03.25 2025-03-24 10:47:38 +01:00
14edeb2713 Add autocommand to run just on :make when justfile is present and add ccls 2025-02-05 16:01:30 +01:00
92a6cfc071 Update 08.12.24 2024-12-08 11:50:40 +01:00
89e118f1a1 Update plugins 2024-12-05 07:58:38 +01:00
670ecf53dd Changed emmet lsp, silenced repeated key warning from which-key, fixed annoying rust-analyzer error 2024-12-05 07:53:24 +01:00
4c81d0b05b Folding kinda annoying on smaller projects ie. AoC. Add lsp for wgsl and glsl 2024-11-04 07:49:39 +01:00
a56b8f7029 Try folds and some other changes 2024-10-16 15:56:59 +02:00
Fabian Schmidt
50b8c88e92 Go back to old colorpicker theme but use preview 2024-09-18 11:34:35 +02:00
Fabian Schmidt
9ce77dacc9 Update packages 2024-09-18 08:58:49 +02:00
Fabian Schmidt
c9bcbf2327 Add keymap to open the keymap search in telescope 2024-09-17 16:28:18 +02:00
Fabian Schmidt
e3762ced4e Add descriptions to telescope keymaps and removed viml, change style of colorscheme selection 2024-09-17 16:13:48 +02:00
Fabian Schmidt
8b714fabfa Add which-key plugin and descriptions for all custom keymaps 2024-09-17 14:49:38 +02:00
Fabian Schmidt
9b831f0e3a Add selectors for textobjects function and class and move for parameters, and cursor context 2024-09-17 13:11:06 +02:00
Fabian Schmidt
f942ea2f91 Use telescope to display references, diagnostics and code actions 2024-09-17 12:44:51 +02:00
Fabian Schmidt
b366437a6a Add julia lsp 2024-09-17 07:53:21 +02:00
Fabian Schmidt
fbbd0c5512 Made background slightly lighter, less yellow 2024-09-02 08:41:05 +02:00
Fabian Schmidt
4f2c968b33 added jdtls, need to play with it some more to add missing keymaps and
dap (need to properly configure dap anyway)

remove nvim-tree
remove goyo and limelight commands and keymaps
2024-08-13 11:49:16 +02:00
Fabian Schmidt
11763243dc Update everything and add light theme modifications for kanagawa 2024-08-13 07:47:26 +02:00
e777391307 get $HOME instead of setting home_dir manually 2024-03-02 15:11:55 +01:00
Fabian Schmidt
9f6b6776c2 added trouble.nvim 2024-01-18 12:43:07 +01:00
Fabian Schmidt
8c82f7cab4 replace rust-tools with rustaceanvim 2024-01-17 15:10:36 +01:00
Fabian Schmidt
4da8e11ada Update 04.01.24 2024-01-04 20:45:30 +01:00
Fabian Schmidt
ac2447ac6e Update 03.01.24 2024-01-03 13:17:03 +01:00
Fabian Schmidt
fd5401c9d7 Removed null-ls and some other stuff 2023-09-23 14:54:20 +02:00
Fabian Schmidt
1d2cd23307 update lazy-lock.json 2023-04-03 12:45:17 +02:00
Fabian Schmidt
40303719a2 commit config for lua lsp 2023-04-03 12:42:22 +02:00
Fabian Schmidt
b2f02b5c13 add dap for rust 2023-04-03 12:40:26 +02:00
Fabian Schmidt
afcce108f7 fix kdl not being detected properly 2023-04-03 12:39:50 +02:00
Fabian Schmidt
46edb66356 add colorscheme 2023-04-03 12:37:50 +02:00
Fabian Schmidt
cc9fc11a62 Fix lua vim awareness, enable prettier, fix gitsigns
- Make lua aware of vim runtime
- enable prettier for json, html, css, yaml, markdown
- gitsigns was not enabled
2023-03-03 11:42:58 +01:00
Fabian Schmidt
a4e6919899 Reenable fidget 2023-02-26 13:34:44 +01:00
4fc013a680 Merge pull request 'lazy' (#1) from lazy into master
Reviewed-on: fapmaster/nvim#1
2023-02-26 13:29:13 +01:00
Fabian Schmidt
aa72c826c0 Moved lsp config into plugin file 2023-02-26 13:20:49 +01:00
Fabian Schmidt
717c7f09e5 First draft after switching to lazy.nvim 2023-02-24 21:11:27 +01:00
Fabian Schmidt
6a51019731 Don't remember what smartindent = true does
Theme looks like shit for html
Added tailwindcss lsp for future use
Add diagnostics shortcuts
2023-02-02 11:30:29 +01:00
Fabian Schmidt
7cffe20d81 Darcula looks weid since last (treesitter?) upgrade. Added a few colorschemes and shortcut to access them 2022-10-29 14:22:42 +02:00
Fabian Schmidt
966adc7817 Update cmp. Add sql, html and css lsp functionality. Add snippet for go error handling. Enable Treesitter for syntax highlighting 2022-10-26 12:39:08 +02:00
Fabian Schmidt
fe9da6af57 Add bashls and format using formatter built into lua lsp 2022-10-18 17:42:03 +02:00
20 changed files with 979 additions and 421 deletions

19
.luarc.json Normal file
View File

@@ -0,0 +1,19 @@
{
"workspace.library": [
"/Users/fschmidt/.config/nvim",
"/Users/fschmidt/.local/share/nvim/lazy/lazy.nvim",
"/Users/fschmidt/.local/share/nvim/lazy/cmp-nvim-lsp",
"/Users/fschmidt/.local/share/nvim/lazy/nvim-lspconfig",
"/Users/fschmidt/.local/share/nvim/lazy/mason.nvim",
"/Users/fschmidt/.local/share/nvim/lazy/mason-lspconfig.nvim",
"/Users/fschmidt/.local/share/nvim/lazy/nvim-web-devicons",
"/Users/fschmidt/.local/share/nvim/lazy/nvim-tree.lua",
"/Users/fschmidt/.local/share/nvim/lazy/null-ls.nvim",
"/Users/fschmidt/.local/share/nvim/lazy/lualine.nvim",
"/usr/local/Cellar/neovim/0.8.3/share/nvim/runtime",
"/usr/local/Cellar/neovim/0.8.3/lib/nvim",
"/Users/fschmidt/.local/state/nvim/lazy/readme",
"/Users/fschmidt/.local/share/nvim/lazy/cmp-nvim-lsp/after",
"${3rd}/luassert/library"
]
}

9
after/ftplugin/rust.lua Normal file
View File

@@ -0,0 +1,9 @@
for _, method in ipairs({ 'textDocument/diagnostic', 'workspace/diagnostic' }) do
local default_diagnostic_handler = vim.lsp.handlers[method]
vim.lsp.handlers[method] = function(err, result, context, config)
if err ~= nil and err.code == -32802 then
return
end
return default_diagnostic_handler(err, result, context, config)
end
end

View File

@@ -1,6 +1,60 @@
-- init.lua
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")
require("commands")
require'plugins'
require'settings'.init()
require'maps'.init()
require'commands'
vim.opt.backup = false
vim.opt.undodir = os.getenv("HOME") .. '/.cache/nvim/undodir'
vim.opt.swapfile = false
vim.opt.undofile = true
vim.opt.smartcase = true
vim.opt.ignorecase = true
vim.opt.laststatus = 2
vim.opt.hidden = true
vim.opt.hlsearch = false
vim.opt.incsearch = true
vim.opt.scrolloff = 12
vim.opt.sidescrolloff = 8
vim.opt.mouse = 'a'
vim.opt.autochdir = false
vim.opt.clipboard = 'unnamed,unnamedplus'
in_wsl = os.getenv('WSL_DISTRO_NAME') ~= nil
if in_wsl then
vim.g.clipboard = {
name = 'wsl clipboard',
copy = { ["+"] = { "clip.exe" }, ["*"] = { "clip.exe" } },
paste = { ["+"] = { "win32yank.exe" }, ["*"] = { "win32yank.exe" } },
cache_enabled = true
}
end
vim.opt.number = true
vim.opt.wrap = false
vim.opt.signcolumn = 'yes:2'
vim.opt.list = true
vim.opt.listchars = 'tab:▸ ,trail:·'
vim.opt.shiftwidth = 4
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.expandtab = false
vim.opt.autoindent = true
vim.opt.smartindent = true
vim.opt.completeopt = { "menu", "menuone", "noselect" }
--vim.opt.foldmethod = "expr"
--vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
--vim.opt.foldtext = ""
--vim.opt.foldlevelstart = 1
--vim.opt.foldnestmax = 2
-- TODO replace config with opts in every plugin

41
lazy-lock.json Normal file
View File

@@ -0,0 +1,41 @@
{
"LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" },
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
"cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" },
"cmp-nvim-lsp": { "branch": "main", "commit": "bd5a7d6db125d4654b50eeae9f5217f24bb22fd3" },
"cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" },
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"fidget.nvim": { "branch": "main", "commit": "b45d21d33d61ed9295308eb6571c0a5f0f7f3765" },
"gitsigns.nvim": { "branch": "main", "commit": "f780609807eca1f783a36a8a31c30a48fbe150c5" },
"kanagawa.nvim": { "branch": "master", "commit": "debe91547d7fb1eef34ce26a5106f277fbfdd109" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"lspkind-nvim": { "branch": "master", "commit": "3ddd1b4edefa425fda5a9f95a4f25578727c0bb3" },
"lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" },
"lunar.nvim": { "branch": "master", "commit": "08bbc93b96ad698d22fc2aa01805786bcedc34b9" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "a1067cf84b4ff81b66d2bf4d01f4cbdb5de40bd0" },
"mason.nvim": { "branch": "main", "commit": "7dc4facca9702f95353d5a1f87daf23d78e31c2a" },
"minuet-ai.nvim": { "branch": "main", "commit": "2083b86ea01cb18dc9e7cb7a68f932ea06e999e8" },
"mssql.nvim": { "branch": "main", "commit": "51bf5e8629c2f0153160e36afb57a3743b9b6fd9" },
"nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" },
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
"nvim-dap": { "branch": "master", "commit": "7367cec8e8f7a0b1e4566af9a7ef5959d11206a7" },
"nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" },
"nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" },
"nvim-jdtls": { "branch": "master", "commit": "b69924ca90014fef485ee153571bdcbc1ece8c2e" },
"nvim-lspconfig": { "branch": "master", "commit": "ef73a4f2a1ddf0439eb97b46de2aab265ddba1cd" },
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-treesitter-context": { "branch": "master", "commit": "41847d3dafb5004464708a3db06b14f12bde548a" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "71385f191ec06ffc60e80e6b0c9a9d5daed4824c" },
"nvim-web-devicons": { "branch": "master", "commit": "6e51ca170563330e063720449c21f43e27ca0bc1" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"rustaceanvim": { "branch": "master", "commit": "12504405821c05874d2d1f6b5ec919f9808e2c99" },
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
"trouble.nvim": { "branch": "main", "commit": "f176232e7759c4f8abd923c21e3e5a5c76cd6837" },
"vimwiki": { "branch": "dev", "commit": "72792615e739d0eb54a9c8f7e0a46a6e2407c9e8" },
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
}

View File

@@ -1,10 +1,54 @@
-- commands.lua
vim.cmd 'autocmd! User GoyoEnter Limelight'
vim.cmd 'autocmd! User GoyoLeave Limelight!'
vim.cmd 'autocmd BufRead,BufNewFile *.wiki,*.md,*.tex set wrap'
vim.cmd 'au BufRead,BufNewFile *.kdl set filetype=kdl'
vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]]
vim.cmd 'command W :execute \':silent w !sudo tee % > /dev/null\' | :edit!'
-- I don't know why but whenever I accidentally type :W instead of :w, I slows down the ide and reverts all changes
-- It doesn't even save files with sudo...
-- vim.cmd 'command W :execute \':silent w !sudo tee % > /dev/null\' | :edit!'
-- Array of file names indicating root directory. Modify to your liking.
local root_names = { '.git', 'Makefile', 'justfile', 'CMakeLists.txt', 'maskfile.md' }
-- Cache to use for speed up (at cost of possibly outdated results)
local root_cache = {}
local set_root = function()
-- Get directory path to start search from
local path = vim.api.nvim_buf_get_name(0)
if path == '' then return end
path = vim.fs.dirname(path)
-- Try cache and resort to searching upward for root directory
local root = root_cache[path]
if root == nil then
local root_file = vim.fs.find(root_names, { path = path, upward = true })[1]
if root_file == nil then return end
root = vim.fs.dirname(root_file)
root_cache[path] = root
end
-- Set current directory
vim.fn.chdir(root)
end
local root_augroup = vim.api.nvim_create_augroup('MyAutoRoot', {})
vim.api.nvim_create_autocmd('BufEnter', { group = root_augroup, callback = set_root })
local function set_makeprg()
local cwd = vim.fn.getcwd()
if vim.fn.filereadable(cwd .. '/justfile') == 1 then
vim.o.makeprg = 'just'
elseif vim.fn.filereadable(cwd .. '/Makefile') == 1 then
vim.o.makeprg = 'make'
elseif vim.fn.filereadable(cwd .. '/maskfile.md') == 1 then
vim.o.makeprg = 'mask'
end
end
local makeprg_augroup = vim.api.nvim_create_augroup('MyMakeprg', {})
vim.api.nvim_create_autocmd('BufEnter', { pattern = '*', group = makeprg_augroup, callback = set_makeprg, })

View File

@@ -1,72 +0,0 @@
-- maps.lua
local maps = {}
local function map(mode, lhs, rhs, opts)
local options = {noremap = true}
if opts then options = vim.tbl_extend('force', options, opts) end
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
end
function maps.toggleGoyo()
map('n', '<C-g>', ':Goyo<Enter>', {noremap = false})
end
function maps.term()
-- Open and move to resized terminal
map('n', '<leader>t', '<C-w>s<C-w>j :terminal<CR>:res 5<CR>i', {noremap = false})
-- Enter normal mode in terminal
map('t', 'ß<C-N>', '<C-\\><C-N>')
end
function maps.telescope()
map('n', '<Leader>ff', '<cmd>lua require(\'telescope.builtin\').git_files()<CR>')
map('n', '<Leader>fg', '<cmd>lua require(\'telescope.builtin\').live_grep()<CR>')
map('n', '<Leader>fb', '<cmd>lua require(\'telescope.builtin\').buffers()<CR>')
map('n', '<Leader>fh', '<cmd>lua require(\'telescope.builtin\').help_tags()<CR>')
end
function maps.fixIndent()
map('v', '<', '<gv')
map('v', '>', '>gv')
end
function maps.moveByRow()
-- When text is wrapped, move by terminal rows, not lines, unles a count is provided
map('n', 'j', 'v:count == 0 ? \'gj\' : \'j\'', {silent = true, expr = true})
map('n', 'k', 'v:count == 0 ? \'gk\' : \'k\'', {silent = true, expr = true})
end
function maps.centeredSearch()
map('n', 'n', 'nzzzv')
map('n', 'N', 'Nzzzv')
end
function maps.moveToWindow()
map('t', 'ª', '<C-\\><C-N><C-w>h')
map('t', 'º', '<C-\\><C-N><C-w>j')
map('t', '', '<C-\\><C-N><C-w>k')
map('t', '@', '<C-\\><C-N><C-w>l')
map('i', 'ª', '<C-\\><C-N><C-w>h')
map('i', 'º', '<C-\\><C-N><C-w>j')
map('i', '', '<C-\\><C-N><C-w>k')
map('i', '@', '<C-\\><C-N><C-w>l')
map('n', 'ª', '<C-w>h')
map('n', 'º', '<C-w>j')
map('n', '', '<C-w>k')
map('n', '@', '<C-w>l')
end
function maps.init()
vim.g.mapleader = " "
maps.toggleGoyo()
maps.term()
maps.telescope()
maps.fixIndent()
maps.moveByRow()
maps.centeredSearch()
-- maps.moveToWindow()
end
return maps

View File

@@ -1,59 +0,0 @@
-- plugin.lua
require "paq" {
-- Handle itself
'savq/paq-nvim';
-- Theme
'kyazdani42/nvim-web-devicons';
'rktjmp/lush.nvim';
'briones-gabriel/darcula-solid.nvim';
-- treesitter
'nvim-treesitter/nvim-treesitter';
'nvim-treesitter/playground';
-- Utils
'akinsho/nvim-bufferline.lua';
'hoob3rt/lualine.nvim';
'j-hui/fidget.nvim';
'airblade/vim-gitgutter';
'nvim-lua/popup.nvim';
'nvim-lua/plenary.nvim';
-- File Navigation
'kyazdani42/nvim-tree.lua';
'nvim-telescope/telescope.nvim';
-- lsp
'williamboman/mason.nvim';
'williamboman/mason-lspconfig.nvim';
'neovim/nvim-lspconfig';
'onsails/lspkind-nvim'; -- pictograms
'simrat39/rust-tools.nvim';
-- completion
'hrsh7th/cmp-nvim-lsp';
'hrsh7th/cmp-nvim-lsp-signature-help';
'hrsh7th/cmp-buffer';
'hrsh7th/cmp-path';
'hrsh7th/cmp-nvim-lua';
'hrsh7th/cmp-cmdline';
'hrsh7th/nvim-cmp';
-- snippets needed for cmp
'L3MON4D3/LuaSnip';
'saadparwaiz1/cmp_luasnip';
-- autopair
'windwp/nvim-autopairs';
-- Linting & formtatting
'jose-elias-alvarez/null-ls.nvim';
-- writing
'vimwiki/vimwiki';
'junegunn/goyo.vim';
'junegunn/limelight.vim';
}

44
lua/plugins/ai.lua Normal file
View File

@@ -0,0 +1,44 @@
return {
-- I don't know if I use this wrong or what but opencode does not seem to work that well
-- {
-- 'NickvanDyke/opencode.nvim',
-- dependencies = { 'folke/snacks.nvim', },
-- ---@type opencode.Config
-- opts = {
-- port = 48291,
-- },
-- -- stylua: ignore
-- keys = {
-- { '<leader>ot', function() require('opencode').toggle({ port = 48291 }) end, desc = 'Toggle embedded opencode', },
-- { '<leader>oa', function() require('opencode').ask() end, desc = 'Ask opencode', mode = 'n', },
-- { '<leader>oa', function() require('opencode').ask('@selection: ') end, desc = 'Ask opencode about selection', mode = 'v', },
-- { '<leader>op', function() require('opencode').select_prompt() end, desc = 'Select prompt', mode = { 'n', 'v', }, },
-- { '<leader>on', function() require('opencode').command('session_new') end, desc = 'New session', },
-- { '<leader>oy', function() require('opencode').command('messages_copy') end, desc = 'Copy last message', },
-- { '<S-C-u>', function() require('opencode').command('messages_half_page_up') end, desc = 'Scroll messages up', },
-- { '<S-C-d>', function() require('opencode').command('messages_half_page_down') end, desc = 'Scroll messages down', },
-- },
-- },
-- This is great tho
{
'milanglacier/minuet-ai.nvim',
dependencies = { 'hrsh7th/nvim-cmp', 'nvim-lua/plenary.nvim' },
config = function()
require('minuet').setup {
-- Your configuration options here
provider_options = {
codestral = {
model = 'codestral-latest',
end_point = 'https://codestral.mistral.ai/v1/fim/completions',
api_key = 'CODESTRAL_API_KEY',
stream = true,
optional = {
stop = { '\n\n' }, -- the identifier to stop the completion generation
max_tokens = 256,
},
},
}
}
end,
},
}

37
lua/plugins/dap.lua Normal file
View File

@@ -0,0 +1,37 @@
return {
{
'mfussenegger/nvim-dap',
lazy = true,
dependencies = { 'nvim-lua/plenary.nvim' },
config = function()
local wk = require("which-key")
local dap = require("dap")
wk.add({
{ '<leader>d', group = "dap" },
{ '<leader>db', dap.toggle_breakpoint, desc = "Toggle breakpoint" },
{ '<leader>dc', dap.continue, desc = "Launch/resume debug session" },
{ '<leader>do', dap.step_over, desc = "Step over" },
{ '<leader>di', dap.step_into, desc = "Step into" },
{ '<leader>du', dap.step_out, desc = "Step out" },
})
end
},
{
'rcarriga/nvim-dap-ui',
lazy = true,
config = function()
local dapui = require("dapui")
dapui.setup()
local wk = require("which-key")
wk.add({
{ '<leader>dd', dapui.toggle, desc = "Toggle dap ui" }
})
end,
dependencies = { 'mfussenegger/nvim-dap', 'nvim-neotest/nvim-nio' }
},
{
'theHamsta/nvim-dap-virtual-text',
lazy = true,
config = true
}
}

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

@@ -0,0 +1,465 @@
local lsp_attach = function(client, buf)
vim.api.nvim_set_option_value("formatexpr", "v:lua.vim.lsp.formatexpr()", { buf = buf })
vim.api.nvim_set_option_value("omnifunc", "v:lua.vim.lsp.omnifunc", { buf = buf })
vim.api.nvim_set_option_value("tagfunc", "v:lua.vim.lsp.tagfunc", { buf = buf })
vim.lsp.inlay_hint.enable(true, nil)
local bufopts = { noremap = true, silent = true, buffer = buf }
local wk = require("which-key")
local diag_next = function()
vim.diagnostic.jump({ count = 1, float = true })
end
local diag_prev = function()
vim.diagnostic.jump({ count = -1, float = true })
end
wk.add({
{ '<C-e>', require("telescope.builtin").diagnostics, bufopts, desc = "Show diagnostics under cursor" },
{ '<leader>e', vim.diagnostic.open_float, bufopts, desc = "Show diagnostics in buffer" },
{ '[d', diag_prev, bufopts },
{ ']d', diag_next, bufopts },
{ 'gD', vim.lsp.buf.declaration, bufopts, desc = "Go to declaration" },
{ 'gd', vim.lsp.buf.definition, bufopts, desc = "Go to definition" },
{ 'gi', vim.lsp.buf.implementation, bufopts, desc = "Go to implementation" },
{ '<C-k>', vim.lsp.buf.signature_help, bufopts, desc = "Show signature" },
{ '<leader>rn', vim.lsp.buf.rename, bufopts, desc = "Rename" },
{ '<leader>ca', vim.lsp.buf.code_action, bufopts, desc = "Show code actions" },
{ 'gr', require("telescope.builtin").lsp_references, bufopts, desc = "Shwo references" },
})
end
local mason_path = vim.fn.glob(vim.fn.stdpath "data" .. "/mason/packages/codelldb/extension/")
local codelldb_path = mason_path .. "adapter/codelldb"
local liblldb_path = mason_path .. "lldb/lib/liblldb.so"
if vim.fn.has "mac" == 1 then
liblldb_path = mason_path .. "lldb/lib/liblldb.dylib"
end
return {
-- lsp
{
'williamboman/mason.nvim',
lazy = true,
config = true
},
{
'williamboman/mason-lspconfig.nvim',
config = true
--config = function()
-- ensure_installed = { "lua_ls", "ts_ls", "gopls", "rust_analyzer", "bashls", "sqlls", "html", "cssls",
-- "tailwindcss", "phpactor", "julials", "glsl_analyzer", "wgsl_analyzer", "emmet_language_server", "zls" }
--end
},
{
'neovim/nvim-lspconfig',
config = function()
local capabilities = require('cmp_nvim_lsp').default_capabilities()
vim.lsp.config('lua_ls', {
capabilities = capabilities,
root_markers = { '.git' },
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
version = 'LuaJIT',
},
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = { 'vim' }
},
workspace = {
-- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file("", true),
checkThirdParty = false,
},
}
},
on_attach = lsp_attach
})
vim.lsp.config('ts_ls', {
capabilities = capabilities,
on_attach = lsp_attach
})
vim.lsp.config('gopls', {
capabilities = capabilities,
on_attach = lsp_attach
})
--vim.lsp.config(rust_analyzer.setup {
-- capabilities = capabilities,
-- on_attach = lsp_attach
--})
vim.lsp.config('bashls', {
capabilities = capabilities,
on_attach = lsp_attach
})
vim.lsp.config('sqlls', {
capabilities = capabilities,
on_attach = lsp_attach
})
vim.lsp.config('html', {
capabilities = capabilities,
on_attach = lsp_attach
})
vim.lsp.config('cssls', {
capabilities = capabilities,
on_attach = lsp_attach
})
vim.lsp.config('tailwindcss', {
capabilities = capabilities,
on_attach = lsp_attach
})
vim.lsp.config('phpactor', {
capabilities = capabilities,
on_attach = lsp_attach
})
vim.lsp.config('julials', {
capabilities = capabilities,
on_attach = lsp_attach
})
vim.lsp.config('wgsl_analyzer', {
capabilities = capabilities,
on_attach = lsp_attach
})
vim.lsp.config('glsl_analyzer', {
capabilities = capabilities,
on_attach = lsp_attach
})
vim.lsp.config('emmet_ls', {
filetypes = { "css", "html", "javascript", "typescript" },
-- Read more about this options in the [vscode docs](https://code.visualstudio.com/docs/editor/emmet#_emmet-configuration).
-- **Note:** only the options listed in the table are supported.
init_options = {
---@type table<string, string>
includeLanguages = {},
--- @type string[]
excludeLanguages = {},
--- @type string[]
extensionsPath = {},
--- @type table<string, any> [Emmet Docs](https://docs.emmet.io/customization/preferences/)
preferences = {},
--- @type boolean Defaults to `true`
showAbbreviationSuggestions = true,
--- @type "always" | "never" Defaults to `"always"`
showExpandedAbbreviation = "always",
--- @type boolean Defaults to `false`
showSuggestionsAsSnippets = false,
--- @type table<string, any> [Emmet Docs](https://docs.emmet.io/customization/syntax-profiles/)
syntaxProfiles = {},
--- @type table<string, string> [Emmet Docs](https://docs.emmet.io/customization/snippets/#variables)
variables = {},
},
})
-- vim.lsp.config('ccls.setup {
-- capabilities = capabilities,
-- on_attach = lsp_attach,
-- })
vim.lsp.config('clangd', {
capabilities = capabilities,
on_attach = lsp_attach,
})
end
},
{
'mrcjkb/rustaceanvim',
version = "^6",
lazy = false,
ft = { "rust" },
config = function()
local rust_analyzer_path = vim.fn.trim(vim.fn.system("rustup which rust-analyzer"))
if rust_analyzer_path == "" then
vim.notify("rust-analyzer not found! Install it with: rustup component add rust-analyzer",
vim.log.levels.ERROR)
return
end
vim.g.rustaceanvim = {
server = {
cmd = { rust_analyzer_path },
on_attach = lsp_attach,
settings = {
-- rust-analyzer language server configuration
["rust-analyzer"] = {
rustfmt = {
extraArgs = { "+nightly" },
},
cargo = {
loadOutDirsFromCheck = true,
runBuildScripts = true,
},
-- Add clippy lints for Rust.
checkOnSave = true,
-- TODO this breaks diagnostics, look into what can be done
-- procMacro = {
-- enable = true,
-- ignored = {
-- ["async-trait"] = { "async_trait" },
-- ["napi-derive"] = { "napi" },
-- ["async-recursion"] = { "async_recursion" },
-- },
-- },
},
},
}
}
end
},
{
'mfussenegger/nvim-jdtls',
ft = { "java" },
config = function()
local home = os.getenv('HOME')
local jdtls = require('jdtls')
local capabilities = require('cmp_nvim_lsp').default_capabilities()
local root_markers = { 'gradlew', 'mvnw', 'git' }
local root_dir = require('jdtls.setup').find_root(root_markers)
local workspace_folder = home .. "/.local/share/eclipse/" .. vim.fn.fnamemodify(root_dir, ":p:h:t")
local config = {
flags = {
debounce_text_changes = 80,
},
capabilities = capabilities,
on_attach = lsp_attach, -- We pass our on_attach keybindings to the configuration map
root_dir = root_dir, -- Set the root directory to our found root_marker
-- here you can configure eclipse.jdt.ls specific settings
-- these are defined by the eclipse.jdt.ls project and will be passed to eclipse when starting.
-- 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 = {
format = {
settings = {
-- use google java style guidelines for formatting
-- to use, make sure to download the file from https://github.com/google/styleguide/blob/gh-pages/eclipse-java-google-style.xml
-- and place it in the ~/.local/share/eclipse directory
-- url = "/.local/share/eclipse/eclipse-java-google-style.xml",
-- profile = "googlestyle",
},
},
signaturehelp = { enabled = true },
contentprovider = { preferred = 'fernflower' }, -- use fernflower to decompile library code
-- specify any completion options
completion = {
favoritestaticmembers = {
-- "org.hamcrest.matcherassert.assertthat",
-- "org.hamcrest.matchers.*",
-- "org.hamcrest.corematchers.*",
-- "org.junit.jupiter.api.assertions.*",
-- "java.util.objects.requirenonnull",
-- "java.util.objects.requirenonnullelse",
-- "org.mockito.mockito.*"
},
filteredtypes = {
-- "com.sun.*",
-- "io.micrometer.shaded.*",
-- "java.awt.*",
-- "jdk.*", "sun.*",
},
},
-- specify any options for organizing imports
sources = {
organizeimports = {
starthreshold = 9999,
staticstarthreshold = 9999,
},
},
-- how code generation should act
codegeneration = {
tostring = {
template = "${object.classname}{${member.name()}=${member.value}, ${othermembers}}"
},
hashcodeequals = {
usejava7objects = true,
},
useblocks = true,
},
-- if you are developing in projects with different java versions, you need
-- to tell eclipse.jdt.ls to use the location of the jdk for your java version
-- see https://github.com/eclipse/eclipse.jdt.ls/wiki/running-the-java-ls-server-from-the-command-line#initialize-request
-- and search for `interface runtimeoption`
-- the `name` is not arbitrary, but must match one of the elements from `enum executionenvironment` in the link above
configuration = {
runtimes = {
{
name = "JavaSE-17",
path = home .. "/.local/share/asdf/installs/java/oracle-17.0.11/",
},
{
name = "JavaSE-21",
path = home .. "/.local/share/asdf/installs/java/oracle-21.0.2/",
},
{
name = "JavaSE-1.8",
path = home .. "/.local/share/asdf/installs/java/adoptopenjdk-8.0.412+8/"
},
}
}
}
},
-- cmd is the command that starts the language server. whatever is placed
-- here is what is passed to the command line to execute jdtls.
-- note that eclipse.jdt.ls must be started with a java version of 17 or higher
-- see: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line
-- for the full list of options
cmd = {
home .. "/.local/share/asdf/installs/java/oracle-21.0.2/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',
'-Xmx4G',
'--add-modules=ALL-SYSTEM',
'--add-opens', 'java.base/java.util=ALL-UNNAMED',
'--add-opens', 'java.base/java.lang=ALL-UNNAMED',
-- if you use lombok, download the lombok jar and place it in ~/.local/share/eclipse
'-javaagent:' .. home .. '/.local/share/nvim/mason/packages/jdtls/lombok.jar',
-- the jar file is located where jdtls was installed. this will need to be updated
-- to the location where you installed jdtls
'-jar', vim.fn.glob(
home ..
'/.local/share/nvim/mason/packages/jdtls/plugins/org.eclipse.equinox.launcher_*.jar'),
-- the configuration for jdtls is also placed where jdtls was installed. this will
-- need to be updated depending on your environment
'-configuration', home .. '/.local/share/nvim/mason/packages/jdtls/config_linux',
-- use the workspace_folder defined above to store data for this project
'-data', workspace_folder,
},
}
jdtls.start_or_attach(config)
end
},
{
"Kurren123/mssql.nvim",
opts = {
-- optional
keymap_prefix = "<leader>m"
},
-- optional
dependencies = { "folke/which-key.nvim" }
},
{ 'onsails/lspkind-nvim' }, -- pictograms replace (?) with lspsaga
{
'j-hui/fidget.nvim',
config = true
}, -- show lsp status
-- completion
{
'hrsh7th/nvim-cmp',
config = function()
local cmp = require('cmp')
local lspkind = require('lspkind')
vim.opt.shortmess:append 'c'
cmp.setup({
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<C-n>"] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Insert },
["<C-p>"] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Insert },
['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
['<C-s>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
['<C-y>'] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Insert,
select = true
}),
['<C-e>'] = cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
}),
['<CR>'] = cmp.mapping.confirm({ select = true }),
}),
sources = cmp.config.sources({
{ name = 'nvim_lua' },
{ name = 'nvim_lsp' },
{ name = 'path' },
{ name = 'luasnip' },
{ name = 'nvim_lsp_signature_help' },
}, {
{ name = 'buffer', keyword_length = 5 },
{ name = 'minuet' },
}),
performance = {
-- It is recommended to increase the timeout duration due to
-- the typically slower response speed of LLMs compared to
-- other completion sources. This is not needed when you only
-- need manual completion.
fetching_timeout = 2000,
},
formatting = {
format = lspkind.cmp_format {
with_text = true,
menu = {
buffer = "[buf]",
nvim_lsp = "[LSP]",
nvim_lua = "[api]",
path = "[path]",
luasnip = "[snip]",
minuet = "[llm]",
}
}
}
})
-- Use buffer source for `/` (basically search words in buffer)
cmp.setup.cmdline('/', {
sources = {
{ name = 'buffer' }
}
})
-- Use cmdline & path source for ':'
cmp.setup.cmdline(':', {
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})
end,
event = 'InsertEnter',
dependencies = {
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-nvim-lsp-signature-help',
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-path',
'hrsh7th/cmp-nvim-lua',
'hrsh7th/cmp-cmdline',
'saadparwaiz1/cmp_luasnip',
}
},
{
'L3MON4D3/LuaSnip',
version = "v2.*",
build = "make install_jsregexp",
config = function()
require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/snippets/" })
end
},
{
'windwp/nvim-autopairs',
config = true
},
{
"folke/trouble.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
opts = {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
},
},
}

View File

@@ -0,0 +1,66 @@
return {
{
'nvim-telescope/telescope.nvim',
version = '0.1.*',
dependencies = { 'nvim-lua/plenary.nvim' },
config = function()
local telescope = require("telescope.builtin")
local wk = require("which-key")
wk.add({
{ "<leader>g", group = "git" },
{ "<leader>gh", telescope.git_bcommits, { noremap = true, silent = true }, desc = "View commits of current buffer" },
{ "<leader>gb", telescope.git_branches, { noremap = true, silent = true }, desc = "View git branches" },
{ "<leader>gs", telescope.git_status, { noremap = true, silent = true }, desc = "View git status" },
{ "<leader>f", group = "find" },
{ '<Leader>ff', telescope.git_files, { noremap = true, silent = true }, desc = "Search files" },
{ '<Leader>fg', telescope.live_grep, { noremap = true, silent = true }, desc = "Search in files" },
{ '<Leader>fb', telescope.buffers, { noremap = true, silent = true }, desc = "Search in buffers" },
{ '<Leader>fh', telescope.help_tags, { noremap = true, silent = true }, desc = "Search in help" },
{ '<Leader>fk', telescope.keymaps, { noremap = true, silent = true }, desc = "Search in keymaps" },
{ '<leader>cc', telescope.colorscheme, desc = "Select colorscheme" },
})
require("telescope.config").set_defaults({
file_ignore_patterns = { "doc/" }
})
end,
},
{
'nvim-telescope/telescope-ui-select.nvim',
dependencies = { 'nvim-telescope/telescope.nvim' },
config = function()
require("telescope").setup {
defaults = {
mappings = {
i = {
["<C-h>"] = "which_key"
}
}
},
pickers = {
colorscheme = {
enable_preview = true,
}
},
extensions = {
["ui-select"] = {
require("telescope.themes").get_cursor()
}
}
}
require("telescope").load_extension("ui-select")
end
}
-- Don't really need it. Nicer than the default but that's it
-- {
-- 'nvim-tree/nvim-tree.lua',
-- config = function()
-- require('nvim-tree').setup {
-- view = {
-- width = 30,
-- side = 'left',
-- },
-- }
-- end,
-- dependencies = { 'nvim-tree/nvim-web-devicons' }
-- }
}

95
lua/plugins/style.lua Normal file
View File

@@ -0,0 +1,95 @@
return {
{
'rebelot/kanagawa.nvim',
config = function()
vim.opt.guifont = 'Source Code Pro for Powerline'
vim.cmd('set termguicolors')
vim.opt.syntax = 'on'
-- require('kanagawa').setup({
-- colors = {
-- palette = {
-- lotusGray = "#F8F7F4",
-- lotusWhite0 = "#FBFBF9",
-- lotusWhite1 = "#F2F0E9",
-- lotusWhite2 = "#F8F7F2",
-- lotusWhite3 = "#F6F6F1",
-- lotusWhite4 = "#F4F1E6",
-- lotusWhite5 = "#FcFBF9",
-- }
-- }
-- })
-- vim.cmd('colorscheme kanagawa-lotus')
vim.cmd('colorscheme kanagawa')
end
},
{ 'lunarvim/lunar.nvim' },
{
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
config = function()
require('nvim-treesitter.configs').setup {
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
indent = {
enable = true,
disable = { "html" }
}
}
end,
},
{
"nvim-treesitter/nvim-treesitter-context",
dependencies = { 'nvim-treesitter/nvim-treesitter' }
},
{
"nvim-treesitter/nvim-treesitter-textobjects",
dependencies = { 'nvim-treesitter/nvim-treesitter' },
config = function()
require("nvim-treesitter.configs").setup({
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
}
},
swap = {
enable = true,
swap_next = {
["<leader>a"] = "@parameter.inner",
},
swap_previous = {
["<leader>A"] = "@parameter.inner",
},
},
}
})
end
},
{
'akinsho/bufferline.nvim',
version = "*",
config = true,
dependencies = { 'nvim-tree/nvim-web-devicons' }
},
{
'hoob3rt/lualine.nvim',
config = function()
require('lualine').setup {
options = {
theme = 'kanagawa'
}
}
end
},
{
'lewis6991/gitsigns.nvim',
config = true
},
}

60
lua/plugins/wk.lua Normal file
View File

@@ -0,0 +1,60 @@
-- maps.lua
local maps = {}
function maps.term()
vim.api.nvim_set_keymap('n', '<leader>t', '<C-w>s<C-w>j :terminal<CR>:res 5<CR>i',
{ noremap = false, desc = "Open and move to terminal" })
vim.api.nvim_set_keymap('t', 'ß<C-N>', '<C-\\><C-N>', { noremap = true, desc = "Enter normal mode in terminal" })
end
function maps.fixIndent()
vim.api.nvim_set_keymap('v', '<', '<gv', { noremap = true, desc = "Remove identation level" })
vim.api.nvim_set_keymap('v', '>', '>gv', { noremap = true, desc = "Add identation level" })
end
function maps.moveByRow()
-- When text is wrapped, move by terminal rows, not lines, unles a count is provided
vim.api.nvim_set_keymap('n', 'j', 'v:count == 0 ? \'gj\' : \'j\'',
{ noremap = true, silent = true, expr = true, desc = "Go down 1 line" })
vim.api.nvim_set_keymap('n', 'k', 'v:count == 0 ? \'gk\' : \'k\'',
{ noremap = true, silent = true, expr = true, desc = "Go up 1 line" })
end
function maps.centeredSearch()
vim.api.nvim_set_keymap('n', 'n', 'nzzzv', { noremap = true, desc = "Search next" })
vim.api.nvim_set_keymap('n', 'N', 'Nzzzv', { noremap = true, desc = "Search previous" })
end
function maps.init()
vim.g.mapleader = " "
vim.api.nvim_set_keymap('n', '<leader>b', '<cmd>Lexplore | vert res 30<CR>',
{ noremap = true, desc = "Open file explorer" })
maps.term()
maps.fixIndent()
maps.moveByRow()
maps.centeredSearch()
end
return {
"folke/which-key.nvim",
event = "VeryLazy",
keys = {
{
"<leader>?",
function()
require("which-key").show({ global = false })
end,
desc = "Buffer Local Keymaps (which-key)",
},
},
config = function()
require("which-key").setup({
preset = "helix"
})
local wk = require("which-key")
maps.init()
end
}

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

@@ -0,0 +1,12 @@
return {
-- writing
{
'vimwiki/vimwiki',
ft = { 'md', 'wiki', 'tex' },
config = function()
vim.g.vimwiki_list = { { path = '~/Documents/Buch/wiki', syntax = 'markdown', ext = '.md' } }
end
},
--{ 'junegunn/goyo.vim' }, -- try replacing these 2 at some point because they don't work that well anymore
--{ 'junegunn/limelight.vim' },
}

View File

@@ -1,73 +0,0 @@
-- Completion
local completion = {}
local cmp = require'cmp'
local lspkind = require'lspkind'
vim.opt.shortmess:append 'c'
cmp.setup({
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<C-n>"] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Insert },
["<C-p>"] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Insert },
['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
['<C-s>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
['<C-y>'] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Insert,
select = true
}),
['<C-e>'] = cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
}),
['<CR>'] = cmp.mapping.confirm({ select = true }),
}),
sources = cmp.config.sources({
{ name = 'nvim_lua' },
{ name = 'nvim_lsp' },
{ name = 'path' },
{ name = 'luasnip' },
{ name = 'nvim_lsp_signature_help' },
}, {
{ name = 'buffer', keyword_length = 5 },
}),
formatting = {
format = lspkind.cmp_format {
with_text = true,
menu = {
buffer = "[buf]",
nvim_lsp = "[LSP]",
nvim_lua = "[api]",
path = "[path]",
luasnip = "[snip]",
}
}
}
})
-- Use buffer source for `/` (basically search words in buffer)
cmp.setup.cmdline('/', {
sources = {
{ name = 'buffer' }
}
})
-- Use cmdline & path source for ':'
cmp.setup.cmdline(':', {
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})
-- autopair
require('nvim-autopairs').setup {}
return completion

View File

@@ -1,47 +0,0 @@
-- settings.lua
local settings = {}
function settings.initMisc()
vim.opt.backup = false
vim.opt.undodir = '/Users/fschmidt/.cache/nvim/undodir'
vim.opt.swapfile = false
vim.opt.undofile = true
vim.opt.smartcase = true
vim.opt.ignorecase = true
vim.opt.laststatus = 2
vim.opt.hidden = true
vim.opt.hlsearch = false
vim.opt.incsearch = true
vim.opt.scrolloff = 12
vim.opt.sidescrolloff = 8
vim.opt.mouse = 'a'
vim.opt.autochdir = true
vim.opt.clipboard = 'unnamed,unnamedplus'
vim.opt.number = true
vim.opt.wrap = false
vim.opt.signcolumn = 'yes:2'
vim.opt.list = true
vim.opt.listchars = 'tab:▸ ,trail:·'
vim.opt.shiftwidth = 4
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.expandtab = false
vim.opt.autoindent = true
vim.opt.completeopt = { "menu", "menuone", "noselect" }
end
function settings.initVimWiki()
vim.g.vimwiki_list = {{path = '~/Documents/Buch/wiki', syntax = 'markdown', ext = '.md'}}
end
function settings.init()
settings.initMisc()
settings.initVimWiki()
require'settings.theme'.init()
require'settings.lsp'.init()
require'settings.completion'
require'settings.tree'
end
return settings

View File

@@ -1,61 +0,0 @@
-- LSP Config
local lsp = {}
local lsp_attach = function(client, buf)
vim.api.nvim_buf_set_option(buf, "formatexpr", "v:lua.vim.lsp.formatexpr()")
vim.api.nvim_buf_set_option(buf, "omnifunc", "v:lua.vim.lsp.omnifunc")
vim.api.nvim_buf_set_option(buf, "tagfunc", "v:lua.vim.lsp.tagfunc")
local bufopts = { noremap=true, silent=true, buffer=buf }
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
end
function lsp.init()
require'mason'.setup()
require'mason-lspconfig'.setup()
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
local lspconfig = require'lspconfig'
lspconfig.sumneko_lua.setup {
capabilities = capabilities,
settings = {
Lua = {
diagnostics = {
globals = { 'vim' }
}
}
},
on_attach = lsp_attach
}
lspconfig.tsserver.setup {
capabilities = capabilities,
on_attach = lsp_attach
}
lspconfig.gopls.setup {
capabilities = capabilities,
on_attach = lsp_attach
}
--lspconfig.rust_analyzer.setup {
-- capabilities = capabilities,
-- on_attach = lsp_attach
--}
require("rust-tools").setup({
server = {
capabilities = capabilities,
on_attach = lsp_attach,
standalone = false
}
})
end
return lsp

View File

@@ -1,41 +0,0 @@
-- Theming
local theme = {}
function theme.initFont()
vim.opt.guifont = 'Source Code Pro for Powerline'
end
function theme.lsp_status()
require'fidget'.setup {}
end
function theme.initStatusline()
require'lualine'.setup {
options = {
theme = 'onedark'
}
}
end
function theme.initBufferline()
local bufferline = require'bufferline'
bufferline.setup()
end
function theme.initColorscheme()
vim.g.limelight_conceal_ctermfg = 'gray'
vim.cmd'colorscheme darcula-solid'
vim.cmd'set termguicolors'
vim.opt.syntax = 'on'
end
function theme.init()
theme.initFont()
theme.lsp_status()
theme.initStatusline()
theme.initBufferline()
theme.initColorscheme()
end
return theme

View File

@@ -1,60 +0,0 @@
-- Tree
local tree = {}
require'nvim-tree'.setup {
disable_netrw = true,
hijack_netrw = true,
open_on_setup = false,
ignore_ft_on_setup = {},
open_on_tab = false,
hijack_cursor = false,
update_cwd = false,
hijack_directories = {
enable = true,
auto_open = true,
},
diagnostics = {
enable = false,
icons = {
hint = "",
info = "",
warning = "",
error = "",
}
},
update_focused_file = {
enable = false,
update_cwd = false,
ignore_list = {}
},
system_open = {
cmd = nil,
args = {}
},
filters = {
dotfiles = false,
custom = {}
},
git = {
enable = true,
ignore = true,
timeout = 500,
},
view = {
width = 30,
hide_root_folder = false,
side = 'left',
mappings = {
custom_only = false,
list = {}
}
},
actions = {
open_file = {
resize_window = false
}
}
}
return tree

25
snippets/go.lua Normal file
View File

@@ -0,0 +1,25 @@
local ls = require("luasnip")
local s = ls.s
local i = ls.i
local t = ls.t
local d = ls.dynamic_node
local c = ls.choice_node
local f = ls.function_node
local sn = ls.snippet_node
local fmt = require("luasnip.extras.fmt").fmt
local rep = require("luasnip.extras").rep
local snippets, autosnippets = {}, {}
local errorSnippet = s("error", fmt([[
if err != nil {{
{}
}}
]], {
i(1, "return nil, err")
}))
table.insert(snippets, errorSnippet)
return snippets, autosnippets