Skip to content

Commit

Permalink
Add nvim notes tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JBarlowDev committed Jul 7, 2022
1 parent efe297e commit d837f82
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 52 deletions.
55 changes: 3 additions & 52 deletions .config/nvim/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ require('plugins')
require('keymap')
require('options')
require("lsp")
require("completion")

require'nvim-tree'.setup {}

Expand All @@ -13,56 +14,6 @@ require'which-key'.setup()

require('lualine').setup()

local luasnip = require'luasnip'
require("luasnip.loaders.from_vscode").lazy_load()

local cmp = require'cmp'

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({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
["<Tab>"] = 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" }),

["<S-Tab>"] = 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' }
}
})
require('plugConfig.notes')
require('plugConfig.neorg')

10 changes: 10 additions & 0 deletions .config/nvim/lua/keymap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ keymap('n', '<Leader>fg', ':Telescope live_grep<CR>', opts)
keymap('n', '<Leader>fs', ':Telescope grep_string<CR>', opts)


-- Notes (telekasten)
keymap('n', '<Leader>zf', ':lua require("telekasten").find_notes()<CR>', opts)

keymap('n', '<Leader>z', ':lua require("telekasten").panel()<CR>', opts)

-- Neorg Not using default https://github.com/nvim-neorg/neorg/blob/main/lua/neorg/modules/core/keybinds/keybinds.lua
keymap('n', '<Leader>otc', ':Neorg keybind norg core.gtd.base.capture<CR>', opts)
keymap('n', '<Leader>otv', ':Neorg keybind norg core.gtd.base.views<CR>', opts)
keymap('n', '<Leader>ote', ':Neorg keybind norg core.gtd.base.edit<CR>', opts)
keymap('n', '<Leader>ott', ':Neorg keybind norg core.norg.qol.todo_items.todo.task_cycle<CR>', opts)
keymap('n', '<Leader>oo', ':Neorg keybind norg core.norg.esupports.hop.hop-link<CR>', opts)


29 changes: 29 additions & 0 deletions .config/nvim/lua/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,35 @@ vim.api.nvim_set_keymap('n', '<space>q', '<cmd>lua vim.diagnostic.setloclist()<C
-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer
local on_attach = function(client, bufnr)
local on_attach = function(client, bufnr)
protocol.CompletionItemKind = {
'', -- 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
}
end
-- Enable completion triggered by <c-x><c-o>
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')

Expand Down
1 change: 1 addition & 0 deletions .config/nvim/lua/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ vim.cmd "colorscheme nord"
vim.o.number = true
vim.o.relativenumber = true
vim.o.mouse = "a"
vim.o.tabstop = 2
10 changes: 10 additions & 0 deletions .config/nvim/lua/plugins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ use 'rafamadriz/friendly-snippets'
use "williamboman/nvim-lsp-installer"
use "neovim/nvim-lspconfig"

-- Notes
use 'renerocksai/telekasten.nvim'

use {
"nvim-neorg/neorg",
-- tag = "latest",
--ft = "norg",
--after = {"nvim-treesitter", "nvim-telescope"},
}

-- Util
use "folke/which-key.nvim"

Expand Down

0 comments on commit d837f82

Please sign in to comment.