-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.lua
103 lines (94 loc) · 2.71 KB
/
init.lua
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
require 'core.options' -- Load general options
require 'core.keymaps' -- Load general keymaps
require 'core.snippets' -- Custom code snippets
-- Install package manager
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
vim.fn.system {
'git',
'clone',
'--filter=blob:none',
'https://github.com/folke/lazy.nvim.git',
'--branch=stable', -- latest stable release
lazypath,
}
end
vim.opt.rtp:prepend(lazypath)
-- Import color theme based on environment variable NVIM_THEME
local default_color_scheme = 'tokyonight'
local env_var_nvim_theme = os.getenv 'NVIM_THEME' or default_color_scheme
-- Define a table of theme modules
local themes = {
nord = 'plugins.themes.nord',
onedark = 'plugins.themes.onedark',
tokyonight = 'plugins.themes.tokyonight',
}
-- Setup plugins
require('lazy').setup({
require(themes[env_var_nvim_theme]),
require 'plugins.telescope',
require 'plugins.treesitter',
require 'plugins.lsp',
require 'plugins.autocompletion',
require 'plugins.none-ls',
require 'plugins.lualine',
require 'plugins.bufferline',
require 'plugins.neo-tree',
-- require 'plugins.alpha',
require 'plugins.indent-blankline',
require 'plugins.lazygit',
-- require 'plugins.comment',
require 'plugins.debug',
require 'plugins.gitsigns',
require 'plugins.database',
require 'plugins.misc',
require 'plugins.harpoon',
-- require 'plugins.avante',
-- require 'plugins.chatgpt',
require 'plugins.aerial',
require 'plugins.vim-tmux-navigator',
require 'plugins.markdown_preview',
}, {
ui = {
-- If you have a Nerd Font, set icons to an empty table which will use the
-- default lazy.nvim defined Nerd Font icons otherwise define a unicode icons table
icons = vim.g.have_nerd_font and {} or {
cmd = '⌘',
config = '🛠',
event = '📅',
ft = '📂',
init = '⚙',
keys = '🗝',
plugin = '🔌',
runtime = '💻',
require = '🌙',
source = '📄',
start = '🚀',
task = '📌',
lazy = '💤 ',
},
},
})
-- Function to check if a file exists
local function file_exists(file)
local f = io.open(file, 'r')
if f then
f:close()
return true
else
return false
end
end
-- Path to the session file
local session_file = '.session.vim'
-- Check if the session file exists in the current directory
if file_exists(session_file) then
-- Source the session file
vim.cmd('source ' .. session_file)
end
-- BUG:
-- treesitter is only working on clang compiler
require('nvim-treesitter.install').compilers = { 'clang' }
-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et
-- this is also a todo