-- ctrl-s as save vim.keymap.set('n', '', ':w', { noremap = true, silent = true }) vim.keymap.set('i', '', ':w', { noremap = true, silent = true }) vim.keymap.set('v', '', ':wgv', { noremap = true, silent = true }) -- default indent vim.opt.tabstop = 2 vim.opt.softtabstop = 2 vim.opt.shiftwidth = 2 vim.opt.expandtab = true vim.opt.autoindent = true vim.opt.smartindent = true -- go indent local go_augroup = vim.api.nvim_create_augroup("GoSpecificSettings", { clear = true }) vim.api.nvim_create_autocmd("FileType", { pattern = "go", group = go_augroup, callback = function() vim.opt_local.tabstop = 8 vim.opt_local.softtabstop = 8 vim.opt_local.shiftwidth = 8 vim.opt_local.expandtab = false end, }) -- perl settings vim.g.perl_host_prog = "/usr/bin/perl" -- leader key vim.g.mapleader = " " vim.g.maplocalleader = " " -- lazy 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", lazypath, }) end vim.opt.rtp:prepend(lazypath) -- lazy plugins require("lazy").setup({ { "nvim-telescope/telescope.nvim", tag = "0.1.8", dependencies = { "nvim-lua/plenary.nvim", { "nvim-telescope/telescope-fzf-native.nvim", build = "make", }, }, config = function() local telescope = require("telescope") telescope.setup({ defaults = { extensions = { fzf = { fuzzy = true, override_generic_sorter = true, override_file_sorter = true, case_mode = "smart_case", }, }, }, }) telescope.load_extension("fzf") vim.keymap.set("n", "ff", 'Telescope find_files', { desc = "Find Files" }) vim.keymap.set("n", "fg", 'Telescope live_grep', { desc = "Live Grep" }) vim.keymap.set("n", "fb", 'Telescope buffers', { desc = "Find Buffers" }) end, }, { 'kylechui/nvim-surround', version = "*", event = "VeryLazy", }, { 'windwp/nvim-autopairs', event = "InsertEnter", config = true }, { "williamboman/mason.nvim", dependencies = { "williamboman/mason-lspconfig.nvim", "neovim/nvim-lspconfig", }, config = function() require("mason").setup({ ui = { icons = { package_installed = "✓", package_pending = "➜", package_uninstalled = "✗" } } }) require("mason-lspconfig").setup({ ensure_installed = { "lua_ls" }, }) end }, { "stevearc/conform.nvim", event = { "BufWritePre" }, keys = { { "fm", function() require("conform").format() end, desc = "Format file" }, }, opts = { formatters_by_ft = { go = { "goimports" }, }, format_on_save = { lsp_fallback = true, async = false, timeout_ms = 1000, }, }, dependencies = { "mason.nvim" }, }, { "sainnhe/sonokai", lazy = false, priority = 1000, config = function() -- Optional: Choose a variant (e.g., 'shusia', 'maia', 'espresso', 'atlantis', or 'andromeda') vim.g.sonokai_style = 'atlantis' -- Optional: Enable transparent background vim.g.sonokai_transparent_background = '1' vim.cmd.colorscheme("sonokai") end, }, }) -- lsp actions vim.api.nvim_create_autocmd("LspAttach", { desc = "LSP actions", callback = function(event) local opts = { buffer = event.buf } vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) vim.keymap.set("n", "K", vim.lsp.buf.hover, opts) vim.keymap.set("n", "rn", vim.lsp.buf.rename, opts) vim.keymap.set("n", "ca", vim.lsp.buf.code_action, opts) vim.keymap.set("n", "gr", vim.lsp.buf.references, opts) -- diagnostics vim.keymap.set("n", "e", vim.diagnostic.open_float, opts) end, })