From 372f34a735851c2ab35b6ed478f82f96fbe6badb Mon Sep 17 00:00:00 2001 From: FelixTCP <78813397+FelixTCP@users.noreply.github.com> Date: Sun, 11 Aug 2024 04:30:05 +0200 Subject: [PATCH] latest changes --- init.lua | 67 ++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 50 insertions(+), 17 deletions(-) diff --git a/init.lua b/init.lua index 013fcc29..53bee8f6 100644 --- a/init.lua +++ b/init.lua @@ -91,7 +91,7 @@ vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' -- Set to true if you have a Nerd Font installed -vim.g.have_nerd_font = false +vim.g.have_nerd_font = true -- [[ Setting options ]] -- See `:help vim.opt` @@ -99,10 +99,10 @@ vim.g.have_nerd_font = false -- For more options, you can see `:help option-list` -- Make line numbers default -vim.opt.number = true +-- vim.opt.number = true -- You can also add relative line numbers, to help with jumping. -- Experiment for yourself to see if you like it! --- vim.opt.relativenumber = true +vim.opt.relativenumber = true -- Enable mouse mode, can be useful for resizing splits for example! vim.opt.mouse = 'a' @@ -161,6 +161,10 @@ vim.opt.scrolloff = 10 vim.opt.hlsearch = true vim.keymap.set('n', '', 'nohlsearch') +vim.keymap.set('i', '', ':Oil:vertical resize 30') +vim.keymap.set('n', '', ':Oil:vertical resize 30') +vim.keymap.set('v', '', ':Oil:vertical resize 30') + -- Diagnostic keymaps vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' }) vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' }) @@ -280,12 +284,14 @@ require('lazy').setup({ require('which-key').setup() -- Document existing key chains - require('which-key').register { - ['c'] = { name = '[C]ode', _ = 'which_key_ignore' }, - ['d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, - ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, - ['s'] = { name = '[S]earch', _ = 'which_key_ignore' }, - ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, + require('which-key').add { + { 'c', group = '[C]ode' }, + { 'd', group = '[D]ocument' }, + { 'r', group = '[R]ename' }, + { 's', group = '[S]earch' }, + { 'w', group = '[W]orkspace' }, + { 't', group = '[T]oggle' }, + { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, } end, }, @@ -401,7 +407,16 @@ require('lazy').setup({ end, { desc = '[S]earch [N]eovim files' }) end, }, - + { -- File Tree (open with '-') + 'stevearc/oil.nvim', + opts = {}, + -- Optional dependencies + dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = function() + require('oil').setup() + vim.keymap.set('n', '-', 'Oil', { desc = 'Open parent directory' }) + end, + }, { -- LSP Configuration & Plugins 'neovim/nvim-lspconfig', dependencies = { @@ -538,9 +553,9 @@ require('lazy').setup({ -- - settings (table): Override the default settings passed when initializing the server. -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ local servers = { - -- clangd = {}, + clangd = {}, -- gopls = {}, - -- pyright = {}, + pyright = {}, -- rust_analyzer = {}, -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- @@ -606,7 +621,7 @@ require('lazy').setup({ -- Disable "format_on_save lsp_fallback" for languages that don't -- have a well standardized coding style. You can add additional -- languages here or re-enable it for the disabled ones. - local disable_filetypes = { c = true, cpp = true } + local disable_filetypes = { c = true } return { timeout_ms = 500, lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype], @@ -615,8 +630,8 @@ require('lazy').setup({ formatters_by_ft = { lua = { 'stylua' }, -- Conform can also run multiple formatters sequentially - -- python = { "isort", "black" }, - -- + python = { 'ruff_format' }, + cpp = { 'clang-format' }, -- You can use a sub-list to tell conform to run *until* a formatter -- is found. -- javascript = { { "prettierd", "prettier" } }, @@ -688,10 +703,11 @@ require('lazy').setup({ [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), - -- Accept ([y]es) the completion. + -- Accept the completion (Enter or Tab). -- This will auto-import if your LSP supports it. -- This will expand snippets if the LSP sent a snippet. - [''] = cmp.mapping.confirm { select = true }, + [''] = cmp.mapping.confirm { select = true }, + [''] = cmp.mapping.confirm { select = true }, -- Manually trigger a completion from nvim-cmp. -- Generally you don't need this, because nvim-cmp will display @@ -817,6 +833,23 @@ require('lazy').setup({ -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects end, }, + { + 'christoomey/vim-tmux-navigator', + cmd = { + 'TmuxNavigateLeft', + 'TmuxNavigateDown', + 'TmuxNavigateUp', + 'TmuxNavigateRight', + 'TmuxNavigatePrevious', + }, + keys = { + { '', 'TmuxNavigateLeft' }, + { '', 'TmuxNavigateDown' }, + { '', 'TmuxNavigateUp' }, + { '', 'TmuxNavigateRight' }, + { '', 'TmuxNavigatePrevious' }, + }, + }, -- The following two comments only work if you have downloaded the kickstart repo, not just copy pasted the -- init.lua. If you want these files, they are in the repository, so you can just download them and