neovim - obsidian
This commit is contained in:
@@ -1,6 +1,18 @@
|
||||
{ pkgs, config, ... }:
|
||||
|
||||
{
|
||||
let
|
||||
obsidian-nvim = pkgs.vimUtils.buildVimPlugin {
|
||||
pname = "obsidian.nvim";
|
||||
version = "v3.5.1";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "epwalsh";
|
||||
repo = "obsidian.nvim";
|
||||
rev = "4eb44381811ab6af67b9f9fe3117616afbe1e118";
|
||||
sha256 = "sha256-/zj12pwppb1RGi3EovXla6Ahzkoxh3qhxQFOfnfPwac=";
|
||||
};
|
||||
meta.homepage = "https://github.com/epwalsh/obsidian.nvim";
|
||||
};
|
||||
in {
|
||||
home.sessionVariables = { EDITOR = "nvim"; };
|
||||
|
||||
programs.neovim = {
|
||||
@@ -9,14 +21,25 @@
|
||||
withPython3 = true;
|
||||
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
# Plugin-Manager
|
||||
lazy-nvim
|
||||
|
||||
# Theme
|
||||
catppuccin-nvim
|
||||
|
||||
# Obsidian
|
||||
obsidian-nvim
|
||||
|
||||
plenary-nvim
|
||||
telescope-nvim
|
||||
|
||||
nvim-cmp
|
||||
|
||||
nvim-treesitter.withAllGrammars
|
||||
];
|
||||
|
||||
extraLuaConfig = ''
|
||||
vim.g.mapleader = " "
|
||||
require("plugins")
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
-- Import plugins from lua/plugins
|
||||
@@ -33,7 +56,7 @@
|
||||
pkgs.vimUtils.packDir
|
||||
config.programs.neovim.finalPackage.passthru.packpathDirs
|
||||
}/pack/myNeovimPackages/start",
|
||||
patterns = {"folke", "catppuccin"},
|
||||
patterns = {"folke", "catppuccin", "epwalsh"},
|
||||
},
|
||||
install = {
|
||||
-- Safeguard in case we forget to install a plugin with Nix
|
||||
|
||||
@@ -8,6 +8,7 @@ return {
|
||||
vim.cmd.colorscheme("catppuccin")
|
||||
end,
|
||||
opts = {
|
||||
flavor = "mocha",
|
||||
integrations = {
|
||||
nvimtree = true,
|
||||
dashboard = true,
|
||||
|
||||
77
home/programs/neovim/lua/plugins/nvim-cmp.lua
Normal file
77
home/programs/neovim/lua/plugins/nvim-cmp.lua
Normal file
@@ -0,0 +1,77 @@
|
||||
return {
|
||||
-- auto completion
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-buffer", -- source for text in buffer
|
||||
"hrsh7th/cmp-path", -- source for file system paths
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"L3MON4D3/LuaSnip", -- snippet engine
|
||||
"saadparwaiz1/cmp_luasnip", -- for autocompletion
|
||||
"rafamadriz/friendly-snippets", -- useful snippets
|
||||
"onsails/lspkind.nvim", -- vs-code like pictograms
|
||||
"PaterJason/cmp-conjure", -- nvim-cmp source for conjure.
|
||||
},
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
local lspkind = require("lspkind")
|
||||
|
||||
-- loads vscode style snippets from installed plugins (e.g. friendly-snippets)
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
|
||||
cmp.setup({
|
||||
completion = {
|
||||
completeopt = "menu,menuone,noinsert",
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-u>"] = cmp.mapping.scroll_docs(-4), -- Up
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(4), -- Down
|
||||
["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions
|
||||
["<C-e>"] = cmp.mapping.abort(), -- close completion window
|
||||
["<CR>"] = cmp.mapping.confirm({ select = false }),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
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 for autocompletion
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "path" },
|
||||
{ name = "buffer" },
|
||||
{ name = "conjure" },
|
||||
}),
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
-- configure lspkind for vs-code like pictograms in completion menu
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
maxwidth = 50,
|
||||
ellipsis_char = "...",
|
||||
}),
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
36
home/programs/neovim/lua/plugins/obsidian.lua
Normal file
36
home/programs/neovim/lua/plugins/obsidian.lua
Normal file
@@ -0,0 +1,36 @@
|
||||
return {
|
||||
{
|
||||
"epwalsh/obsidian.nvim",
|
||||
lazy = true,
|
||||
event = {
|
||||
"BufReadPre " .. vim.fn.expand("~") .. "/Notes/**.md",
|
||||
"BufNewFile " .. vim.fn.expand("~") .. "/Notes/**.md",
|
||||
},
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"hrsh7th/nvim-cmp",
|
||||
"nvim-telescope/telescope.nvim",
|
||||
"nvim-treesitter",
|
||||
},
|
||||
config = function()
|
||||
vim.opt.conceallevel = 2
|
||||
require("obsidian").setup({
|
||||
workspaces = {
|
||||
{
|
||||
name = "personal",
|
||||
path = "~/Notes/personal",
|
||||
},
|
||||
{
|
||||
name = "work",
|
||||
path = "~/Notes/work",
|
||||
},
|
||||
{
|
||||
name = "studies",
|
||||
path = "~/Notes/studies",
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
20
home/programs/neovim/lua/plugins/tools.lua
Normal file
20
home/programs/neovim/lua/plugins/tools.lua
Normal file
@@ -0,0 +1,20 @@
|
||||
return {
|
||||
{ "nvim-lua/plenary.nvim" },
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
config = function()
|
||||
require("telescope").setup({})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvim-telescope/telescope-fzf-native.nvim",
|
||||
config = function()
|
||||
require("telescope").setup({})
|
||||
-- To get fzf loaded and working with telescope, you need to call
|
||||
-- load_extension, somewhere after setup function:
|
||||
require("telescope").load_extension("fzf")
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
56
home/programs/neovim/lua/plugins/treesitter.lua
Normal file
56
home/programs/neovim/lua/plugins/treesitter.lua
Normal file
@@ -0,0 +1,56 @@
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
config = function()
|
||||
local treesitter = require("nvim-treesitter.configs")
|
||||
|
||||
treesitter.setup({
|
||||
highlight = {
|
||||
enable = true,
|
||||
disable = { "latex" },
|
||||
additional_vim_regex_highlighting = { "latex", "markdown" },
|
||||
},
|
||||
indent = { enable = true },
|
||||
})
|
||||
end,
|
||||
dependencies = {
|
||||
"HiPhish/rainbow-delimiters",
|
||||
config = function()
|
||||
-- This module contains a number of default definitions
|
||||
local rainbow_delimiters = require("rainbow-delimiters")
|
||||
|
||||
vim.g.rainbow_delimiters = {
|
||||
strategy = {
|
||||
[""] = rainbow_delimiters.strategy["global"],
|
||||
vim = rainbow_delimiters.strategy["local"],
|
||||
},
|
||||
query = {
|
||||
[""] = "rainbow-delimiters",
|
||||
lua = "rainbow-blocks",
|
||||
},
|
||||
priority = {
|
||||
[""] = 110,
|
||||
lua = 210,
|
||||
},
|
||||
highlight = {
|
||||
"RainbowDelimiterRed",
|
||||
"RainbowDelimiterYellow",
|
||||
"RainbowDelimiterBlue",
|
||||
"RainbowDelimiterOrange",
|
||||
"RainbowDelimiterGreen",
|
||||
"RainbowDelimiterViolet",
|
||||
"RainbowDelimiterCyan",
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user