|
| 1 | +--set some aliases to make typing this faster. |
| 2 | +local cmd = vim.cmd |
| 3 | +local opt = vim.opt |
| 4 | +local fn = vim.fn |
| 5 | +local map = vim.api.nvim_set_keymap |
| 6 | + |
| 7 | +--leader key is set through a variable, for some reason. |
| 8 | +vim.g.mapleader = ';' |
| 9 | + |
| 10 | +--helper functions |
| 11 | +local function keyCode(string) |
| 12 | + return vim.api.nvim_replace_termcodes(str, true, true, true, true) |
| 13 | +end |
| 14 | + |
| 15 | +--options using vim.opt (aliased, of course.) |
| 16 | +opt.mouse = 'a' |
| 17 | +opt.lazyredraw = true |
| 18 | +opt.termguicolors = true |
| 19 | +opt.autoread = true |
| 20 | +opt.swapfile = false |
| 21 | +opt.history = 500 |
| 22 | +opt.formatoptions = 'rojq' |
| 23 | +--disable hard text wrapping, will only wrap visually. |
| 24 | +opt.textwidth = 0 |
| 25 | +opt.wrapmargin = 0 |
| 26 | +opt.wrap = true |
| 27 | +opt.linebreak = true |
| 28 | +opt.breakindent = true |
| 29 | +--add ruler to side of screen. |
| 30 | +opt.number = true |
| 31 | +opt.numberwidth=2 |
| 32 | +--displays cordinates of your cursor in statusbar |
| 33 | +opt.ruler = true |
| 34 | +--always leave 5 cells between cursor and side of window. |
| 35 | +opt.scrolloff = 5 |
| 36 | +--better command line completion |
| 37 | +opt.wildmenu = true |
| 38 | +--ignore case in search if search is all lowercase. |
| 39 | +opt.ignorecase = true |
| 40 | +opt.smartcase = true |
| 41 | +--show unfinished commands in statusbar. |
| 42 | +opt.showcmd = true |
| 43 | +--regex stuff |
| 44 | +opt.magic = true |
| 45 | +--always have a status line |
| 46 | +opt.laststatus = 2 |
| 47 | +--tab stuff |
| 48 | +opt.tabstop = 4 |
| 49 | +opt.shiftwidth = 0 --zero inherrits tabstop. |
| 50 | +opt.autoindent = true |
| 51 | +opt.smartindent = true |
| 52 | +opt.smarttab = true |
| 53 | +--space based tabs. |
| 54 | +-- opt.softtabstop=-1 --negative value inherrits shiftwidth. |
| 55 | +-- opt.expandtab=true |
| 56 | +--highlight search results as you type. |
| 57 | +opt.hlsearch = true |
| 58 | +opt.incsearch = true |
| 59 | +--foling stuff |
| 60 | +opt.foldlevelstart = 5 |
| 61 | +cmd([[source ~/.config/nvim/foldtext.vimrc]]) |
| 62 | +opt.foldmethod = 'indent' |
| 63 | +opt.foldtext = 'minimal_foldtext()' |
| 64 | +opt.fillchars = 'stl:=,stlnc: ,vert:|,fold:-' |
| 65 | +opt.foldcolumn = '4' |
| 66 | +opt.foldenable = true |
| 67 | +opt.foldignore = '' |
| 68 | + |
| 69 | +--keyboard mappings |
| 70 | +local opts = { noremap = true, silent = true } |
| 71 | +--toggle spell check |
| 72 | +map('n', '<leader>sp', ':setlocal spell!<CR>', opts) |
| 73 | +--use ctrl+direction to move between splits. |
| 74 | +map('n', '<C-h>', '<C-w>h', opts) |
| 75 | +map('n', '<C-j>', '<C-w>j', opts) |
| 76 | +map('n', '<C-k>', '<C-w>k', opts) |
| 77 | +map('n', '<C-l>', '<C-w>l', opts) |
| 78 | +--toggle folds with space. |
| 79 | +map('', '<Space>', 'za', opts) |
| 80 | +--clear highlighting with leader+h |
| 81 | +map('', '<leader>h', ':nohls<CR>', opts) |
0 commit comments