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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
vim.g.mapleader = ","
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("config") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
-- Setup lazy.nvim
require("lazy").setup({
spec = {
{
'nvim-lualine/lualine.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' }
},
{
'vimwiki/vimwiki',
-- Use `init`, NOT `config`, to set globals before load.
init = function()
vim.g.vimwiki_ext2syntax = {
['.Rmd'] = 'markdown',
['.rmd'] = 'markdown',
['.md'] = 'markdown',
['.markdown'] = 'markdown',
['.mdown'] = 'markdown'
}
vim.g.vimwiki_list = {
{ path = '~/.local/share/vimwiki', syntax = 'markdown', ext = '.md' },
{ path = '~/.local/share/vimwiki/Finance', syntax = 'markdown', ext = '.md' },
{ path = '~/.local/share/vimwiki/Finance/Fundamentals', syntax = 'markdown', ext = '.md' },
{ path = '~/.local/share/vimwiki/Finance/Research', syntax = 'markdown', ext = '.md' },
{ path = '~/.local/share/vimwiki/Finance/Research/Tickers', syntax = 'markdown', ext = '.md' },
{ path = '~/.local/share/vimwiki/cs', syntax = 'markdown', ext = '.md' },
{ path = '~/.local/share/vimwiki/cs/Gentoo', syntax = 'markdown', ext = '.md' },
{ path = '~/.local/share/vimwiki/arcana', syntax = 'markdown', ext = '.md' },
{ path = '~/.local/share/Cuisine', syntax = 'markdown', ext = '.md' },
}
vim.g.vimwiki_sync_commit_message = 'Auto from nzxt - %c'
end,
-- Optionally, you can lazy-load Vimwiki only for specific filetypes or via keymaps:
-- event = "BufEnter *.md",
-- keys = { "<leader>ww"},
},
{
'michal-h21/vimwiki-sync',
init = function()
vim.g.vimwiki_sync_commit_message = 'Auto from nzxt - %c'
end,
},
{
'MeanderingProgrammer/render-markdown.nvim',
dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.nvim' },
---@module 'render-markdown'
---@type render.md.UserConfig
opts = {},
}
},
-- automatically check for plugin updates
checker = { enabled = true },
})
-- General settings
vim.opt.title = true
vim.opt.mouse = "a"
vim.opt.clipboard:append("unnamedplus")
vim.opt.showmode = false
vim.opt.ruler = false
vim.opt.laststatus = 0
vim.opt.showcmd = false
vim.opt.scrolloff = 7
vim.opt.swapfile = false
vim.opt.backup = false
vim.cmd('colorscheme bloomberg')
--vim.cmd('hi Normal ctermbg=NONE')
--vim.cmd('hi NonText ctermbg=NONE')
--
--require("pyrepl").setup({
-- url = "http://localhost:5000/execute"
--})
--vim.keymap.set('v', '<leader>p', function()
-- require('pyrepl').run_selected_lines()
-- end, { desc = "Run selected lines" })
--require ............
require('lualine').setup()
--ensure render-markdown also render vimwiki
vim.treesitter.language.register('markdown', 'vimwiki')
-- Basics
vim.keymap.set('n', 'c', '"_c')
vim.cmd('filetype plugin on')
vim.cmd('syntax on')
vim.opt.encoding = "utf-8"
vim.opt.number = true
vim.opt.relativenumber = true
-- Enable autocmpletion:
vim.opt.wildmode = "longest,list,full"
-- Disable automatic commenting on new line
vim.opt.formatoptions:remove({'c', 'r', 'o'})
-- Splits open at the bottom and right, which is non-retarded, unlike vim defaults.
vim.opt.splitbelow = true
vim.opt.splitright = true
-- Autocommands
-- Automatically deletes all trailing whitespace and newlines at end of file on save & reset cursor position.
vim.api.nvim_create_augroup('Format', {clear = true})
vim.api.nvim_create_autocmd('BufWritePre', {
group = 'Format',
pattern = '*',
callback = function()
local pos = vim.fn.getpos('.')
vim.cmd([[silent! keeppatterns %s/\s\+$//e]])
vim.cmd([[silent! keeppatterns %s/\n\+\%$//e]])
local fname = vim.fn.expand('%')
if fname:match('%.c$') or fname:match('%.h$') then
vim.cmd([[silent! keeppatterns %s/\%$/\r/e]])
end
if fname:match('neomutt') then
vim.cmd([[silent! keeppatterns %s/^--$/-- /e]])
end
vim.fn.cursor(pos[2], pos[3])
end
})
-- When shortcut files are updated, renew configs with new material:
vim.api.nvim_create_autocmd("BufWritePost", { pattern = { "bm-files", "bm-dirs" }, command = "!shortcuts" })
-- Run xrdb whenever Xdefaults or Xresources are updated.
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { pattern = { "Xresources", "Xdefaults", "xresources", "xdefaults" }, command = "set filetype=xdefaults" })
vim.api.nvim_create_autocmd("BufWritePost", { pattern = { "Xresources", "Xdefaults", "xresources", "xdefaults" }, command = "!xrdb %" })
-- Vimwiki configuration
--vim.g.vimwiki_ext2syntax = {['.Rmd'] = 'markdown', ['.rmd'] = 'markdown', ['.md'] = 'markdown', ['.markdown'] = 'markdown', ['.mdown'] = 'markdown'}
--vim.g.vimwiki_list = {
-- {path = '~/.local/share/vimwiki', syntax = 'markdown', ext = '.md'},
-- {path = '~/.local/share/vimwiki/Finance', syntax = 'markdown', ext = '.md'},
-- {path = '~/.local/share/vimwiki/Finance/Fundamentals', syntax = 'markdown', ext = '.md'},
-- {path = '~/.local/share/vimwiki/Finance/Research', syntax = 'markdown', ext = '.md'},
-- {path = '~/.local/share/vimwiki/Finance/Research/Tickers', syntax = 'markdown', ext = '.md'},
-- {path = '~/.local/share/vimwiki/cs', syntax = 'markdown', ext = '.md'},
-- {path = '~/.local/share/vimwiki/cs/Gentoo', syntax = 'markdown', ext = '.md'},
-- {path = '~/.local/share/vimwiki/arcana', syntax = 'markdown', ext = '.md'},
-- {path = '~/.local/share/Cuisine', syntax = 'markdown', ext = '.md'}
--}
--vim.g.vimwiki_sync_commit_message = 'Auto from nzxt - %c'
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { pattern = { "/tmp/calcurse*", "~/.calcurse/notes/*" }, command = "set filetype=markdown" })
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { pattern = { "*.ms", "*.me", "*.mom", "*.man" }, command = "set filetype=groff" })
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { pattern = "*.tex", command = "set filetype=tex" })
-- Runs a script that cleans out tex build files whenever I close out of a .tex file.
vim.api.nvim_create_autocmd("VimLeave", { pattern = "*.tex", command = "!texclear %" })
-- Save file as sudo on files that require root permission
vim.cmd([[cabbrev w!! execute 'silent! write !sudo tee % >/dev/null' \| edit!]])
-- Bindings
-- Spell-check set to <leader>o, 'o' for 'orthography'
vim.keymap.set("n", "<leader>o", ":setlocal spell! spelllang=en_us<CR>", { desc = "Toggle spell-check (en_us)" })
-- Compile document, be it groff/LaTeX/markdown/etc.
vim.keymap.set("n", "<leader>c", ':w! | !compiler "%"<CR>', { desc = "Compile document, be it groff/LaTeX/markdown/etc." })
-- Open corresponding .pdf/.html or preview
--vim.keymap.set("n", "<leader>p", ':!opout "%"<CR><CR>', { desc = "Open PDF/HTML/preview for current file" })
vim.keymap.set('v', '<leader>p', function() require('pyrepl').run_selected_lines() end, { desc = "Run selected lines" })
|