feat: telekasten things

main
Ricard Illa 2023-07-29 20:58:33 +02:00
parent 9a30953070
commit bb542b005d
No known key found for this signature in database
GPG Key ID: F69A672B72E54902
2 changed files with 72 additions and 36 deletions

View File

@ -15,6 +15,7 @@
fd fd
gcc gcc
hlint hlint
chafa
ltex-ls ltex-ls
lua-language-server lua-language-server
lua54Packages.luacheck lua54Packages.luacheck
@ -36,4 +37,7 @@
extraLuaConfig = builtins.readFile ./init.lua; extraLuaConfig = builtins.readFile ./init.lua;
}; };
home.packages = [ pkgs.neovide ]; home.packages = [ pkgs.neovide ];
home.file = {
notes.source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/Nextcloud/notes";
};
} }

View File

@ -70,15 +70,18 @@ require("packer").startup(function(use)
requires = { { 'nvim-lua/plenary.nvim' } } requires = { { 'nvim-lua/plenary.nvim' } }
} }
use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' } use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' }
use { 'nvim-lua/popup.nvim' }
use { 'nvim-telescope/telescope-media-files.nvim' }
use {
'renerocksai/telekasten.nvim',
requires = { 'nvim-telescope/telescope.nvim' }
}
use { 'nvim-telescope/telescope-symbols.nvim' }
use { 'renerocksai/calendar-vim' }
use("sheerun/vim-polyglot") use("sheerun/vim-polyglot")
use("nvim-treesitter/nvim-treesitter") use("nvim-treesitter/nvim-treesitter")
use("nvim-orgmode/orgmode")
use("akinsho/org-bullets.nvim")
use("lukas-reineke/headlines.nvim")
use("michaelb/sniprun")
use("dhruvasagar/vim-table-mode")
end) end)
vim.g.mapleader = "," vim.g.mapleader = ","
@ -147,6 +150,8 @@ nmap("<C-l>", ":nohl<CR><C-l>")
-- todo: try to do it with `vim.api.nvim_set_hl` -- todo: try to do it with `vim.api.nvim_set_hl`
vim.cmd("hi CursorLine cterm=NONE,underline ctermbg=NONE") -- highlight line when in insert mode vim.cmd("hi CursorLine cterm=NONE,underline ctermbg=NONE") -- highlight line when in insert mode
vim.cmd("hi tklink ctermfg=72 guifg=#689d6a cterm=bold,underline gui=bold,underline")
vim.cmd("hi tkBrackets ctermfg=gray guifg=gray")
o.timeoutlen = 1000 o.timeoutlen = 1000
o.ttimeoutlen = 0 o.ttimeoutlen = 0
@ -201,7 +206,7 @@ augroup my-glyph-palette
autocmd FileType nerdtree,startify call glyph_palette#apply() autocmd FileType nerdtree,startify call glyph_palette#apply()
augroup END augroup END
]]) ]])
nmap("<leader>tf", ":Fern . -drawer -toggle<cr>") nmap("<leader>t", ":Fern . -drawer -toggle<cr>")
nmap("<leader><Bs>", ": cd ..<cr>") nmap("<leader><Bs>", ": cd ..<cr>")
vim.g["indentLine_char"] = "" vim.g["indentLine_char"] = ""
@ -343,37 +348,9 @@ cmp.setup {
{ name = 'luasnip' }, { name = 'luasnip' },
{ name = 'buffer' }, { name = 'buffer' },
{ name = 'path' }, { name = 'path' },
{ name = 'orgmode' },
}, },
} }
local orgmode = require("orgmode")
orgmode.setup_ts_grammar()
require("nvim-treesitter.configs").setup {
-- If TS highlights are not enabled at all, or disabled via `disable` prop,
-- highlighting will fallback to default Vim syntax highlighting
highlight = {
enable = true,
-- Required for spellcheck, some LaTex highlights and
-- code block highlights that do not have ts grammar
additional_vim_regex_highlighting = { "org" },
},
ensure_installed = { "org" }, -- Or run :TSUpdate org
}
orgmode.setup {
org_agenda_files = { "~/Nextcloud/org/agenda/*.org" },
org_default_notes_file = "~/Nextcloud/org/notes.org",
org_capture_templates = {
w = {
description = "Wishlist",
template = "* %x",
target = "~/Nextcloud/org/wishlist.org"
}
}
}
vim.api.nvim_create_autocmd("LspAttach", { vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("UserLspConfig", {}), group = vim.api.nvim_create_augroup("UserLspConfig", {}),
callback = function(ev) callback = function(ev)
@ -418,13 +395,68 @@ telescope.setup {
override_file_sorter = true, -- override the file sorter override_file_sorter = true, -- override the file sorter
case_mode = "smart_case", -- or "ignore_case" or "respect_case" case_mode = "smart_case", -- or "ignore_case" or "respect_case"
-- the default case_mode is "smart_case" -- the default case_mode is "smart_case"
} },
-- media_files = {
-- -- filetypes whitelist
-- -- defaults to {"png", "jpg", "mp4", "webm", "pdf"}
-- filetypes = { "png", "webp", "jpg", "jpeg" },
-- -- find command (defaults to `fd`)
-- find_cmd = "rg"
-- }
} }
} }
telescope.load_extension("fzf") telescope.load_extension("fzf")
telescope.load_extension("media_files")
require 'nvim-web-devicons'.setup() require 'nvim-web-devicons'.setup()
local telekasten = require('telekasten')
telekasten.setup({
home = vim.fn.expand("~/notes"),
daily = vim.fn.expand("~/notes/daily"),
weeklies = vim.fn.expand("~/notes/weeklies"),
templates = vim.fn.expand("~/notes/templates"),
-- -- Specific note templates
-- -- set to `nil` or do not specify if you do not want a template
-- template_new_note = '/path/to/file', -- template for new notes
-- template_new_daily = '/path/to/file', -- template for new daily notes
-- template_new_weekly = '/path/to/file', -- template for new weekly notes
--
image_subdir = "img",
extension = ".md",
install_syntax = true,
media_previewer = "telescope-media-files",
})
vim.keymap.set("n", "<leader>z", telekasten.panel)
vim.keymap.set("n", "<leader>zf", telekasten.find_notes)
vim.keymap.set("n", "<leader>zd", telekasten.find_daily_notes)
vim.keymap.set("n", "<leader>zg", telekasten.search_notes)
vim.keymap.set("n", "<leader>zz", telekasten.follow_link)
vim.keymap.set("n", "<leader>zT", telekasten.goto_today)
vim.keymap.set("n", "<leader>zW", telekasten.goto_thisweek)
vim.keymap.set("n", "<leader>zw", telekasten.find_weekly_notes)
vim.keymap.set("n", "<leader>zn", telekasten.new_note)
vim.keymap.set("n", "<leader>zN", telekasten.new_templated_note)
vim.keymap.set("n", "<leader>zy", telekasten.yank_notelink)
vim.keymap.set("n", "<leader>zc", telekasten.show_calendar)
vim.keymap.set("n", "<leader>zC", ":CalendarT<CR>")
vim.keymap.set("n", "<leader>zi", telekasten.paste_img_and_link)
vim.keymap.set("n", "<leader>zt", telekasten.toggle_todo)
vim.keymap.set("v", "<leader>zt", function() telekasten.toggle_todo({ v = true }) end)
vim.keymap.set("n", "<leader>zb", telekasten.show_backlinks)
vim.keymap.set("n", "<leader>zF", telekasten.find_friends)
vim.keymap.set("n", "<leader>zI", function() telekasten.insert_img_link({ i = true }) end)
vim.keymap.set("n", "<leader>zp", telekasten.preview_img)
vim.keymap.set("n", "<leader>zm", telekasten.browse_media)
vim.keymap.set("n", "<leader>#", telekasten.show_tags)
vim.keymap.set("i", "[[", function() telekasten.insert_link({ i = true }) end)
vim.keymap.set("i", "<leader>zt", function() telekasten.toggle_todo({ i = true }) end)
vim.keymap.set("i", "<leader>#", function() telekasten.show_tags({ i = true }) end)
if vim.g.neovide then if vim.g.neovide then
vim.o.guifont = "Hack Nerd Font:h10" vim.o.guifont = "Hack Nerd Font:h10"
end end