chore: make it modular
This commit is contained in:
parent
a222805c61
commit
1a37e123f5
55
init.lua
55
init.lua
|
@ -91,7 +91,7 @@ vim.g.mapleader = ' '
|
||||||
vim.g.maplocalleader = ' '
|
vim.g.maplocalleader = ' '
|
||||||
|
|
||||||
-- Set to true if you have a Nerd Font installed
|
-- Set to true if you have a Nerd Font installed
|
||||||
vim.g.have_nerd_font = false
|
vim.g.have_nerd_font = true -- new
|
||||||
|
|
||||||
-- [[ Setting options ]]
|
-- [[ Setting options ]]
|
||||||
-- See `:help vim.opt`
|
-- See `:help vim.opt`
|
||||||
|
@ -159,6 +159,9 @@ vim.opt.scrolloff = 10
|
||||||
|
|
||||||
-- Set highlight on search, but clear on pressing <Esc> in normal mode
|
-- Set highlight on search, but clear on pressing <Esc> in normal mode
|
||||||
vim.opt.hlsearch = true
|
vim.opt.hlsearch = true
|
||||||
|
|
||||||
|
require 'options'
|
||||||
|
|
||||||
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
||||||
|
|
||||||
-- Diagnostic keymaps
|
-- Diagnostic keymaps
|
||||||
|
@ -176,10 +179,10 @@ vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagn
|
||||||
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
|
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
|
||||||
|
|
||||||
-- TIP: Disable arrow keys in normal mode
|
-- TIP: Disable arrow keys in normal mode
|
||||||
-- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
|
vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
|
||||||
-- vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
|
vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
|
||||||
-- vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
|
vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
|
||||||
-- vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
|
vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
|
||||||
|
|
||||||
-- Keybinds to make split navigation easier.
|
-- Keybinds to make split navigation easier.
|
||||||
-- Use CTRL+<hjkl> to switch between windows
|
-- Use CTRL+<hjkl> to switch between windows
|
||||||
|
@ -190,6 +193,8 @@ vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right win
|
||||||
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
|
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
|
||||||
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
|
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
|
||||||
|
|
||||||
|
require 'keymaps'
|
||||||
|
|
||||||
-- [[ Basic Autocommands ]]
|
-- [[ Basic Autocommands ]]
|
||||||
-- See `:help lua-guide-autocommands`
|
-- See `:help lua-guide-autocommands`
|
||||||
|
|
||||||
|
@ -368,7 +373,7 @@ require('lazy').setup({
|
||||||
local builtin = require 'telescope.builtin'
|
local builtin = require 'telescope.builtin'
|
||||||
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
|
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
|
||||||
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
|
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
|
||||||
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
|
vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = '[S]earch [F]iles' })
|
||||||
vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
|
vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
|
||||||
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
|
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
|
||||||
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
|
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
|
||||||
|
@ -540,7 +545,17 @@ require('lazy').setup({
|
||||||
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
|
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
|
||||||
local servers = {
|
local servers = {
|
||||||
-- clangd = {},
|
-- clangd = {},
|
||||||
-- gopls = {},
|
gopls = {},
|
||||||
|
tailwindcss = {
|
||||||
|
filetypes = { "templ" },
|
||||||
|
init_options = { userLanguages = { templ = "html" } },
|
||||||
|
},
|
||||||
|
htmx = {
|
||||||
|
filetypes = { 'templ', 'html' }
|
||||||
|
},
|
||||||
|
emmet_ls = {
|
||||||
|
filetypes = { 'html', 'templ' }
|
||||||
|
},
|
||||||
-- pyright = {},
|
-- pyright = {},
|
||||||
-- rust_analyzer = {},
|
-- rust_analyzer = {},
|
||||||
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
|
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
|
||||||
|
@ -692,7 +707,7 @@ require('lazy').setup({
|
||||||
-- Accept ([y]es) the completion.
|
-- Accept ([y]es) the completion.
|
||||||
-- This will auto-import if your LSP supports it.
|
-- This will auto-import if your LSP supports it.
|
||||||
-- This will expand snippets if the LSP sent a snippet.
|
-- This will expand snippets if the LSP sent a snippet.
|
||||||
['<C-y>'] = cmp.mapping.confirm { select = true },
|
['<CR>'] = cmp.mapping.confirm { select = true },
|
||||||
|
|
||||||
-- Manually trigger a completion from nvim-cmp.
|
-- Manually trigger a completion from nvim-cmp.
|
||||||
-- Generally you don't need this, because nvim-cmp will display
|
-- Generally you don't need this, because nvim-cmp will display
|
||||||
|
@ -735,17 +750,17 @@ require('lazy').setup({
|
||||||
-- change the command in the config to whatever the name of that colorscheme is
|
-- change the command in the config to whatever the name of that colorscheme is
|
||||||
--
|
--
|
||||||
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`
|
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`
|
||||||
'folke/tokyonight.nvim',
|
-- 'folke/tokyonight.nvim',
|
||||||
priority = 1000, -- make sure to load this before all the other start plugins
|
-- priority = 1000, -- make sure to load this before all the other start plugins
|
||||||
init = function()
|
-- init = function()
|
||||||
-- Load the colorscheme here.
|
-- -- Load the colorscheme here.
|
||||||
-- Like many other themes, this one has different styles, and you could load
|
-- -- Like many other themes, this one has different styles, and you could load
|
||||||
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
|
-- -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
|
||||||
vim.cmd.colorscheme 'tokyonight-night'
|
-- vim.cmd.colorscheme 'tokyonight-night'
|
||||||
|
--
|
||||||
-- You can configure highlights by doing something like
|
-- -- You can configure highlights by doing something like
|
||||||
vim.cmd.hi 'Comment gui=none'
|
-- vim.cmd.hi 'Comment gui=none'
|
||||||
end,
|
-- end,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Highlight todo, notes, etc in comments
|
-- Highlight todo, notes, etc in comments
|
||||||
|
@ -793,7 +808,7 @@ require('lazy').setup({
|
||||||
'nvim-treesitter/nvim-treesitter',
|
'nvim-treesitter/nvim-treesitter',
|
||||||
build = ':TSUpdate',
|
build = ':TSUpdate',
|
||||||
opts = {
|
opts = {
|
||||||
ensure_installed = { 'bash', 'c', 'html', 'lua', 'markdown', 'vim', 'vimdoc' },
|
ensure_installed = { 'go', 'lua', 'rust', 'vimdoc', 'vim', 'bash', 'templ' },
|
||||||
-- Autoinstall languages that are not installed
|
-- Autoinstall languages that are not installed
|
||||||
auto_install = true,
|
auto_install = true,
|
||||||
highlight = {
|
highlight = {
|
||||||
|
|
|
@ -2,4 +2,115 @@
|
||||||
-- I promise not to create any merge conflicts in this directory :)
|
-- I promise not to create any merge conflicts in this directory :)
|
||||||
--
|
--
|
||||||
-- See the kickstart.nvim README for more information
|
-- See the kickstart.nvim README for more information
|
||||||
return {}
|
return {
|
||||||
|
"github/copilot.vim",
|
||||||
|
|
||||||
|
-- lazy.nvim
|
||||||
|
{
|
||||||
|
"m4xshen/hardtime.nvim",
|
||||||
|
dependencies = { "MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim" },
|
||||||
|
opts = {}
|
||||||
|
},
|
||||||
|
-- Lua
|
||||||
|
{
|
||||||
|
"folke/twilight.nvim",
|
||||||
|
opts = {
|
||||||
|
-- your configuration comes here
|
||||||
|
-- or leave it empty to use the default settings
|
||||||
|
-- refer to the configuration section below
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mbbill/undotree",
|
||||||
|
|
||||||
|
{ 'numToStr/Comment.nvim', opts = {} },
|
||||||
|
|
||||||
|
{
|
||||||
|
"NoahTheDuke/vim-just",
|
||||||
|
ft = { "just" },
|
||||||
|
},
|
||||||
|
|
||||||
|
'vimwiki/vimwiki',
|
||||||
|
'lervag/wiki.vim',
|
||||||
|
-- Lua
|
||||||
|
{
|
||||||
|
"folke/zen-mode.nvim",
|
||||||
|
opts = {
|
||||||
|
window = {
|
||||||
|
-- width = 1.0, -- recording full screen
|
||||||
|
width = 55, -- recording shorts screen
|
||||||
|
options = {
|
||||||
|
signcolumn = "no", -- disable signcolumn
|
||||||
|
-- number = false, -- disable number column
|
||||||
|
-- relativenumber = false, -- disable relative numbers
|
||||||
|
-- cursorline = false, -- disable cursorline
|
||||||
|
-- cursorcolumn = false, -- disable cursor column
|
||||||
|
-- foldcolumn = "0", -- disable fold column
|
||||||
|
-- list = false, -- disable whitespace characters
|
||||||
|
},
|
||||||
|
},
|
||||||
|
plugins = {
|
||||||
|
twilight = { enabled = false },
|
||||||
|
kitty = {
|
||||||
|
enabled = true,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ray-x/go.nvim",
|
||||||
|
dependencies = {},
|
||||||
|
config = function()
|
||||||
|
require("go").setup()
|
||||||
|
end,
|
||||||
|
event = { "CmdlineEnter" },
|
||||||
|
ft = { "go", 'gomod' },
|
||||||
|
build = ':lua require("go.install").update_all_sync()' -- if you need to install/update all binaries
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"sainnhe/gruvbox-material",
|
||||||
|
lazy = false, -- make sure we load this during startup if it is your main colorscheme
|
||||||
|
priority = 1000, -- make sure to load this before all the other start plugins
|
||||||
|
config = function()
|
||||||
|
-- load the colorscheme here
|
||||||
|
vim.cmd([[colorscheme gruvbox-material]])
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- comes statusline with tmux
|
||||||
|
-- 'vimpostor/vim-tpipeline',
|
||||||
|
|
||||||
|
{
|
||||||
|
'stevearc/oil.nvim',
|
||||||
|
opts = {
|
||||||
|
-- Set to false if you still want to use netrw.
|
||||||
|
default_file_explorer = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kdheepak/lazygit.nvim",
|
||||||
|
cmd = {
|
||||||
|
"LazyGit",
|
||||||
|
"LazyGitConfig",
|
||||||
|
"LazyGitCurrentFile",
|
||||||
|
"LazyGitFilter",
|
||||||
|
"LazyGitFilterCurrentFile",
|
||||||
|
},
|
||||||
|
-- optional for floating window border decoration
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"mistricky/codesnap.nvim",
|
||||||
|
build = "make",
|
||||||
|
opts = {
|
||||||
|
mac_window_bar = false, -- (Optional) MacOS style title bar switch
|
||||||
|
opacity = true, -- (Optional) The code snap has some opacity by default, set it to false for 100% opacity
|
||||||
|
watermark = "@mbvisti", -- (Optional) you can custom your own watermark, but if you don't like it, just set it to ""
|
||||||
|
preview_title = "mbv labs", -- (Optional) preview page title
|
||||||
|
editor_font_family = "CaskaydiaCove Nerd Font", -- (Optional) preview code font family
|
||||||
|
watermark_font_family = "Pacifico", -- (Optional) watermark font family
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
vim.keymap.set("n", "<leader>pq", vim.cmd.Ex)
|
||||||
|
|
||||||
|
-- Remap for dealing with word wrap
|
||||||
|
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
||||||
|
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
||||||
|
|
||||||
|
-- move a selection up and down
|
||||||
|
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
|
||||||
|
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
|
||||||
|
|
||||||
|
-- not sure
|
||||||
|
-- vim.keymap.set("n", "J", "mzJ`z")
|
||||||
|
-- vim.keymap.set("n", "<C-d>", "<C-d>zz")
|
||||||
|
-- vim.keymap.set("n", "<C-u>", "<C-u>zz")
|
||||||
|
-- vim.keymap.set("n", "n", "nzzzv")
|
||||||
|
-- vim.keymap.set("n", "N", "Nzzzv")
|
||||||
|
|
||||||
|
-- greatest remap ever, also not sure
|
||||||
|
-- vim.keymap.set("x", "<leader>p", "\"_dP")
|
||||||
|
|
||||||
|
-- This is going to get me cancelled
|
||||||
|
vim.keymap.set("i", "<C-c>", "<Esc>")
|
||||||
|
|
||||||
|
-- thank theprimeagen later
|
||||||
|
vim.keymap.set('n', '<leader>re', "oif err != nil {<CR>}<ESC>Oreturn err")
|
||||||
|
|
||||||
|
-- wiki
|
||||||
|
vim.keymap.set('n', '<leader>ww', vim.cmd.WikiIndex, { noremap = true, silent = true, desc = "Open Wiki" })
|
||||||
|
vim.keymap.set('n', '<leader>mj', vim.cmd.WikiJournal, { noremap = true, silent = true, desc = "[M]ake [J]ournal" })
|
||||||
|
vim.keymap.set('n', '<leader>ji', vim.cmd.WikiJournalIndex,
|
||||||
|
{ noremap = true, silent = true, desc = "Make [J]ournal [I]ndex" })
|
||||||
|
|
||||||
|
-- diffview
|
||||||
|
vim.keymap.set("n", '<leader>vf', '<cmd>DiffviewFileHistory %<CR>')
|
||||||
|
vim.keymap.set("n", '<leader>vb', '<cmd>DiffviewFileHistory<CR>')
|
||||||
|
vim.keymap.set("n", '<leader>vc', '<cmd>DiffviewClose<CR>')
|
||||||
|
|
||||||
|
-- zenmode
|
||||||
|
vim.keymap.set("n", '<leader>zm', '<cmd>ZenMode<CR>')
|
||||||
|
|
||||||
|
-- undo tree
|
||||||
|
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
|
||||||
|
|
||||||
|
-- copilot
|
||||||
|
vim.keymap.set('i', "<M-CR>", "copilot#Accept('<CR>')", {
|
||||||
|
expr = true,
|
||||||
|
replace_keycodes = false
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.keymap.set('i', "<M-]>", "<Plug>(copilot-next)")
|
||||||
|
|
||||||
|
vim.keymap.set('i', "<M-[>", "<Plug>(copilot-previous)")
|
||||||
|
|
||||||
|
vim.keymap.set('i', "<M-a>", "<Plug>(copilot-accept-word)")
|
||||||
|
|
||||||
|
vim.keymap.set('i', "<M-/>", "<Plug>(copilot-suggest)")
|
||||||
|
|
||||||
|
-- oil
|
||||||
|
vim.keymap.set("n", "<leader>o", "<CMD>Oil<CR>", { desc = "Open parent directory" })
|
||||||
|
|
||||||
|
-- lazygit
|
||||||
|
vim.keymap.set("n", "<leader>gg", "<CMD>LazyGit<CR>", { desc = "Open lazygit" })
|
|
@ -0,0 +1,30 @@
|
||||||
|
vim.opt.relativenumber = true
|
||||||
|
|
||||||
|
vim.o.undodir = os.getenv("HOME") .. "/.neovim/undodir"
|
||||||
|
|
||||||
|
-- TODO check if needed
|
||||||
|
vim.o.incsearch = true
|
||||||
|
|
||||||
|
vim.o.swapfile = false
|
||||||
|
vim.o.backup = false
|
||||||
|
|
||||||
|
vim.o.colorcolumn = "120" -- sets the separator bar
|
||||||
|
|
||||||
|
vim.o.errorbells = false
|
||||||
|
|
||||||
|
vim.o.cursorline = true
|
||||||
|
|
||||||
|
vim.g.netrw_banner = 0
|
||||||
|
vim.g.netrw_winsize = 25
|
||||||
|
|
||||||
|
vim.g.wiki_root = "~/wiki"
|
||||||
|
vim.cmd [[
|
||||||
|
let g:wiki_journal_index = {
|
||||||
|
\ 'link_text_parser': { b, d, p -> d },
|
||||||
|
\ 'link_url_parser': { b, d, p -> 'journal/' . d }
|
||||||
|
\}
|
||||||
|
]]
|
||||||
|
|
||||||
|
vim.o.guicursor = "a:blinkon0"
|
||||||
|
|
||||||
|
vim.g.copilot_no_tab_map = true
|
Loading…
Reference in New Issue