From ec4a477c3a31ef7072bc277c2832e972722abba6 Mon Sep 17 00:00:00 2001 From: Gabe Venberg Date: Wed, 10 Jan 2024 16:04:56 -0600 Subject: [PATCH] added vitual chars for whitespaces. --- neovim/.config/nvim/init.lua | 69 ++++++++++++++++++------------ nvim_minimal/.config/nvim/init.lua | 11 +++++ 2 files changed, 52 insertions(+), 28 deletions(-) diff --git a/neovim/.config/nvim/init.lua b/neovim/.config/nvim/init.lua index 832153f..cf289f6 100644 --- a/neovim/.config/nvim/init.lua +++ b/neovim/.config/nvim/init.lua @@ -12,7 +12,7 @@ require('packages') --helper functions local function keyCode(string) - return vim.api.nvim_replace_termcodes(str, true, true, true, true) + return vim.api.nvim_replace_termcodes(str, true, true, true, true) end local wk = require("which-key") @@ -35,7 +35,7 @@ opt.breakindent = true opt.colorcolumn = "80,100,120" --add ruler to side of screen. opt.number = true -opt.numberwidth=3 +opt.numberwidth = 3 --displays cordinates of your cursor in statusbar opt.ruler = true --always leave 5 cells between cursor and side of window. @@ -58,8 +58,8 @@ opt.autoindent = true opt.smartindent = true opt.smarttab = true --space based tabs. -opt.softtabstop=-1 --negative value inherrits shiftwidth. -opt.expandtab=true +opt.softtabstop = -1 --negative value inherrits shiftwidth. +opt.expandtab = true --highlight search results as you type. opt.hlsearch = true opt.incsearch = true @@ -72,9 +72,20 @@ opt.fillchars = 'stl:=,stlnc: ,vert:|,fold:-' opt.foldcolumn = 'auto:4' opt.foldenable = true opt.foldignore = '' +--display whitespace as other chars: +opt.list = true +opt.listchars = { + tab = '>-', + eol = '↲', + nbsp='␣', + trail='•', + extends = '⟩', + precedes = '⟨' +} +opt.showbreak = '↪' --sets colorscheme. to get a list of avalible options, do colorscheme -vim.opt.background="dark" +vim.opt.background = "dark" -- vim.cmd 'colorscheme moonfly' -- vim.cmd 'colorscheme nightfly' -- vim.cmd 'colorscheme nordic' @@ -83,27 +94,27 @@ 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 + 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} + return { silent = true, desc = desc } end --toggle spell check map('n', 'cs', ':setlocal spell!', optsWithDesc("toggle spell check")) @@ -125,9 +136,9 @@ map('n', 't', ':NvimTreeToggle', optsWithDesc("toggle file browser") --telescope stuff -- setup leader-f prefix in whitch-key wk.register { - ["f"]={ - name="+telescope" - } + ["f"] = { + name = "+telescope" + } } map('n', 'ff', ':Telescope find_files', optsWithDesc("find files")) map('n', 'fg', ':Telescope live_grep', optsWithDesc("grep")) @@ -151,8 +162,10 @@ map('n', 'v', ":lua Toggle_venn()", optsWithDesc("toggle venn.nvim")) -- treesj map('n', 'j', ':TSJToggle', optsWithDesc("treesitter split/join")) -- a dedicated floating scratch terminal, seperate from the normal toggleterm terminals. -local Terminal = require('toggleterm.terminal').Terminal -Floatingterm = Terminal:new({ hidden = true, -direction="float"}) +local Terminal = require('toggleterm.terminal').Terminal +Floatingterm = Terminal:new({ + hidden = true, + direction = "float" +}) vim.api.nvim_set_keymap("n", "s", ':lua Floatingterm:toggle()', optsWithDesc("open scratch terminal")) diff --git a/nvim_minimal/.config/nvim/init.lua b/nvim_minimal/.config/nvim/init.lua index f06e807..3ca764d 100644 --- a/nvim_minimal/.config/nvim/init.lua +++ b/nvim_minimal/.config/nvim/init.lua @@ -68,6 +68,17 @@ opt.fillchars = 'stl:=,stlnc: ,vert:|,fold:-' opt.foldcolumn = 'auto:4' opt.foldenable = true opt.foldignore = '' +--display whitespace as other chars: +opt.list = true +opt.listchars = { + tab = '>-', + eol = '↲', + nbsp='␣', + trail='•', + extends = '⟩', + precedes = '⟨' +} +opt.showbreak = '↪' --keyboard mappings local function optsWithDesc(desc)