--set some aliases to make typing this faster. local cmd = vim.cmd local opt = vim.opt local fn = vim.fn local map = vim.keymap.set --leader key is set through a variable, for some reason. vim.g.mapleader = ';' --do package management require('packages') --helper functions local function keyCode(string) return vim.api.nvim_replace_termcodes(str, true, true, true, true) end local wk = require("which-key") --options using vim.opt (aliased, of course.) opt.mouse = 'a' opt.lazyredraw = true opt.termguicolors = true opt.autoread = true opt.swapfile = false opt.history = 500 opt.formatoptions = 'rojq' --disable hard text wrapping, will only wrap visually. opt.textwidth = 0 opt.wrapmargin = 0 opt.wrap = true opt.linebreak = true opt.breakindent = true --add ruler to side of screen. opt.number = true opt.numberwidth=3 --displays cordinates of your cursor in statusbar opt.ruler = true --always leave 5 cells between cursor and side of window. opt.scrolloff = 5 --better command line completion opt.wildmenu = true --ignore case in search if search is all lowercase. opt.ignorecase = true opt.smartcase = true --show unfinished commands in statusbar. opt.showcmd = true --regex stuff opt.magic = true --always have a status line opt.laststatus = 2 --tab stuff opt.tabstop = 4 opt.shiftwidth = 0 --zero inherrits tabstop. opt.autoindent = true opt.smartindent = true opt.smarttab = true --space based tabs. -- opt.softtabstop=-1 --negative value inherrits shiftwidth. -- opt.expandtab=true --highlight search results as you type. opt.hlsearch = true opt.incsearch = true --foling stuff opt.foldlevelstart = 5 cmd([[source ~/.config/nvim/foldtext.vimrc]]) opt.foldmethod = 'indent' opt.foldtext = 'minimal_foldtext()' opt.fillchars = 'stl:=,stlnc: ,vert:|,fold:-' opt.foldcolumn = 'auto:4' opt.foldenable = true opt.foldignore = '' --sets colorscheme. to get a list of avalible options, do colorscheme vim.opt.background="dark" -- vim.cmd 'colorscheme moonfly' -- vim.cmd 'colorscheme nightfly' -- vim.cmd 'colorscheme nordic' vim.cmd 'colorscheme gruvbox' --function for venn.nvim -- venn.nvim: enable or disable keymappings function _G.Toggle_venn() local venn_enabled = vim.inspect(vim.b.venn_enabled) if venn_enabled == "nil" then vim.b.venn_enabled = true vim.cmd [[setlocal ve=all]] -- draw a line on HJKL keystokes vim.api.nvim_buf_set_keymap(0, "n", "J", "j:VBox", { noremap = true }) vim.api.nvim_buf_set_keymap(0, "n", "K", "k:VBox", { noremap = true }) vim.api.nvim_buf_set_keymap(0, "n", "L", "l:VBox", { noremap = true }) vim.api.nvim_buf_set_keymap(0, "n", "H", "h:VBox", { noremap = true }) -- draw a box by pressing "f" with visual selection vim.api.nvim_buf_set_keymap(0, "v", "f", ":VBox", { noremap = true }) else vim.cmd [[setlocal ve=]] vim.cmd [[mapclear ]] vim.b.venn_enabled = nil end end --keyboard mappings local function optsWithDesc(desc) return {silent=true, desc=desc} end --toggle spell check map('n', 'sp', ':setlocal spell!', optsWithDesc("toggle spell check")) --use ctrl+direction to move between splits. map('n', '', 'h', optsWithDesc("move to split to the right")) map('n', '', 'j', optsWithDesc("move to split below")) map('n', '', 'k', optsWithDesc("move to split above")) map('n', '', 'l', optsWithDesc("move to split to the left")) --toggle folds with space. map('n', '', 'za', optsWithDesc("toggle fold")) --clear highlighting with leader+h map('', 'h', ':nohls', optsWithDesc("clear highlighting")) --open file browser with leader+t map('n', 't', ':NvimTreeToggle', optsWithDesc("toggle file browser")) --open terminal with ctrl-\ --open symbols-outline with leader+o map('n', 'o', ':SymbolsOutline', optsWithDesc("toggle LSP symbol outline")) --telescope stuff -- setup leader-f prefix in whitch-key wk.register { ["f"]={ name="+telescope" } } map('n', 'ff', ':Telescope find_files', optsWithDesc("find files")) map('n', 'fg', ':Telescope live_grep', optsWithDesc("grep")) map('n', 'fb', ':Telescope buffers', optsWithDesc("find buffers")) map('n', 'fm', ':Telescope marks', optsWithDesc("find marks")) map('n', 'fp', ':Telescope registers', optsWithDesc("search registers")) map('n', 'fs', ':Telescope spell_suggest', optsWithDesc("search spelling suggestions")) map('n', 'fh', ':Telescope keymaps', optsWithDesc("search keymaps")) map('n', 'fz', ':Telescope current_buffer_fuzzy_find', optsWithDesc("fuzzy find")) map('n', 'fgc', ':Telescope git_commits', optsWithDesc("search git commits")) map('n', 'fgb', ':Telescope git_branches', optsWithDesc("search git branches")) map('n', 'fgs', ':Telescope git_stash', optsWithDesc("search git stash")) map('n', 'fto', ':TodoTelescope', optsWithDesc("search todos")) map('n', 'ft', ':Telescope treesitter', optsWithDesc("search treesitter")) --Treesitter context map('n', 'c', ':TSContextToggle', optsWithDesc("toggle ts context")) --tabline stuff (gt and gT are prev/next tab in stock vim) map('n', 'gf', ':bnext', optsWithDesc("next buffer")) map('n', 'gF', ':bprevious', optsWithDesc("prev buffer")) --gitsigns map('n', 'bl', ':Gitsigns toggle_current_line_blame', optsWithDesc("toggle inline git blame")) -- toggle keymappings for venn using v map('n', 'v', ":lua Toggle_venn()", optsWithDesc("toggle venn.nvim")) -- treesj map('n', 'j', ':TSJToggle', optsWithDesc("treesitter split/join"))