added nvim config

This commit is contained in:
Jakub 2024-07-23 09:42:05 -04:00
parent aec23e0e0a
commit cce170ad96
23 changed files with 939 additions and 0 deletions

2
.gitignore vendored
View File

@ -1,2 +1,4 @@
user/.config/zsh/personal/* user/.config/zsh/personal/*
user/.config/autorandr/* user/.config/autorandr/*
user/.config/nvim/plugin/*
user/.config/nvim/plugin/lua/priv/*

BIN
personal/archives/nvim.zip Normal file

Binary file not shown.

View File

@ -9,4 +9,7 @@ zip --encrypt ../../../../personal/archives/zsh.zip ./*
cd "${XDG_CONFIG_HOME:-$HOME/.config}/autorandr" cd "${XDG_CONFIG_HOME:-$HOME/.config}/autorandr"
zip --encrypt "$dir/archives/autorandr.zip" ./**/** zip --encrypt "$dir/archives/autorandr.zip" ./**/**
cd "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/lua/priv"
zip --encrypt "$dir/archives/nvim.zip" ./*
cd "$dir" cd "$dir"

View File

@ -4,3 +4,6 @@
unzip ./archives/zsh.zip -d ../user/.config/zsh/personal unzip ./archives/zsh.zip -d ../user/.config/zsh/personal
unzip ./archives/autorandr.zip -d ../user/.config/autorandr unzip ./archives/autorandr.zip -d ../user/.config/autorandr
unzip ./archives/nvim.zip -d ../user/.config/nvim/lua/priv
echo 'require("priv.init")' >> ../user/.config/nvim/init.lua

View File

@ -0,0 +1 @@
require("user.init")

View File

@ -0,0 +1,10 @@
vim.api.nvim_create_autocmd("BufWritePost", {
pattern = "email-list.md",
callback = function ()
local infile = vim.fn.expand('%:p')
local outfile = os.getenv("HOME") .. '/docs/notes/harc/emails/raw-list.md'
local command = string.format("grep -o '[^ ^ ]*@[^ ^ ]*' %s > %s", infile, outfile)
os.execute(command)
end,
})

View File

@ -0,0 +1 @@
require("priv.autocmd")

View File

@ -0,0 +1,7 @@
vim.api.nvim_create_autocmd("BufWritePost", {
pattern = "logind.conf",
callback = function ()
local command = string.format('sudo -A cp -f %s %s', vim.fn.expand('%:p'), "/etc/systemd/logind.conf")
os.execute(command)
end,
})

View File

@ -0,0 +1,40 @@
local opts = { noremap = true, silent = true }
local term_opts = { silent = true }
-- Function to check if the buffer is saved
local function is_buffer_saved()
return vim.api.nvim_buf_get_option(0, 'modified') == false
end
-- Function to prompt user to save buffer
local function save_buffer_prompt()
if not is_buffer_saved() then
local save_choice = vim.fn.confirm('Buffer is not saved. Save it?', '&Yes\n&No', 1)
if save_choice == 1 then
vim.cmd('w')
else
return
end
end
end
-- Keybinding function
function run_md_export()
save_buffer_prompt()
-- vim.api.nvim_exec2("TermExec direction=float cmd=\"md-export " .. vim.fn.expand('%:p') .. "\"" , true)
end
-- MD keybinds
vim.api.nvim_create_autocmd("FileType", {
pattern = { "vimwiki", "markdown"},
callback = function ()
vim.api.nvim_buf_set_keymap(0, "n", "<leader>mp", ":MarkdownPreview<cr>", opts) -- Preview
vim.api.nvim_buf_set_keymap(0, "n", "<leader>mgl", ":VimwikiGenerateLinks<cr>", opts) -- Generate VimWiki Links
vim.api.nvim_buf_set_keymap(0, "n", "<leader>toc", ":VimwikiTOC<cr>", opts) -- Generate TOC
vim.api.nvim_buf_set_keymap(0, "n", "<leader>mtc", ":VimwikiTOC<cr>", opts) -- Generate TOC
vim.api.nvim_buf_set_keymap(0, "n", "<leader>mdc", ":TermExec direction=float cmd=\"md2src " .. vim.fn.expand('%:p') .. "\"<cr>", opts ) -- Compile Markdown File to code using md2src
-- vim.api.nvim_buf_set_keymap(0, "n", '<Leader>mde', ':lua run_md_export()<CR>', opts )
end
})

View File

@ -0,0 +1,5 @@
require("user.plugins.packer")
require("user.options")
require("user.keys")
require("user.autocmd")
require("user.filetypes.md.keys")

View File

@ -0,0 +1,84 @@
local opts = { noremap = true, silent = true }
local term_opts = { silent = true }
--Remap space as leader key
vim.api.nvim_set_keymap("", "<Space>", "<Nop>", opts)
vim.g.mapleader = " "
vim.g.maplocalleader = " "
-- Modes
-- normal_mode = "n",
-- insert_mode = "i",
-- visual_mode = "v",
-- visual_block_mode = "x",
-- term_mode = "t",
-- command_mode = "c",
-- Normal --
vim.api.nvim_set_keymap("n", "<leader>ws", ":w|source<cr>", opts)
-- Better window navigation
vim.api.nvim_set_keymap("n", "<C-h>", "<C-w>h", opts)
vim.api.nvim_set_keymap("n", "<C-j>", "<C-w>j", opts)
vim.api.nvim_set_keymap("n", "<C-k>", "<C-w>k", opts)
vim.api.nvim_set_keymap("n", "<C-l>", "<C-w>l", opts)
-- NvimTree Focus
vim.api.nvim_set_keymap("n", "<leader>ft", ":NvimTreeFocus<cr>", opts)
-- Telescope
vim.api.nvim_set_keymap("n", "<leader>fr", ":Telescope oldfiles<cr>", opts)
vim.api.nvim_set_keymap("n", "<leader>ff", ":Telescope find_files<cr>", opts)
vim.api.nvim_set_keymap('n', '<leader>fn', [[:lua require('telescope.builtin').find_files({ cwd = '~/docs/notes' })<CR>]], opts)
vim.api.nvim_set_keymap("n", "<leader>sh", ":Telescope help_tags<cr>", opts)
vim.api.nvim_set_keymap("n", "<leader>sf", ":Telescope filetypes<cr>", opts)
-- Better buffer navigation
local function is_nvimtree_open()
for _, winid in ipairs(vim.api.nvim_list_wins()) do
local bufnr = vim.fn.winbufnr(winid)
local filetype = vim.bo[bufnr].filetype
if filetype == 'NvimTree' then
return true
end
end
return false
end
function close_or_exit()
local ls_output = vim.fn.execute(":ls")
local open_buffers_count = vim.fn.len(vim.fn.split(ls_output, '\n'))
if vim.bo.filetype == "NvimTree" then
require("nvim-tree.api").tree.close()
elseif vim.fn.winnr('$') == 2 and is_nvimtree_open() then
if open_buffers_count > 1 then
vim.cmd('bnext | bdelete! #')
else
vim.cmd('qall!')
end
elseif vim.fn.winnr('$') > 1 then
vim.cmd(':q!')
elseif open_buffers_count > 1 then
vim.cmd('bdelete!')
else
vim.cmd('qall!')
end
end
vim.api.nvim_set_keymap("n", "ZZ", ":w|lua close_or_exit()<CR>", opts)
vim.api.nvim_set_keymap("n", "ZQ", ":lua close_or_exit()<CR>", opts)
vim.api.nvim_set_keymap("n", "<leader>bj", ":BufferLineCycleNext<cr>", opts)
vim.api.nvim_set_keymap("n", "<leader>bk", ":BufferLineCyclePrev<cr>", opts)
vim.api.nvim_set_keymap("n", "<leader>bf", ":Telescope buffers<cr>", opts)
vim.api.nvim_set_keymap("n", "<leader>bp", ":BufferLinePick<cr>", opts)
for dig = 1, 9 do
vim.api.nvim_set_keymap("n", "<leader>" .. dig , ":BufferLineGoToBuffer " .. dig .. "<cr>", opts)
end
vim.api.nvim_set_keymap("n", "<leader>0", ":BufferLineGoToBuffer 10<cr>", opts)

View File

@ -0,0 +1,26 @@
vim.opt.clipboard = 'unnamedplus' -- Use system clipboard
vim.opt.number = true -- Have curent line show line number
vim.opt.relativenumber = true -- Show relative line numbers
vim.opt.hlsearch = false -- Disable highlight on searched strings
vim.opt.ignorecase = true -- Ignore case in searches
vim.opt.mouse = '' -- Set mouse behaviour (disabled)
vim.opt.scrolloff = 8 -- Prevent cursor from top and bottom edges - better readability
vim.opt.sidescrolloff = 8 -- Prevent cursor from side edges - better readability
vim.opt.cursorline = true -- Highlught line which cursor is on
vim.opt.splitbelow = true -- force all horizontal splits to go below current window
vim.opt.splitright = true -- force all vertical splits to go to the right of current window
vim.opt.expandtab = false -- convert tabs to spaces
vim.opt.shiftwidth = 2 -- the number of spaces inserted for each indentation
vim.opt.tabstop = 2 -- insert 2 spaces for a tab
vim.opt.swapfile = false -- keep track of open buffers, ocassionally casuses issues
vim.opt.undofile = true -- save undo hist on nvim exit
-- Disable New Line Comment
vim.api.nvim_create_autocmd("BufEnter", {
callback = function()
vim.opt.formatoptions:remove { "c", "r", "o" }
end
})
vim.opt.termguicolors = true

View File

@ -0,0 +1,35 @@
require('bufferline').setup {
options = {
mode = "buffers",
themeable = true,
right_mouse_command = nil,
left_mouse_command = nil,
middle_mouse_command = nil,
indicator = {
-- icon = 'lala',
style = 'icon',
},
show_buffer_icons = true,
show_buffer_close_icons = false,
-- show_close_icon = false,
-- show_tab_indicators = true | false,
-- show_duplicate_prefix = true | false, -- whether to show duplicate buffer prefix
offsets = {
{
filetype = "NvimTree",
-- text = function() return vim.fn.getcwd() end,
text = "File Explorer",
text_align = "center",
highlight = "Directory",
separator = true,
},
},
separator_style = 'slant' -- "slant" | "slope" | "thick" | "thin" | { 'any', 'any' },
},
highlights = {
tab = {
-- fg = '<colour-value-here>',
-- bg = 'lualine_c_normal',
},
}
}

View File

@ -0,0 +1 @@
vim.g.calendar_no_mappings = 1 -- Disable default (bad) mappings

View File

@ -0,0 +1,122 @@
function custom_footer(command, max_chars, max_lines)
local handle, result = io.popen(command), {}
for _ = 1, 3 do table.insert(result, "") end
for line in handle:lines() do
line = string.gsub(line, "\t", "")
while #line > max_chars do
local chunk, i = string.sub(line, 1, max_chars), max_chars
while i > 0 and string.sub(chunk, i, i) ~= " " do i = i - 1 end
if i > 0 then chunk = string.sub(chunk, 1, i) end
chunk = string.gsub(chunk, "^%s*(.-)%s*$", "%1")
table.insert(result, chunk)
line = string.sub(line, i + 1)
end
table.insert(result, line)
if #result > max_lines then handle:close(); return custom_footer(command, max_chars, max_lines) end
end
handle:close()
return result
end
require('dashboard').setup {
theme = 'doom',
-- disable_move, -- default is false disable move keymap for hyper
-- shortcut_type, -- shorcut type 'letter' or 'number'
-- change_to_vcs_root, -- default is false,for open file in hyper mru. it will change to the root of vcs
config = {
header = {
'',
'',
'',
'',
'',
' ███╗ ██╗ ███████╗ ██████╗ ██╗ ██╗ ██╗ ███╗ ███╗',
' ████╗ ██║ ██╔════╝██╔═══██╗ ██║ ██║ ██║ ████╗ ████║',
' ██╔██╗ ██║ █████╗ ██║ ██║ ██║ ██║ ██║ ██╔████╔██║',
' ██║╚██╗██║ ██╔══╝ ██║ ██║ ╚██╗ ██╔╝ ██║ ██║╚██╔╝██║',
' ██║ ╚████║ ███████╗╚██████╔╝ ╚████╔╝ ██║ ██║ ╚═╝ ██║',
' ╚═╝ ╚═══╝ ╚══════╝ ╚═════╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝',
'',
'',
'',
},
center = {
{
icon = '󰋚 ',
desc = 'Recent Files ',
key = 'r',
keymap = 'SPC f r',
action = ':Telescope oldfiles'
},
{
icon = '󰝒 ',
desc = 'New File ',
key = 'n',
keymap = 'NONE',
action = ':enew'
},
{
icon = '󰍉 ',
desc = 'Find Files ',
key = 'f',
keymap = 'SPC f f',
action = ':Telescope find_files'
},
{
icon = '󰍉 ',
desc = 'File Tree ',
key = 't',
keymap = 'SPC f t',
action = ':NvimTreeFocus'
},
{
icon = '󰠮 ',
desc = 'Open Vimwiki ',
key = 'w',
keymap = 'SPC w w',
action = ':VimwikiIndex'
},
{
icon = '󰺿 ',
desc = 'Open Daily Note ',
key = 'd',
keymap = 'SPC w SPC w',
action = ':VimwikiMakeDiaryNote'
},
{
icon = '󰃭 ',
desc = 'Open Calendar ',
key = 'c',
keymap = 'SPC c a l',
action = ':CalendarT'
},
{
icon = '󰚰 ',
desc = 'Update Plugins',
key = 'u',
keymap = 'NONE',
action = ':PackerSync'
},
{
icon = '󰋗 ',
desc = 'Help Pages',
key = 'h',
keymap = 'SPC s h',
action = ':Telescope help_tags'
},
},
footer = custom_footer("fortune", 50, 8)
},
-- hide = {
-- statusline, -- hide statusline default is true
-- tabline, -- hide the tabline
-- winbar, -- hide winbar
-- },
-- preview = {
-- command, -- preview command
-- file_path, -- preview file path
-- file_height, -- preview file height
-- file_width, -- preview file width
-- }
}

View File

@ -0,0 +1,24 @@
require("gruvbox").setup({
undercurl = true,
underline = true,
bold = true,
italic = {
strings = false,
comments = false,
operators = false,
folds = true,
},
strikethrough = true,
invert_selection = false,
invert_signs = false,
invert_tabline = false,
invert_intend_guides = false,
inverse = true, -- invert background for search, diffs, statuslines and errors
contrast = "hard", -- can be "hard", "soft" or empty string
palette_overrides = {},
overrides = {},
dim_inactive = false,
transparent_mode = true,
})
vim.cmd "colorscheme gruvbox"

View File

@ -0,0 +1,40 @@
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'auto',
component_separators = { left = '', right = ''},
section_separators = { left = '', right = ''},
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
},
sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff', 'diagnostics'},
lualine_c = {'filename'},
lualine_x = {'encoding', 'filetype'}, --fileformat
lualine_y = {'progress'},
lualine_z = {'location'}
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {'location'},
lualine_y = {},
lualine_z = {}
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {}
}

View File

@ -0,0 +1,10 @@
vim.g.mkdp_filetypes = { 'markdown' }
-- TODO lua rewrite
vim.cmd[[
function OpenFF (url)
execute "silent ! firefox -P nvim-mdp " . a:url . "&"
endfunction
]]
vim.g.mkdp_browserfunc = 'OpenFF'

View File

@ -0,0 +1,240 @@
-- Disable Default Nvim file browser - it suck ngl
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
-- Load Plugin
require("nvim-tree").setup {
auto_reload_on_write = true,
disable_netrw = true,
hijack_cursor = true,
hijack_netrw = true,
hijack_unnamed_buffer_when_opening = false,
sort = {
sorter = "name",
folders_first = true,
},
root_dirs = {},
prefer_startup_root = false,
sync_root_with_cwd = false,
reload_on_bufenter = false,
respect_buf_cwd = false,
on_attach = "default",
select_prompts = false,
view = {
centralize_selection = false,
cursorline = true,
debounce_delay = 15,
width = 30,
side = "left",
preserve_window_proportions = false,
number = false,
relativenumber = false,
signcolumn = "yes",
float = {
enable = false,
quit_on_focus_loss = true,
open_win_config = {
relative = "editor",
border = "rounded",
width = 35,
height = 30,
row = 1,
col = 1,
},
},
},
renderer = {
add_trailing = false,
group_empty = false,
highlight_git = false,
full_name = false,
highlight_opened_files = "none",
highlight_modified = "none",
root_folder_label = ":~:s?$?/..?",
indent_width = 2,
indent_markers = {
enable = true,
inline_arrows = true,
icons = {
corner = "",
edge = "",
item = "",
bottom = "",
none = " ",
},
},
icons = {
webdev_colors = true,
git_placement = "before",
modified_placement = "after",
padding = " ",
symlink_arrow = "",
show = {
file = true,
folder = true,
folder_arrow = true,
git = true,
modified = true,
},
glyphs = {
default = "",
symlink = "",
bookmark = "󰆤",
modified = "",
folder = {
arrow_closed = "",
arrow_open = "",
default = "",
open = "",
empty = "",
empty_open = "",
symlink = "",
symlink_open = "",
},
git = {
unstaged = "",
staged = "",
unmerged = "",
renamed = "",
untracked = "",
deleted = "",
ignored = "",
},
},
},
special_files = { "Cargo.toml", "Makefile", "README.md", "readme.md" },
symlink_destination = true,
},
hijack_directories = {
enable = true,
auto_open = false,
},
update_focused_file = {
enable = true,
update_root = false,
ignore_list = {},
},
system_open = {
cmd = "xdg-open",
args = {},
},
diagnostics = {
enable = false,
show_on_dirs = false,
show_on_open_dirs = true,
debounce_delay = 50,
severity = {
min = vim.diagnostic.severity.HINT,
max = vim.diagnostic.severity.ERROR,
},
icons = {
hint = "",
info = "",
warning = "",
error = "",
},
},
filters = {
git_ignored = false,
dotfiles = false,
git_clean = false,
no_buffer = false,
custom = {},
exclude = {},
},
filesystem_watchers = {
enable = true,
debounce_delay = 50,
ignore_dirs = {},
},
git = {
enable = true,
show_on_dirs = true,
show_on_open_dirs = true,
disable_for_dirs = {},
timeout = 400,
},
modified = {
enable = false,
show_on_dirs = true,
show_on_open_dirs = true,
},
actions = {
use_system_clipboard = true,
change_dir = {
enable = true,
global = false,
restrict_above_cwd = false,
},
expand_all = {
max_folder_discovery = 300,
exclude = {},
iii},
file_popup = {
open_win_config = {
col = 1,
row = 1,
relative = "cursor",
border = "shadow",
style = "minimal",
},
},
open_file = {
quit_on_open = false,
eject = true,
resize_window = true,
window_picker = {
enable = true,
picker = "default",
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
exclude = {
filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" },
buftype = { "nofile", "terminal", "help" },
},
},
},
remove_file = {
close_window = true,
},
},
trash = {
cmd = "gio trash",
},
live_filter = {
prefix = "[FILTER]: ",
always_show_folders = true,
},
tab = {
sync = {
open = true,
close = true,
ignore = {},
},
},
notify = {
threshold = vim.log.levels.INFO,
absolute_path = true,
},
ui = {
confirm = {
remove = true,
trash = true,
},
},
experimental = {},
log = {
enable = false,
truncate = false,
types = {
all = false,
config = false,
copy_paste = false,
dev = false,
diagnostics = false,
git = false,
profile = false,
watcher = false,
},
},
}

View File

@ -0,0 +1,138 @@
-- Auto install packer
local ensure_packer = function()
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]]
return true
end
return false
end
local packer_bootstrap = ensure_packer()
-- Autocommand that reloads neovim whenever you save the plugins.lua file
vim.api.nvim_create_autocmd("BufWritePost", {
pattern = "packer.lua",
command = "source <afile> | PackerSync",
group = vim.api.nvim_create_augroup("packer_user_config", {clear = true})
})
-- Use a protected call so we don't error out on first use
local status_ok, packer = pcall(require, 'packer')
if not status_ok then
return
end
-- Have packer use a popup window
packer.init({
git = { clone_timeout = -1 },
display = {
open_fn = function()
return require('packer.util').float({ border = 'single' })
end
}
})
return require('packer').startup(function(use)
use 'https://github.com/wbthomason/packer.nvim'
use { 'https://github.com/ellisonleao/gruvbox.nvim',
config = function() require('user.plugins.gruvbox') end
}
use { 'https://github.com/nvim-treesitter/nvim-treesitter',
config = function() end
}
use { 'https://github.com/kylechui/nvim-surround',
tag = '*',
config = function () require("nvim-surround").setup() end
}
use { 'https://github.com/norcalli/nvim-colorizer.lua',
config = function()
require 'colorizer'.setup{
'*';
'!dashboard';
'!gcode';
'!ngc';
}
end
}
use { 'https://github.com/terrortylor/nvim-comment',
config = function() require('nvim_comment').setup() end
}
use 'https://github.com/junegunn/goyo.vim'
use { 'https://github.com/vimwiki/vimwiki',
config = function() require('user.plugins.vimwiki') end
}
use { 'https://github.com/nvim-tree/nvim-tree.lua',
config = function() require('user.plugins.nvim-tree') end,
requires = {'https://github.com/nvim-tree/nvim-web-devicons'}
}
use { 'https://github.com/iamcco/markdown-preview.nvim',
run = function() vim.fn['mkdp#util#install']() end,
setup = function() require('user.plugins.markdown-preview') end,
ft = { 'markdown' },
}
use {
'https://github.com/windwp/nvim-autopairs',
config = function() require("nvim-autopairs").setup {} end
}
use { 'https://github.com/nvimdev/dashboard-nvim',
config = function() require('user.plugins.dash') end,
requires = {'https://github.com/nvim-tree/nvim-web-devicons'}
}
use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' }
use { 'https://github.com/nvim-telescope/telescope.nvim',
requires = { 'https://github.com/nvim-lua/plenary.nvim',
'https://github.com/BurntSushi/ripgrep',
},
config = function () require('user.plugins.telescope') end
}
use {
'https://github.com/akinsho/toggleterm.nvim',
tag = '*',
config = function () require("user.plugins.toggleterm") end
}
use { 'https://git.jakubb.xyz/jakub/vim-nc' }
use { 'https://github.com/nvim-lualine/lualine.nvim',
config = function() require("user.plugins.lualine") end,
requires = { 'nvim-tree/nvim-web-devicons' }
}
use { 'https://github.com/mattn/calendar-vim',
config = function() require("user.plugins.calendar") end,
}
use { 'https://github.com/akinsho/bufferline.nvim',
-- tag = "*",
config = function()
require("user.plugins.buf-line")
vim.cmd "colorscheme gruvbox"
end,
requires = 'nvim-tree/nvim-web-devicons'
}
if packer_bootstrap then
require('packer').sync()
end
end)

View File

@ -0,0 +1,33 @@
require("telescope").setup {
pickers = {
find_files = {
mappings = {
n = { ["q"] = "close", }
},
hidden = true,
file_ignore_patterns = {
-- special dirs
".git/",
-- xdg dirs
".cache", ".local/share", ".local/state",
-- bin output
"%.o", "%.a", "%.out",
-- bin docs
"%.pdf", "%doc", "%docx", "%.odt",
-- vids
"%.mkv", "%.mp4", "%.webm", "%.mov", "%.srt",
"%.m4a",
-- pics
"%.jpg", "%.png", "%.webp", "%.gif",
-- audio
"%.mp3", "%.flac",
-- archives
"%.zip",
-- fonts
"%.ttf",
-- misc
"%.torrent", "%.part", "%.dll", "%.exe", "%.pdb",
}
}
}
}

View File

@ -0,0 +1,67 @@
require("toggleterm").setup{
-- size can be a number or function which is passed the current terminal
size = function(term)
if term.direction == "horizontal" then
return 15
elseif term.direction == "vertical" then
return vim.o.columns * 0.4
end
end,
open_mapping = [[<c-t>]],
-- on_create = fun(t: Terminal), -- function to run when the terminal is first created
-- on_open = fun(t: Terminal), -- function to run when the terminal opens
-- on_close = fun(t: Terminal), -- function to run when the terminal closes
-- on_stdout = fun(t: Terminal, job: number, data: string[], name: string) -- callback for processing output on stdout
-- on_stderr = fun(t: Terminal, job: number, data: string[], name: string) -- callback for processing output on stderr
-- on_exit = fun(t: Terminal, job: number, exit_code: number, name: string) -- function to run when terminal process exits
shade_terminals = false,
hide_numbers = true, -- hide the number column in toggleterm buffers
autochdir = true, -- when neovim changes it current directory the terminal will change it's own when next it's opened
highlights = {
-- -- highlights which map to a highlight group name and a table of it's values
-- -- NOTE: this is only a subset of values, any group placed here will be set for the terminal window split
-- Normal = {
-- guibg = "",
-- },
-- NormalFloat = {
-- link = 'Normal'
-- },
FloatBorder = { link = "FloatBorder" },
},
-- start_in_insert = true,
-- insert_mappings = true, -- whether or not the open mapping applies in insert mode
-- terminal_mappings = true, -- whether or not the open mapping applies in the opened terminals
-- direction = 'float',
direction = 'horizontal',
-- auto_scroll = true, -- automatically scroll to the bottom on terminal output
-- This field is only relevant if direction is set to 'float'
float_opts = {
-- The border key is *almost* the same as 'nvim_open_win'
-- see :h nvim_open_win for details on borders however
-- the 'curved' border is a custom border type
-- not natively supported but implemented in this plugin.
border = 'single',
width = 160,
height = 40,
},
}
vim.api.nvim_create_autocmd( "TermOpen", {
callback = function()
local opts = {noremap = true}
vim.api.nvim_buf_set_keymap(0, 't', '<esc>', [[<C-t><C-n>]], opts)
vim.api.nvim_buf_set_keymap(0, 't', 'jk', [[<C-t><C-n>]], opts)
vim.api.nvim_buf_set_keymap(0, 't', '<C-h>', [[<C-\><C-n><C-W>h]], opts)
vim.api.nvim_buf_set_keymap(0, 't', '<C-j>', [[<C-\><C-n><C-W>j]], opts)
vim.api.nvim_buf_set_keymap(0, 't', '<C-k>', [[<C-\><C-n><C-W>k]], opts)
vim.api.nvim_buf_set_keymap(0, 't', '<C-l>', [[<C-\><C-n><C-W>l]], opts)
end,
pattern = "term://*",
})
vim.api.nvim_create_autocmd( "BufEnter", {
pattern = "term://*",
callback = function() vim.cmd("startinsert") end
})

View File

@ -0,0 +1,47 @@
vim.g.vimwiki_list = {{
path = '~/docs/notes/',
syntax = 'markdown',
ext = '.md'
}}
vim.g.vimwiki_links_header = "Pages"
vim.g.vimwiki_links_header_level = 2
vim.g.vimwiki_links_space_char = '-'
vim.api.nvim_create_autocmd( "BufEnter", {
pattern = vim.fn.expand("~") .. "/docs/notes/diary/diary.md",
command = "VimwikiDiaryGenerateLinks"
})
vim.api.nvim_create_autocmd( "BufEnter", {
pattern = vim.fn.expand("~") .. "/docs/notes/index.md",
command = "VimwikiGenerateLinks"
})
-- Automatically asign todays date as title to todays diary entry
vim.api.nvim_create_autocmd( "BufNewFile", {
pattern = vim.fn.expand("~") .. "/docs/notes/diary/*.md",
callback = function ()
buf_name = vim.api.nvim_buf_get_name(0)
todays_note= vim.fn.expand("~") .. "/docs/notes/diary/".. os.date("%Y-%m-%d") .. ".md"
if buf_name == todays_note then
local date = vim.fn.split("# " .. os.date("%-b. %-d, %Y"), "\n")
vim.api.nvim_buf_set_lines(0, 0, 1, false, date)
end
end
})
-- Timestamp entries into todays diary entry
vim.api.nvim_create_autocmd( {"BufRead", "BufNewFile"}, {
pattern = vim.fn.expand("~") .. "/docs/notes/diary/*.md",
callback = function ()
buf_name = vim.api.nvim_buf_get_name(0)
todays_note= vim.fn.expand("~") .. "/docs/notes/diary/".. os.date("%Y-%m-%d") .. ".md"
if buf_name == todays_note then
vim.api.nvim_buf_set_lines(0, -1, -1, false, { "", "## " .. os.date("%-I:%M %p"), "" })
vim.cmd("normal! G$")
end
end
})