-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
205 lines (171 loc) · 5.92 KB
/
init.lua
File metadata and controls
205 lines (171 loc) · 5.92 KB
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
-- stuff to setup :
-- when split screen horizontally, how about it splits with the same file and not a blank slate
-- Welcome screen system (with session support?)
-- Ctrl r replace symbol
-- Extra: When I open up a new program, it's a new tab, and I can close and go to previous
-- note that I add this to the .zshrc as well: alias clear="printf \"\33c\e[3J\""
-- Set 24-bit color
vim.opt.termguicolors = true
-- Set the font
-- ultrawide: 13.5
-- computer: 12.5
-- Font up (ultrawide) and font down (small computer)
vim.keymap.set('n', 'fk', function ()
vim.opt.guifont = {"Liga SFMono Nerd Font", ":h13.5"}
vim.cmd("source ~/.config/nvim/init.lua")
end)
vim.keymap.set('n', 'fj', function ()
vim.opt.guifont = {"Liga SFMono Nerd Font", ":h12.5"}
vim.cmd("source ~/.config/nvim/init.lua")
end)
-- Load all configuration files
require("config.lazy")
-- Gruvbox setup
require("gruvbox").setup({
contrast = "hard",
palette_overrides = {
dark0_hard = "#000000",
},
overrides={
Normal = { bg = "#000000" },
NormalNC = { bg = "#000000" },
SignColumn = { bg = "#000000" },
LineNr = { bg = "#000000" },
CursorLineNr = { bg = "#000000" },
StatusLine = { bg = "#000000" },
VertSplit = { bg = "#000000" },
Pmenu = { bg = "#000000" },
PmenuSel = { bg = "#222222", fg="#ffffff"},
Visual = { bg = "#222222" },
CursorLine = { bg = "#222222" },
Search = { bg = "#222222", fg = "#ffffff" },
}
})
-- Force colorscheme
-- Set background to transparent (making everything minimistic)
vim.cmd [[
" Tab + copy and pasting
set tabstop=4
set shiftwidth=4
set clipboard=unnamed " use system keyboard
set nowrap
colorscheme gruvbox
" More minimistic! Remove statusline and tabline
set laststatus=0
set showtabline=0
]]
local telescope = require("telescope")
telescope.setup {
extensions = {
file_browser = {
hidden = { file_browser = true, folder_browser = true },
path = "~/Coding/"
},
},
}
telescope.load_extension "file_browser"
------- Keybinds for telescope -------
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<C-o>', builtin.lsp_dynamic_workspace_symbols, { desc = 'Telescope find workspace symbol' }) -- navigate between workspace symbols (global, not local file)
vim.keymap.set('n', '<C-p>', builtin.find_files, { desc = 'Telescope find files' }) -- switch easily between files
vim.keymap.set('n', '<C-l>', builtin.diagnostics, { desc = 'Telescope find files' }) -- search within errors in a file
vim.keymap.set('n', '<C-f>', builtin.live_grep, { desc = 'Telescope find files' }) -- search within errors in a file
vim.keymap.set('n', 'cr', builtin.lsp_references, { desc = 'Telescope references' })
vim.keymap.set('n', 'cd', builtin.lsp_definitions, { desc = 'Telescope definitions' })
vim.keymap.set('n', 'K', function()
vim.diagnostic.open_float(0, {focusable=true})
end, { desc = 'LSP Hover' }) -- show LSP hover if needed
-- fterm setup
vim.keymap.set('n', 't', require('FTerm').toggle)
-- This is just to make sure that notify background notifs stays quiet
require("notify").setup({
background_colour = "#000000"
})
-- Show virtual text instead of underline
vim.diagnostic.config({
virtual_text = true,
signs = false,
underline = true,
})
-- Some annoying notifications that I do not want
local notify_original = vim.notify
vim.notify = function(msg, ...)
if
msg
and (
msg:match 'position_encoding param is required'
or msg:match 'Defaulting to position encoding of the first client'
or msg:match 'multiple different client offset_encodings'
or msg:match 'jump to location'
)
then
return
end
return notify_original(msg, ...)
end
-- Flash on search
require("flash").setup({
modes = {
search = {
enabled = true, -- Enable flash.nvim during / and ? searches
highlight = { backdrop = true },
jump = { history = true, register = true, nohlsearch = true },
},
},
})
-- if terminal press escape to actually escape
vim.keymap.set('t', '<Esc>', [[<C-\><C-n>]], { noremap = true })
-- also when I am searching, disable it at escape
vim.keymap.set("n", "<Esc>", "<Cmd>nohlsearch<CR>", { silent = true })
-- Pretty hacky solution to this problem...
-- Clear the terminal (including the terminal buffer)
vim.keymap.set('t', '<C-l>', function ()
local enter = vim.api.nvim_replace_termcodes("<CR>", true, true, true)
vim.fn.feedkeys("clear" .. enter, 't') -- Send the 'clear' command with Enter appended to execute it in the terminal
-- reset scrollback (hacky solution...)
vim.cmd("set scrollback=1")
vim.cmd("sleep 10m")
vim.cmd("set scrollback=1024")
end)
---
--[[
require("remote-nvim").setup({
remote_dir = "/sailhome/eshaanb/",
offline_mode = {
enabled = true,
no_github = true,
cache_dir = "/sailhome/eshaanb/.cache/"
}
})
]]--
--
-- Nerd tree (could be more professionally done)
vim.keymap.set('n', '<C-E>', ':NvimTreeFocus<CR>', { noremap = true, silent = true })
vim.keymap.set('n', '<C-b>', ':NvimTreeToggle<CR>', { noremap = true, silent = true })
------------- keybinds for tab --------
vim.keymap.set('n', '<C-t>', ':tabnew<CR>', { noremap = true, silent = true })
vim.keymap.set('n', '<C-Tab>', ':tabnext<CR>', { noremap = true, silent = true })
vim.keymap.set('n', 'T', ':terminal<CR>', { noremap = true, silent = true })
------------ Commands to add to vim as I use them often --------
vim.api.nvim_create_user_command("Config", function()
vim.cmd("edit ~/.config/nvim/init.lua")
end, {})
vim.api.nvim_create_user_command("Refresh", function()
vim.cmd("source ~/.config/nvim/init.lua")
-- vim.cmd(":LspRestart")
end, {})
vim.api.nvim_create_user_command("Todo", function()
vim.cmd("e ./TODO.md")
end, {})
-- I pretty weird and whenever I save I sometimes do :W instead of :w. I'm fixing that
--
vim.api.nvim_create_user_command("W", function()
vim.cmd("w")
end, {})
-- initialize file_browser at startup
--
--vim.api.nvim_create_autocmd("VimEnter", {
--callback = function ()
--vim.cmd("Telescope file_browser")
--end
--})