From 41210fb0b6f53595c15b952973d5f353179bfad6 Mon Sep 17 00:00:00 2001 From: James Barlow Date: Thu, 7 Jul 2022 11:31:32 +0100 Subject: [PATCH] Add missing files --- .config/nvim/lua/completion.lua | 100 +++++++++++++++++++ .config/nvim/lua/plugConfig/neorg.lua | 25 +++++ .config/nvim/lua/plugConfig/notes.lua | 132 ++++++++++++++++++++++++++ 3 files changed, 257 insertions(+) create mode 100644 .config/nvim/lua/completion.lua create mode 100644 .config/nvim/lua/plugConfig/neorg.lua create mode 100644 .config/nvim/lua/plugConfig/notes.lua diff --git a/.config/nvim/lua/completion.lua b/.config/nvim/lua/completion.lua new file mode 100644 index 0000000..8c25e62 --- /dev/null +++ b/.config/nvim/lua/completion.lua @@ -0,0 +1,100 @@ +local luasnip = require'luasnip' +require("luasnip.loaders.from_vscode").lazy_load() + +local cmp = require'cmp' + + +local kind_icons = { + Text = "", + Method = "", + Function = "", + Constructor = "", + Field = "", + Variable = "", + Class = "ﴯ", + Interface = "", + Module = "", + Property = "ﰠ", + Unit = "", + Value = "", + Enum = "", + Keyword = "", + Snippet = "", + Color = "", + File = "", + Reference = "", + Folder = "", + EnumMember = "", + Constant = "", + Struct = "", + Event = "", + Operator = "", + TypeParameter = "" +} + +cmp.setup({ + snippet = { + -- REQUIRED - you must specify a snippet engine + expand = function(args) + -- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. + luasnip.lsp_expand(args.body) -- For `luasnip` users. + -- require('snippy').expand_snippet(args.body) -- For `snippy` users. + -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users. + end, + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + --elseif has_words_before() then + -- cmp.complete() + else + fallback() + end + end, { "i", "s" }), + + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + }), + sources = { + { name = 'nvim_lsp' }, + -- { name = 'vsnip' }, -- For vsnip users. + { name = 'luasnip' }, -- For luasnip users. + -- { name = 'ultisnips' }, -- For ultisnips users. + -- { name = 'snippy' }, -- For snippy users. + { name = 'buffer' } + }, + formatting = { + format = function(entry, vim_item) + -- Kind icons + -- This concatonates the icons with the name of the item kind + vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) + -- Just the icon + --vim_item.kind = string.format('%s', kind_icons[vim_item.kind]) + -- Source + vim_item.menu = ({ + buffer = "[Buffer]", + nvim_lsp = "[LSP]", + luasnip = "[LuaSnip]", + nvim_lua = "[Lua]", + latex_symbols = "[LaTeX]", + })[entry.source.name] + return vim_item + end + } +}) + diff --git a/.config/nvim/lua/plugConfig/neorg.lua b/.config/nvim/lua/plugConfig/neorg.lua new file mode 100644 index 0000000..e881867 --- /dev/null +++ b/.config/nvim/lua/plugConfig/neorg.lua @@ -0,0 +1,25 @@ +require('neorg').setup { + load = { + ["core.defaults"] = {}, + ["core.gtd.base"] = { + config = { + workspace = "work" + } + }, + ["core.norg.dirman"] = { + config = { + workspaces = { + work = "~/notes/work", + } + } + }, + ["core.norg.concealer"] = { + config = {} + }, + ["core.keybinds"] = { + config = { + default_keybinds = false, + } + } + } +} diff --git a/.config/nvim/lua/plugConfig/notes.lua b/.config/nvim/lua/plugConfig/notes.lua new file mode 100644 index 0000000..ac2b0e6 --- /dev/null +++ b/.config/nvim/lua/plugConfig/notes.lua @@ -0,0 +1,132 @@ +local home = vim.fn.expand("~/notes") +-- NOTE for Windows users: +-- - don't use Windows +-- - try WSL2 on Windows and pretend you're on Linux +-- - if you **must** use Windows, use "/Users/myname/zettelkasten" instead of "~/zettelkasten" +-- - NEVER use "C:\Users\myname" style paths +-- - Using `vim.fn.expand("~/zettelkasten")` should work now but mileage will vary with anything outside of finding and opening files +require('telekasten').setup({ + home = home, + + -- if true, telekasten will be enabled when opening a note within the configured home + take_over_my_home = true, + + -- auto-set telekasten filetype: if false, the telekasten filetype will not be used + -- and thus the telekasten syntax will not be loaded either + auto_set_filetype = true, + + -- dir names for special notes (absolute path or subdir name) + dailies = home .. '/' .. 'daily', + weeklies = home .. '/' .. 'weekly', + templates = home .. '/' .. 'templates', + + -- image (sub)dir for pasting + -- dir name (absolute path or subdir name) + -- or nil if pasted images shouldn't go into a special subdir + image_subdir = "img", + + -- markdown file extension + extension = ".md", + + -- Generate note filenames. One of: + -- "title" (default) - Use title if supplied, uuid otherwise + -- "uuid" - Use uuid + -- "uuid-title" - Prefix title by uuid + -- "title-uuid" - Suffix title with uuid + new_note_filename = "title", + -- file uuid type ("rand" or input for os.date()") + uuid_type = "%Y%m%d%H%M", + -- UUID separator + uuid_sep = "-", + + -- following a link to a non-existing note will create it + follow_creates_nonexisting = true, + dailies_create_nonexisting = true, + weeklies_create_nonexisting = true, + + -- skip telescope prompt for goto_today and goto_thisweek + journal_auto_open = false, + + -- template for new notes (new_note, follow_link) + -- set to `nil` or do not specify if you do not want a template + template_new_note = home .. '/' .. 'templates/new_note.md', + + -- template for newly created daily notes (goto_today) + -- set to `nil` or do not specify if you do not want a template + template_new_daily = home .. '/' .. 'templates/daily.md', + + -- template for newly created weekly notes (goto_thisweek) + -- set to `nil` or do not specify if you do not want a template + template_new_weekly= home .. '/' .. 'templates/weekly.md', + + -- image link style + -- wiki: ![[image name]] + -- markdown: ![](image_subdir/xxxxx.png) + image_link_style = "markdown", + + -- default sort option: 'filename', 'modified' + sort = "filename", + + -- integrate with calendar-vim + plug_into_calendar = true, + calendar_opts = { + -- calendar week display mode: 1 .. 'WK01', 2 .. 'WK 1', 3 .. 'KW01', 4 .. 'KW 1', 5 .. '1' + weeknm = 4, + -- use monday as first day of week: 1 .. true, 0 .. false + calendar_monday = 1, + -- calendar mark: where to put mark for marked days: 'left', 'right', 'left-fit' + calendar_mark = 'left-fit', + }, + + -- telescope actions behavior + close_after_yanking = false, + insert_after_inserting = true, + + -- tag notation: '#tag', ':tag:', 'yaml-bare' + tag_notation = "#tag", + + -- command palette theme: dropdown (window) or ivy (bottom panel) + command_palette_theme = "dropdown", + + -- tag list theme: + -- get_cursor: small tag list at cursor; ivy and dropdown like above + show_tags_theme = "ivy", + + -- when linking to a note in subdir/, create a [[subdir/title]] link + -- instead of a [[title only]] link + subdirs_in_links = true, + + -- template_handling + -- What to do when creating a new note via `new_note()` or `follow_link()` + -- to a non-existing note + -- - prefer_new_note: use `new_note` template + -- - smart: if day or week is detected in title, use daily / weekly templates (default) + -- - always_ask: always ask before creating a note + template_handling = "smart", + + -- path handling: + -- this applies to: + -- - new_note() + -- - new_templated_note() + -- - follow_link() to non-existing note + -- + -- it does NOT apply to: + -- - goto_today() + -- - goto_thisweek() + -- + -- Valid options: + -- - smart: put daily-looking notes in daily, weekly-looking ones in weekly, + -- all other ones in home, except for notes/with/subdirs/in/title. + -- (default) + -- + -- - prefer_home: put all notes in home except for goto_today(), goto_thisweek() + -- except for notes with subdirs/in/title. + -- + -- - same_as_current: put all new notes in the dir of the current note if + -- present or else in home + -- except for notes/with/subdirs/in/title. + new_note_location = "smart", + + -- should all links be updated when a file is renamed + rename_update_links = true, +})