From 6c1793d98f244f0b6fc1b9eb163647dc9032f358 Mon Sep 17 00:00:00 2001 From: Cody Hiar Date: Fri, 3 Sep 2021 22:22:12 -0600 Subject: More work on lua config --- init.lua.backup | 70 +++++++++++++++-------------- lua/settings.lua | 110 +++++++++++++++++++++++++++++++++++++++++++++ plugin/packer_compiled.lua | 13 ------ 3 files changed, 147 insertions(+), 46 deletions(-) diff --git a/init.lua.backup b/init.lua.backup index 7460139..8dbeee2 100644 --- a/init.lua.backup +++ b/init.lua.backup @@ -9,8 +9,8 @@ local fn = vim.fn local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' if fn.empty(fn.glob(install_path)) > 0 then - fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) - vim.cmd 'packadd packer.nvim' + fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) + vim.cmd 'packadd packer.nvim' end -- Install My Stuff @@ -23,44 +23,48 @@ vim.cmd "nnoremap / Telescope live_grep" vim.cmd "nnoremap fb Telescope buffers" vim.cmd "nnoremap fg lua require('telescope.builtin').git_status()" +--[[ vim.cmd "let g:python3_host_prog = expand('~/venv/bin/python3')" vim.cmd "let g:rnvimr_enable_ex = 1" vim.cmd "let g:rnvimr_enable_picker = 1" vim.cmd "nnoremap m :RnvimrToggle" vim.cmd "let g:rnvimr_action = { '': 'NvimEdit tabedit' }" +]]-- -vim.cmd "au BufWritePost lua require('lint').try_lint()" +--vim.cmd "au BufWritePost lua require('lint').try_lint()" return require('packer').startup(function() - use 'wbthomason/packer.nvim' - use 'Thornycrackers-Forks/nord-vim' - use { - 'nvim-treesitter/nvim-treesitter', - run = ':TSUpdate', - config = function() - require "treesitterconf" - end, - } - use { - "neovim/nvim-lspconfig", - config = function() - require "lspconfigconf" - end, - } - use 'nvim-treesitter/playground' - use { - 'nvim-telescope/telescope.nvim', - requires = { {'nvim-lua/plenary.nvim'} }, - config = function() - require "telescopeconf" - end, - } - use 'kevinhwang91/rnvimr' - use { - 'jose-elias-alvarez/null-ls.nvim', - config = function() - require "nvimlintconf" - end, - } + use 'wbthomason/packer.nvim' + use 'Thornycrackers-Forks/nord-vim' + use { + 'nvim-treesitter/nvim-treesitter', + run = ':TSUpdate', + config = function() + require "treesitterconf" + end, + } + use { + "neovim/nvim-lspconfig", + config = function() + require "lspconfigconf" + end, + } + use 'nvim-treesitter/playground' + use { + 'nvim-telescope/telescope.nvim', + requires = { {'nvim-lua/plenary.nvim'} }, + config = function() + require "telescopeconf" + end, + } + -- use 'kevinhwang91/rnvimr' + --[[ + use { + 'jose-elias-alvarez/null-ls.nvim', + config = function() + require "nvimlintconf" + end, + } + ]]-- end) diff --git a/lua/settings.lua b/lua/settings.lua index e0ecddb..4e0b209 100644 --- a/lua/settings.lua +++ b/lua/settings.lua @@ -1,5 +1,115 @@ +--[[ +Todo + +https://dev.to/voyeg3r/writing-useful-lua-functions-to-my-neovim-14ki +function to remove whitespace and preserve spot on save + + + + + +]]-- local o = vim.o local g = vim.g +local cmd = vim.cmd +local map = vim.api.nvim_set_keymap +-- https://old.reddit.com/r/neovim/comments/lrz18i/how_to_change_colorscheme_in_lua_without_any/ g.colors_name = "nord" +-- Set up spacebar as leader +map('n', '', '', {}) +vim.g.mapleader = ' ' + +-- Set spaces > tabs, 4 as default +o.expandtab = true +o.tabstop = 4 +o.shiftwidth = 0 + +o.wrap = false +o.history = 1000 +-- Wildmode show list, complete to first result +o.wildignore = "*/app/cache,*/vendor,*/env,*.pyc,*/venv,*/__pycache__,*/venv" +o.splitright = true +o.splitbelow = true +o.spelllang = "en_ca" + + +local highlights = { + "Search ctermfg=166", + "DiffAdd cterm=BOLD ctermfg=NONE ctermbg=22", + "DiffDelete cterm=BOLD ctermfg=NONE ctermbg=52", + "DiffChange cterm=BOLD ctermfg=NONE ctermbg=23", + "DiffText cterm=BOLD ctermfg=NONE ctermbg=23", + "Normal guibg=NONE ctermbg=NONE", + "Search ctermbg=None ctermfg=166", + "PrimaryBlock ctermfg=06 ctermbg=NONE", + "SecondaryBlock ctermfg=06 ctermbg=NONE", + "Blanks ctermfg=07 ctermbg=NONE", + "ColorColumn ctermbg=cyan", +} +for i, highlight in ipairs(highlights) do + cmd('au VimEnter * hi ' .. highlight) +end + +-- Along with the highlight definition for ColorColumn above, these options +-- will set colored marks at certain line lengths +cmd([[au BufEnter *.py let w:m1=matchadd('ColorColumn', '\%81v', 100)]]) +cmd([[au BufEnter *.py let w:m2=matchadd('Error', '\%121v', 100)]]) +cmd([[au BufLeave *.py call clearmatches()"]]) + + + +options = { noremap = true } + +map('n', 'y', ':let @+=@0', options) +map('n', '', ':noh', options) +map('i', 'jj', '', options) +map('n', 'gp', "`[v`]", options) + + + +-- Status Line +local mode_map = { + ['n'] = 'normal', + ['no'] = 'n·operator pending', + ['v'] = 'visual', + ['V'] = 'v·line', + [''] = 'v·block', + ['s'] = 'select', + ['S'] = 's·line', + [''] = 's·block', + ['i'] = 'insert', + ['R'] = 'replace', + ['Rv'] = 'v·replace', + ['c'] = 'command', + ['cv'] = 'vim ex', + ['ce'] = 'ex', + ['r'] = 'prompt', + ['rm'] = 'more', + ['r?'] = 'confirm', + ['!'] = 'shell', + ['t'] = 'terminal' +} + +local function mode() + local m = vim.api.nvim_get_mode().mode + if mode_map[m] == nil then return m end + return '[' .. mode_map[m] .. '] ' +end + +local stl = { + '%#PrimaryBlock#', + mode(), + '%#SecondaryBlock#', + '%#Blanks#', + '%f', + '%m', + '%=', + '%#SecondaryBlock#', + '%l,%c ', + '%#PrimaryBlock#', + '%{&filetype}', +} + +o.statusline = table.concat(stl) diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua index 7508661..e344373 100644 --- a/plugin/packer_compiled.lua +++ b/plugin/packer_compiled.lua @@ -73,11 +73,6 @@ _G.packer_plugins = { loaded = true, path = "/home/thorny/.local/share/nvim/site/pack/packer/start/nord-vim" }, - ["null-ls.nvim"] = { - config = { "\27LJ\2\n,\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\17nvimlintconf\frequire\0" }, - loaded = true, - path = "/home/thorny/.local/share/nvim/site/pack/packer/start/null-ls.nvim" - }, ["nvim-lspconfig"] = { config = { "\27LJ\2\n-\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\18lspconfigconf\frequire\0" }, loaded = true, @@ -100,10 +95,6 @@ _G.packer_plugins = { loaded = true, path = "/home/thorny/.local/share/nvim/site/pack/packer/start/plenary.nvim" }, - rnvimr = { - loaded = true, - path = "/home/thorny/.local/share/nvim/site/pack/packer/start/rnvimr" - }, ["telescope.nvim"] = { config = { "\27LJ\2\n-\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\18telescopeconf\frequire\0" }, loaded = true, @@ -112,10 +103,6 @@ _G.packer_plugins = { } time([[Defining packer_plugins]], false) --- Config for: null-ls.nvim -time([[Config for null-ls.nvim]], true) -try_loadstring("\27LJ\2\n,\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\17nvimlintconf\frequire\0", "config", "null-ls.nvim") -time([[Config for null-ls.nvim]], false) -- Config for: nvim-treesitter time([[Config for nvim-treesitter]], true) try_loadstring("\27LJ\2\n.\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\19treesitterconf\frequire\0", "config", "nvim-treesitter") -- cgit v1.2.3