aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Bossing <info@maxbossing.de>2025-07-22 17:06:33 +0200
committerMax Bossing <info@maxbossing.de>2025-07-22 17:06:33 +0200
commitb426f25aef1f2be2b482bf0b256733eba0b1c5aa (patch)
treecd67b7920531c45a7a48ea4a54e32ec6cc002b5e
parentabbbb47917049d4236ac7758cf56d8315620661b (diff)
smh so cool shit
-rw-r--r--nvim/init.lua119
-rw-r--r--nvim/lua/keymap.lua19
-rw-r--r--nvim/lua/lsp.lua55
-rw-r--r--nvim/lua/options.lua35
-rw-r--r--nvim/lua/plugins.lua92
-rw-r--r--nvim/lua/plugins/lualine.lua8
-rw-r--r--nvim/lua/plugins/oil.lua1
-rw-r--r--nvim/lua/plugins/telescope.lua9
-rw-r--r--nvim/lua/plugins/treesitter.lua3
9 files changed, 230 insertions, 111 deletions
diff --git a/nvim/init.lua b/nvim/init.lua
index d911177..2c5506b 100644
--- a/nvim/init.lua
+++ b/nvim/init.lua
@@ -1,117 +1,14 @@
-vim.g.loaded_netrw = 1
-vim.g.loaded_netrwPlugin = 1
+require('plugins')
-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)
+require('options')
-require("lazy").setup({
-
- -- Color Scheme
- "folke/tokyonight.nvim",
-
- -- Syntax highlighting
- 'nvim-treesitter/nvim-treesitter',
-
- -- Status line
- 'nvim-lualine/lualine.nvim',
-
- -- Git
- 'airblade/vim-gitgutter',
-
- -- File System
- 'stevearc/oil.nvim',
-
- {
- 'OXY2DEV/markview.nvim',
- lazy = false,
- priority = 49,
-
- },
-
- -- Telescope
- {
- 'nvim-telescope/telescope.nvim',
- tag = '0.1.5',
- dependencies = {
- 'nvim-lua/plenary.nvim',
- 'sharkdp/fd',
- { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' },
- }
- },
-
- -- Icons
- {
- "echasnovski/mini.icons",
- lazy = true,
- init = function()
- package.preload["nvim-web-devicons"] = function()
- require("mini.icons").mock_nvim_web_devicons()
- return package.loaded["nvim-web-devicons"]
- end
- end,
- },
-})
-
-
-
--- Colorscheme
vim.cmd [[colorscheme tokyonight-moon]]
-vim.opt.termguicolors = true
-vim.o.background = "dark"
-
--- Map leader to space
-vim.g.mapleader = ' '
-
--- Tabs sind für lutscher
-vim.opt.tabstop = 2
-vim.opt.shiftwidth = 2
-vim.o.expandtab = true
-
--- Numbers on the side
-vim.wo.number = true
-vim.wo.relativenumber = true
-vim.o.ruler = true
--- Show something in the command line not sure
-vim.o.showcmd = true
-
--- reload config without restart
-vim.keymap.set('n', '<leader>r', ':so %<CR>')
-
--- Lualine setup
-require('lualine').setup {
- options = {
- icons_enabled = true,
- theme = 'auto',
- section_separators = { left = '', right = '' },
- component_separators = { left = '', right = '' }
- },
-}
-
--- Treesitter setup
-require('nvim-treesitter.configs').setup {
- highlight = { enable = true }
-}
-
--- Telescope setup
-local telescope = require('telescope')
-telescope.load_extension('fzf')
-vim.keymap.set('n', '<leader>tf', ':Telescope find_files<CR>') -- file search
-vim.keymap.set('n', '<leader>tb', ':Telescope buffers<CR>') -- buffer peak
-vim.keymap.set('n', '<leader>th', ':Telescope help_tags<CR>') -- help menu
-vim.keymap.set('n', '<leader>tt', ':Telescope treesitter <CR>') -- treesitter symbol menu
-vim.keymap.set('n', '<leader>tp', ':Telescope builtin<CR>') -- picker picker lmao
-
-require('oil').setup()
+require('lsp')
+require('plugins/lualine')
+require('plugins/telescope')
+require('plugins/oil')
+require('plugins/treesitter')
+require('keymap')
diff --git a/nvim/lua/keymap.lua b/nvim/lua/keymap.lua
new file mode 100644
index 0000000..0d4ce23
--- /dev/null
+++ b/nvim/lua/keymap.lua
@@ -0,0 +1,19 @@
+-- vim-fugitive
+vim.keymap.set('n', '<leader>gs', ':Git<CR>')
+
+-- move code in visual-line mode
+vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
+vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
+
+-- Paste while yanking into void (paste without loosing register)
+vim.keymap.set("x", "<leader>p", [["_dP]])
+
+-- directly yank into system clipboard
+vim.keymap.set({ "n", "v" }, "<leader>y", [["+y]])
+vim.keymap.set("n", "<leader>Y", [["+Y]])
+
+-- delete while yanking into void
+vim.keymap.set({ "n", "v" }, "<leader>d", "\"_d")
+
+
+vim.keymap.set("n", "-", "<CMD>Oil<CR>")
diff --git a/nvim/lua/lsp.lua b/nvim/lua/lsp.lua
new file mode 100644
index 0000000..b7fad3e
--- /dev/null
+++ b/nvim/lua/lsp.lua
@@ -0,0 +1,55 @@
+require('mason').setup()
+
+vim.lsp.enable('lua-language-server')
+
+local bufnr = vim.api.nvim_get_current_buf()
+vim.keymap.set('n', '<leader>a',
+ function()
+ vim.cmd.RustLsp('codeAction')
+ end,
+ { silent = true, buffer = bufnr }
+)
+
+vim.keymap.set('n', 'K',
+ function()
+ vim.cmd.RustLsp({'hover', 'actions'})
+ end,
+ { silent = true, buffer = bufnr }
+)
+
+
+local cmp = require('cmp')
+cmp.setup({
+ mapping = cmp.mapping.preset.insert({
+ ['<C-p>'] = cmp.mapping.select_prev_item({behavior = cmp.SelectBehavior.Select}),
+ ['<C-n>'] = cmp.mapping.select_next_item({behavior = cmp.SelectBehavior.Select}),
+ ['<C-b>'] = cmp.mapping.scroll_docs(-4),
+ ['<C-f>'] = cmp.mapping.scroll_docs(4),
+ ['<C-Space>'] = cmp.mapping.complete(),
+ ['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
+ }),
+ sources = cmp.config.sources({
+ { name = 'nvim_lsp' },
+ }, {
+ { name = 'buffer' },
+ })
+})
+
+cmp.setup.cmdline({ '/', '?' }, {
+ mapping = cmp.mapping.preset.cmdline(),
+ sources = {
+ { name = 'buffer' }
+ }
+})
+
+cmp.setup.cmdline(':', {
+ mapping = cmp.mapping.preset.cmdline(),
+ sources = cmp.config.sources({
+ { name = 'path' }
+ }, {
+ { name = 'cmdline' }
+ }),
+ matching = { disallow_symbol_nonprefix_matching = false }
+})
+
+require('lsp_signature').setup()
diff --git a/nvim/lua/options.lua b/nvim/lua/options.lua
new file mode 100644
index 0000000..a7cce04
--- /dev/null
+++ b/nvim/lua/options.lua
@@ -0,0 +1,35 @@
+vim.g.loaded_netrw = 1
+vim.g.loaded_netrwPlugin = 1
+
+vim.opt.termguicolors = true
+vim.o.background = "dark"
+
+vim.opt.colorcolumn = "80"
+vim.opt.updatetime = 50
+
+-- Map leader to space
+vim.g.mapleader = ' '
+
+-- Tabs sind für lutscher
+vim.opt.tabstop = 2
+vim.opt.shiftwidth = 2
+vim.o.expandtab = true
+vim.opt.smartindent = true
+
+-- QoL for search
+vim.opt.hlsearch = false
+vim.opt.incsearch = true
+
+-- Scrolling
+vim.opt.scrolloff = 10
+vim.opt.signcolumn = "yes"
+vim.opt.isfname:append('@-@')
+
+-- Numbers on the side
+vim.wo.number = true
+vim.wo.relativenumber = true
+vim.o.ruler = true
+
+-- Show something in the command line not sure
+vim.o.showcmd = true
+
diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua
new file mode 100644
index 0000000..7a7353d
--- /dev/null
+++ b/nvim/lua/plugins.lua
@@ -0,0 +1,92 @@
+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)
+
+require("lazy").setup({
+
+ -- Color Scheme
+ "folke/tokyonight.nvim",
+
+ -- Syntax highlighting
+ 'nvim-treesitter/nvim-treesitter',
+
+ -- Status line
+ 'nvim-lualine/lualine.nvim',
+
+ -- Git
+ 'airblade/vim-gitgutter',
+
+ -- File System
+ 'stevearc/oil.nvim',
+ 'benomahony/oil-git.nvim',
+
+ -- non-linear undo history
+ 'mbbill/undotree',
+
+ -- Git
+ 'tpope/vim-fugitive',
+
+ -- Comments
+ "tpope/vim-commentary",
+
+ -- Some lsp shit
+ 'mason-org/mason.nvim',
+
+ {
+ 'OXY2DEV/markview.nvim',
+ lazy = false,
+ priority = 49,
+
+ },
+
+ -- Telescope
+ {
+ 'nvim-telescope/telescope.nvim',
+ tag = '0.1.5',
+ dependencies = {
+ 'nvim-lua/plenary.nvim',
+ 'sharkdp/fd',
+ { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' },
+ }
+ },
+
+ -- Icons
+ {
+ "echasnovski/mini.icons",
+ lazy = true,
+ init = function()
+ package.preload["nvim-web-devicons"] = function()
+ require("mini.icons").mock_nvim_web_devicons()
+ return package.loaded["nvim-web-devicons"]
+ end
+ end,
+ },
+
+ {
+ 'mrcjkb/rustaceanvim',
+ version = '^6', -- Recommended
+ lazy = false, -- This plugin is already lazy
+ },
+
+ {"hrsh7th/nvim-cmp"},
+ {"hrsh7th/cmp-buffer"},
+ {"hrsh7th/cmp-path"},
+ {"hrsh7th/cmp-nvim-lsp"},
+ {"hrsh7th/cmp-nvim-lua"},
+
+ {
+ "ray-x/lsp_signature.nvim",
+ event = InsertEnter
+ },
+
+})
+
diff --git a/nvim/lua/plugins/lualine.lua b/nvim/lua/plugins/lualine.lua
new file mode 100644
index 0000000..2356803
--- /dev/null
+++ b/nvim/lua/plugins/lualine.lua
@@ -0,0 +1,8 @@
+require('lualine').setup {
+ options = {
+ icons_enabled = true,
+ theme = 'auto',
+ section_separators = { left = '', right = '' },
+ component_separators = { left = '', right = '' }
+ },
+}
diff --git a/nvim/lua/plugins/oil.lua b/nvim/lua/plugins/oil.lua
new file mode 100644
index 0000000..d24cfbb
--- /dev/null
+++ b/nvim/lua/plugins/oil.lua
@@ -0,0 +1 @@
+require('oil').setup()
diff --git a/nvim/lua/plugins/telescope.lua b/nvim/lua/plugins/telescope.lua
new file mode 100644
index 0000000..4744a68
--- /dev/null
+++ b/nvim/lua/plugins/telescope.lua
@@ -0,0 +1,9 @@
+local telescope = require('telescope')
+telescope.load_extension('fzf')
+vim.keymap.set('n', '<leader>tf', ':Telescope find_files<CR>') -- file search
+vim.keymap.set('n', '<leader>tb', ':Telescope buffers<CR>') -- buffer peak
+vim.keymap.set('n', '<leader>th', ':Telescope help_tags<CR>') -- help menu
+vim.keymap.set('n', '<leader>tt', ':Telescope treesitter <CR>') -- treesitter symbol menu
+vim.keymap.set('n', '<leader>tp', ':Telescope builtin<CR>') -- picker picker lmao
+
+
diff --git a/nvim/lua/plugins/treesitter.lua b/nvim/lua/plugins/treesitter.lua
new file mode 100644
index 0000000..06536f3
--- /dev/null
+++ b/nvim/lua/plugins/treesitter.lua
@@ -0,0 +1,3 @@
+require('nvim-treesitter.configs').setup {
+ highlight = { enable = true }
+}