----- Plugins ------------------------------------------------------------- local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not (vim.uv or vim.loop).fs_stat(lazypath) then local lazyrepo = "https://github.com/folke/lazy.nvim.git" local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) if vim.v.shell_error ~= 0 then vim.api.nvim_echo({ { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, { out, "WarningMsg" }, { "\nPress any key to exit..." }, }, true, {}) vim.fn.getchar() os.exit(1) end end vim.opt.rtp:prepend(lazypath) require("lazy").setup({ spec = { { "folke/todo-comments.nvim", dependencies = { "nvim-lua/plenary.nvim" }, opts = { signs = false } }, { 'numToStr/Comment.nvim', opts = { } }, { 'lewis6991/gitsigns.nvim', }, { 'nvim-telescope/telescope.nvim', version = '*', dependencies = { 'nvim-lua/plenary.nvim', { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }, } }, { 'Vonr/align.nvim', branch = "v2", lazy = true, init = function() -- mappings here... end }, { "L3MON4D3/LuaSnip", version = "v2.5", }, }, install = { colorscheme = { "habamax" } }, checker = { enabled = false }, -- automatic updates }) ----- Settings ------------------------------------------------------------ vim.cmd("filetype plugin indent on") vim.cmd("colorscheme habamax") -- or wildchart vim.opt.backup = false vim.opt.writebackup = false vim.opt.swapfile = false vim.opt.number = true vim.opt.tabstop = 8 vim.opt.shiftwidth = 4 vim.opt.softtabstop = 4 vim.opt.expandtab = true vim.opt.autoindent = true vim.opt.smarttab = true vim.opt.mouse = "a" vim.opt.laststatus = 2 vim.opt.scrolloff = 5 vim.opt.ignorecase = true vim.opt.hlsearch = true vim.opt.incsearch = true vim.opt.wrap = false vim.opt.timeoutlen = 1000 vim.opt.ttimeoutlen = 0 vim.opt.hidden = true vim.opt.wildmenu = true vim.opt.clipboard = "unnamed,unnamedplus" vim.opt.colorcolumn = "75" -- vim.opt.backspace = { "indent", "eol", "start" } vim.opt.updatetime = 100 vim.opt.signcolumn = "auto" vim.g.mapleader = " " vim.g.maplocalleader = "\\" function! ResizeIfTooWide() let max_width = float2nr(&columns * 0.8) if winwidth(0) > max_width execute 'vertical resize ' . float2nr(&columns * 0.5) endif endfunction ----- Keybinds ------------------------------------------------------------ local map = vim.keymap.set local NS = { noremap = true, silent = true } map("n", "gw", ":bdelete", NS) map("n", "K", "", NS) map("v", ">", ">gv", NS) map("v", "<", "+1gv=gv", NS) map("v", "K", ":m '<-2gv=gv", NS) map("n", "H", ":bnextzz", NS) map("n", "L", ":bprevzz", NS) map("n", ",", ":copen", NS) map("n", ">", ":cn", NS) map("n", "<", ":cp", NS) map("n", "\\", ":noh", NS) map("n", "E", ":Ex", NS) map("n", "z", ":set relativenumber", NS) map("n", "x", ":set norelativenumber", NS) map("n", "gb", ":make", NS) map("n", "gs", ":w", NS) map("n", "ghp", ":Gitsigns preview_hunk_inline", NS) map("n", "gs", ":w", NS) map('n', 'ff', function() require('telescope.builtin').find_files() end, NS) map('n', 'fg', function() require('telescope.builtin').live_grep() end, NS) map('x', 'ga', function() require('align').align_to_string({ preview = true, regex = false }) end, NS) map({'i'}, '', function() require('luasnip').expand() end, NS) map({'i', 's'}, '', function() require('luasnip').jump( 1) end, NS) map({'i', 's'}, '', function() require('luasnip').jump(-1) end, NS) map({'i', 's'}, '', function() if require('luasnip').choice_active() then require('luasnip').change_choice(1) end end, NS) map("n", "#", ":execute 'vertical resize ' . float2nr(&columns * 0.9)", NS)