1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
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', '<Space>', '', {})
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', '<leader>y', ':let @+=@0<cr>', options)
map('n', '<leader><leader>', ':noh<cr>', options)
map('i', 'jj', '<esc>', 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)
|