vim.opt.mouse = 'a' -- Enables mouse support in all modes vim.opt.nu = true -- Enables line numbers vim.opt.relativenumber = true -- Displays relative line numbers in the buffer vim.opt.tabstop = 4 -- Sets the number of spaces that a tab character represents vim.opt.softtabstop = 4 -- Sets the number of spaces per tab in the editor's buffer vim.opt.shiftwidth = 4 -- Sets the width for autoindents vim.opt.expandtab = true -- Converts tabs to spaces vim.opt.smartindent = true -- Enables intelligent autoindenting for new lines vim.opt.wrap = false -- Disables text wrapping vim.opt.swapfile = false -- Disables swap file creation vim.opt.backup = false -- Disables making a backup before overwriting a file vim.opt.ignorecase = true -- Makes searches case insensitive vim.opt.smartcase = true -- Makes searches case sensitive if there's a capital letter vim.opt.hlsearch = true -- Highlights all matches of the search pattern vim.opt.incsearch = true -- Starts searching before typing is finished vim.opt.termguicolors = true -- Enables true color support vim.opt.scrolloff = 20 -- Keeps 8 lines visible above/below the cursor vim.opt.signcolumn = "yes" -- Always show the sign column vim.opt.isfname:append("@-@") -- Allows '@' in filenames vim.opt.clipboard = "unnamedplus" -- Uses the system clipboard for all yank, delete, change and put operations vim.opt.undofile = true -- Enables persistent undo vim.opt.updatetime = 50 -- Sets the time after which the swap file is written (in milliseconds) vim.o.breakindent = true -- Makes wrapped lines visually indented vim.o.termguicolors = true -- Enables true color support (duplicated setting) vim.o.splitright = true -- Set horizontal splits to the right as default vim.o.splitbelow = true -- Set vertical splits to the bottom as default vim.o.completeopt = 'menuone,noselect' -- Configures how the completion menu works vim.o.winborder = 'rounded' -- LSP hover borders vim.opt.showmode = true --------------------------------------------------------------------------------- -- [[ PLUGINS ]] --------------------------------------------------------------------------------- vim.pack.add({ { src = "https://github.com/rebelot/kanagawa.nvim" }, { src = "https://github.com/neovim/nvim-lspconfig" }, { src = "https://github.com/nvim-mini/mini.nvim" }, { src = "https://github.com/stevearc/oil.nvim" }, { src = "https://github.com/akinsho/toggleterm.nvim" }, { src = "https://github.com/folke/trouble.nvim" }, { src = "https://github.com/tribela/transparent.nvim" } }) vim.cmd.colorscheme("kanagawa") require("trouble").setup() require("mini.pick").setup() require("mini.pairs").setup() require("mini.surround").setup() require("mini.statusline").setup() require("oil").setup({ view_options = { show_hidden = true, } }) require("toggleterm").setup({ open_mapping = [[]], direction = "float" }) --------------------------------------------------------------------------------- -- [[ KEYMAPS ]] --------------------------------------------------------------------------------- vim.g.mapleader = " " vim.keymap.set('n', '', 'noh', { silent = true }) vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) vim.keymap.set('n', 'cr', 'lua vim.lsp.buf.rename()') vim.keymap.set('n', 'ca', 'lua vim.lsp.buf.code_action()') vim.keymap.set("v", "", "", ">gv") vim.keymap.set("v", "J", ":m '>+1gv=gv") vim.keymap.set("v", "K", ":m '<-2gv=gv") vim.keymap.set("n", "p", "b#") vim.keymap.set("n", "x", "bd") vim.keymap.set("n", "f", ":Pick files") vim.keymap.set("n", "h", ":Pick help") vim.keymap.set("n", "s", ":Pick grep_live") vim.keymap.set("n", "b", ":Pick buffers") vim.keymap.set("n", "q", ":Trouble diagnostics toggle") vim.keymap.set("n", "e", ":Oil") -------------------------------------------------------------------------------- -- [[ LSP ]] --------------------------------------------------------------------------------- local servers = { "gopls" } for _, server in ipairs(servers) do vim.lsp.enable(server) end -------------------------------------------------------------------------------- -- [[ AUTOCMDS ]] --------------------------------------------------------------------------------- -- Highlight on Yank vim.api.nvim_create_autocmd('TextYankPost', { group = vim.api.nvim_create_augroup('YankHighlight', { clear = true }), callback = function() vim.highlight.on_yank() end, pattern = '*', })