From 33ddc3de885396359319afdf3d3d1a490ae448f8 Mon Sep 17 00:00:00 2001 From: cedricreper Date: Fri, 25 Apr 2025 09:36:09 +0900 Subject: [PATCH] config changes for my preferences --- init.lua | 150 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 95 insertions(+), 55 deletions(-) diff --git a/init.lua b/init.lua index 776c6873..d4b64cea 100644 --- a/init.lua +++ b/init.lua @@ -62,7 +62,6 @@ Kickstart Guide: This should be the first place you go to look when you're stuck or confused with something. It's one of my favorite Neovim features. - MOST IMPORTANTLY, we provide a keymap "sh" to [s]earch the [h]elp documentation, which is very useful when you're not exactly sure of what you're looking for. @@ -90,9 +89,6 @@ P.S. You can delete this when you're done too. It's your config now! :) vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' --- Set to true if you have a Nerd Font installed and selected in the terminal -vim.g.have_nerd_font = false - -- [[ Setting options ]] -- See `:help vim.opt` -- NOTE: You can change these options as you wish! @@ -102,7 +98,7 @@ vim.g.have_nerd_font = false 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' @@ -110,6 +106,8 @@ vim.opt.mouse = 'a' -- Don't show the mode, since it's already in the status line vim.opt.showmode = false +-- Don't wrap long words +vim.opt.wrap = false -- Sync clipboard between OS and Neovim. -- Schedule the setting after `UiEnter` because it can increase startup-time. -- Remove this option if you want your OS clipboard to remain independent. @@ -161,6 +159,11 @@ vim.opt.scrolloff = 10 -- See `:help 'confirm'` vim.opt.confirm = true +vim.opt.guicursor = { + 'n-v-c:block-Cursor/lCursor-blinkwait1000-blinkon100-blinkoff100', + 'i-ci:ver25-Cursor/lCursor-blinkwait1000-blinkon100-blinkoff100', + 'r:hor50-Cursor/lCursor-blinkwait100-blinkon100-blinkoff100', +} -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` @@ -180,10 +183,10 @@ vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagn vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) -- TIP: Disable arrow keys in normal mode --- vim.keymap.set('n', '', 'echo "Use h to move!!"') --- vim.keymap.set('n', '', 'echo "Use l to move!!"') --- vim.keymap.set('n', '', 'echo "Use k to move!!"') --- vim.keymap.set('n', '', 'echo "Use j to move!!"') +vim.keymap.set('n', '', 'echo "Use h to move!!"') +vim.keymap.set('n', '', 'echo "Use l to move!!"') +vim.keymap.set('n', '', 'echo "Use k to move!!"') +vim.keymap.set('n', '', 'echo "Use j to move!!"') -- Keybinds to make split navigation easier. -- Use CTRL+ to switch between windows @@ -194,11 +197,11 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the right win vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) --- NOTE: Some terminals have colliding keymaps or are not able to send distinct keycodes +-- NOTE: Some trminals have colliding keymaps or are not able to send distinct keycodes -- vim.keymap.set("n", "", "H", { desc = "Move window to the left" }) -- vim.keymap.set("n", "", "L", { desc = "Move window to the right" }) -- vim.keymap.set("n", "", "J", { desc = "Move window to the lower" }) --- vim.keymap.set("n", "", "K", { desc = "Move window to the upper" }) +-- vim.keymap.sut("n", "", "K", { desc = "Move window to the upper" }) -- [[ Basic Autocommands ]] -- See `:help lua-guide-autocommands` @@ -247,7 +250,48 @@ require('lazy').setup({ -- -- Use `opts = {}` to automatically pass options to a plugin's `setup()` function, forcing the plugin to be loaded. -- - + { + 'christoomey/vim-tmux-navigator', + cmd = { + 'TmuxNavigateLeft', + 'TmuxNavigateDown', + 'TmuxNavigateUp', + 'TmuxNavigateRight', + 'TmuxNavigatePrevious', + 'TmuxNavigatorProcessList', + }, + keys = { + { '', 'TmuxNavigateLeft' }, + { '', 'TmuxNavigateDown' }, + { '', 'TmuxNavigateUp' }, + { '', 'TmuxNavigateRight' }, + { '', 'TmuxNavigatePrevious' }, + }, + }, + { + 'stevearc/oil.nvim', + ---@module 'oil' + ---@type oil.SetupOpts + opts = {}, + -- Optional dependencies + dependencies = { { 'echasnovski/mini.icons', opts = {} } }, + -- dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if you prefer nvim-web-devicons + -- Lazy loading is not recommended because it is very tricky to make it work correctly in all situations. + lazy = false, + config = function() + require('oil').setup { + vim.keymap.set('n', '-', 'Oil', { desc = 'Open parent directory' }), + } + end, + }, + { + 'nvimdev/dashboard-nvim', + event = 'VimEnter', + config = function() + require('dashboard').setup {} + end, + dependencies = { { 'nvim-tree/nvim-web-devicons' } }, + }, -- Alternatively, use `config = function() ... end` for full control over the configuration. -- If you prefer to call `setup` explicitly, use: -- { @@ -298,11 +342,8 @@ require('lazy').setup({ -- this setting is independent of vim.opt.timeoutlen delay = 0, icons = { - -- set icon mappings to true if you have a Nerd Font - mappings = vim.g.have_nerd_font, - -- If you are using a Nerd Font: set icons.keys to an empty table which will use the - -- default which-key.nvim defined Nerd Font icons, otherwise define a string table - keys = vim.g.have_nerd_font and {} or { + mappings = false, + keys = { Up = ' ', Down = ' ', Left = ' ', @@ -369,9 +410,7 @@ require('lazy').setup({ end, }, { 'nvim-telescope/telescope-ui-select.nvim' }, - - -- Useful for getting pretty icons, but requires a Nerd Font. - { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, + { 'nvim-tree/nvim-web-devicons', enabled = false }, }, config = function() -- Telescope is a fuzzy finder that comes with a lot of different things that @@ -405,6 +444,10 @@ require('lazy').setup({ -- }, -- }, -- pickers = {} + defaults = { + layout_strategy = 'vertical', + layout_config = { preview_cutoff = 0, width = { padding = 0 }, height = { padding = 0 } }, + }, extensions = { ['ui-select'] = { require('telescope.themes').get_dropdown(), @@ -434,7 +477,7 @@ require('lazy').setup({ -- You can pass additional configuration to Telescope to change the theme, layout, etc. builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { winblend = 10, - previewer = false, + previewer = true, }) end, { desc = '[/] Fuzzily search in current buffer' }) @@ -624,14 +667,7 @@ require('lazy').setup({ severity_sort = true, float = { border = 'rounded', source = 'if_many' }, underline = { severity = vim.diagnostic.severity.ERROR }, - signs = vim.g.have_nerd_font and { - text = { - [vim.diagnostic.severity.ERROR] = '󰅚 ', - [vim.diagnostic.severity.WARN] = '󰀪 ', - [vim.diagnostic.severity.INFO] = '󰋽 ', - [vim.diagnostic.severity.HINT] = '󰌶 ', - }, - } or {}, + signs = {}, virtual_text = { source = 'if_many', spacing = 2, @@ -665,16 +701,16 @@ require('lazy').setup({ local servers = { -- clangd = {}, -- gopls = {}, - -- pyright = {}, - -- rust_analyzer = {}, + pyright = {}, + zls = {}, + rust_analyzer = {}, -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- -- Some languages (like typescript) have entire language plugins that can be useful: -- https://github.com/pmizio/typescript-tools.nvim -- -- But for many setups, the LSP (`ts_ls`) will work just fine - -- ts_ls = {}, - -- + ts_ls = {}, lua_ls = { -- cmd = { ... }, @@ -779,12 +815,6 @@ require('lazy').setup({ 'L3MON4D3/LuaSnip', version = '2.*', build = (function() - -- Build Step is needed for regex support in snippets. - -- This step is not supported in many windows environments. - -- Remove the below condition to re-enable on windows. - if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then - return - end return 'make install_jsregexp' end)(), dependencies = { @@ -873,20 +903,15 @@ require('lazy').setup({ -- change the command in the config to whatever the name of that colorscheme is. -- -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. - 'folke/tokyonight.nvim', + 'rebelot/kanagawa.nvim', priority = 1000, -- Make sure to load this before all the other start plugins. config = function() ---@diagnostic disable-next-line: missing-fields - require('tokyonight').setup { - styles = { - comments = { italic = false }, -- Disable italics in comments - }, + require('kanagawa').setup { + commentStyle = { italic = true }, + theme = 'wave', } - - -- Load the colorscheme here. - -- Like many other themes, this one has different styles, and you could load - -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. - vim.cmd.colorscheme 'tokyonight-night' + vim.cmd 'colorscheme kanagawa' end, }, @@ -915,8 +940,8 @@ require('lazy').setup({ -- You could remove this setup call if you don't like it, -- and try some other statusline plugin local statusline = require 'mini.statusline' - -- set use_icons to true if you have a Nerd Font - statusline.setup { use_icons = vim.g.have_nerd_font } + + statusline.setup { use_icons = false } -- You can configure sections in the statusline by overriding their -- default behavior. For example, here we set the section for @@ -936,7 +961,24 @@ require('lazy').setup({ main = 'nvim-treesitter.configs', -- Sets main module to use for opts -- [[ Configure Treesitter ]] See `:help nvim-treesitter` opts = { - ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }, + ensure_installed = { + 'zig', + 'python', + 'typescript', + 'rust', + 'htmldjango', + 'bash', + 'c', + 'diff', + 'html', + 'lua', + 'luadoc', + 'markdown', + 'markdown_inline', + 'query', + 'vim', + 'vimdoc', + }, -- Autoinstall languages that are not installed auto_install = true, highlight = { @@ -984,9 +1026,7 @@ require('lazy').setup({ -- you can continue same window with `sr` which resumes last telescope search }, { ui = { - -- If you are using a Nerd Font: set icons to an empty table which will use the - -- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table - icons = vim.g.have_nerd_font and {} or { + icons = { cmd = '⌘', config = '🛠', event = '📅',