1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
{ pkgs, config, lib, ... }:
{
home.packages = with pkgs; [
zathura
ripgrep
fd
];
programs.neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
plugins = with pkgs.vimPlugins; [
vimtex
(nvim-treesitter.withPlugins (p: [ p.lua p.nix p.rust p.python p.bash p.latex p.c])) # Syntax highlighting + language servers
telescope-nvim # File search
plenary-nvim # Lua functions
which-key-nvim # Keybind suggestions
catppuccin-nvim # Catppuccin theme
nvim-tree-lua # Tree file browser
nvim-web-devicons # Icons
orgmode # Obsidian.md stuff for neovim
toggleterm # Togglable terminal in Neovim
{
plugin = vim-startify; # Add the plugin and its coresponding config
config = "let g:startify_change_to_vcs_root = 0";
}
];
extraLuaConfig = ''
vim.g.mapleader = " "
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.clipboard = "unnamedplus"
vim.o.timeout = true
vim.o.timeoutlen = 300
vim.cmd.colorscheme("catppuccin")
-- KEYBINDS --
vim.keymap.set("n", "<leader><leader>", function()
require("telescope.builtin").find_files({
cwd = vim.loop.cwd(),
})
end, { desc = "Find files (cwd)" })
-- Catppuccin theme
require("catppuccin").setup({
flavour = "mocha", -- latte, frappe, macchiato, mocha
transparent_background = false,
})
-- Treesitter
require("nvim-treesitter.configs").setup({
highlight = { enable = true },
indent = { enable = true },
})
-- Telescope
local telescope = require("telescope")
local builtin = require("telescope.builtin")
telescope.setup({
defaults = {
layout_strategy = "horizontal",
layout_config = {
prompt_position = "top",
},
sorting_strategy = "ascending",
winblend = 0,
},
})
-- Which-key keybind show
require("which-key").setup({
-- Optional custom config here
})
-- Telescope keymaps
vim.keymap.set("n", "<leader>ff", builtin.find_files)
vim.keymap.set("n", "<leader>fg", builtin.live_grep)
vim.keymap.set("n", "<leader>fb", builtin.buffers)
vim.keymap.set("n", "<leader>fh", builtin.help_tags)
-- File tree
require("nvim-tree").setup({
view = {
width = 30,
side = "left",
},
renderer = {
group_empty = true,
},
filters = {
dotfiles = false,
},
})
-- Keybind to toggle
vim.keymap.set("n", "<leader>e", "<cmd>NvimTreeToggle<CR>")
-- Orgmode setup
require('orgmode').setup({
org_agenda_files = {'~/Documents/2. Writing/0. SOČ/org/*.org'},
org_default_notes_file = '~/Documents/2. Writing/0. SOČ/org/index.org',
})
------------------------------------------------------------------
-- LaTeX configuration (from old LazyVim config)
------------------------------------------------------------------
-- vimtex settings
vim.g.vimtex_view_method = "zathura"
vim.g.vimtex_compiler_latexmk = {
build_dir = "",
executable = "latexmk",
options = {
"-pdf",
"-interaction=nonstopmode",
"-synctex=1",
"-file-line-error",
},
}
-- Let treesitter handle LaTeX highlighting
vim.g.vimtex_syntax_enabled = 0
-- ToggleTerm setup
require("toggleterm").setup({
size = 20,
open_mapping = [[<c-\>]],
direction = "float",
float_opts = {
border = "rounded",
},
})
-- Lazygit floating terminal
local Terminal = require("toggleterm.terminal").Terminal
local lazygit = Terminal:new({
cmd = "lazygit",
hidden = true,
direction = "float",
float_opts = {
border = "rounded",
},
})
function _LAZYGIT_TOGGLE()
lazygit:toggle()
end
vim.keymap.set("n", "<leader>gg", _LAZYGIT_TOGGLE, { desc = "Lazygit" })
-- Auto settings for LaTeX files
vim.api.nvim_create_autocmd("FileType", {
pattern = "tex",
callback = function()
vim.opt_local.wrap = true
vim.opt_local.linebreak = true
vim.opt_local.breakindent = true
vim.opt_local.breakindentopt = "shift:2"
vim.opt_local.textwidth = 0
end,
})
'';
};
}
|