diff --git a/init.lua b/init.lua index 506bbaf5..3651af6d 100644 --- a/init.lua +++ b/init.lua @@ -91,7 +91,7 @@ vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' -- 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 ]] -- See `:help vim.opt` @@ -159,6 +159,9 @@ vim.opt.scrolloff = 10 -- Set highlight on search, but clear on pressing in normal mode vim.opt.hlsearch = true + +require 'options' + vim.keymap.set('n', '', 'nohlsearch') -- Diagnostic keymaps @@ -176,10 +179,10 @@ vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagn vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) -- TIP: Disable arrow keys in normal mode --- vim.keymap.set('n', '', 'echo "Use h to move!!"') --- vim.keymap.set('n', '', 'echo "Use l to move!!"') --- vim.keymap.set('n', '', 'echo "Use k to move!!"') --- vim.keymap.set('n', '', 'echo "Use j to move!!"') +vim.keymap.set('n', '', 'echo "Use h to move!!"') +vim.keymap.set('n', '', 'echo "Use l to move!!"') +vim.keymap.set('n', '', 'echo "Use k to move!!"') +vim.keymap.set('n', '', 'echo "Use j to move!!"') -- Keybinds to make split navigation easier. -- Use CTRL+ to switch between windows @@ -190,6 +193,8 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the right win vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) +require 'keymaps' + -- [[ Basic Autocommands ]] -- See `:help lua-guide-autocommands` @@ -368,7 +373,7 @@ require('lazy').setup({ local builtin = require 'telescope.builtin' vim.keymap.set('n', 'sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) vim.keymap.set('n', 'sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' }) - vim.keymap.set('n', 'sf', builtin.find_files, { desc = '[S]earch [F]iles' }) + vim.keymap.set('n', 'ff', builtin.find_files, { desc = '[S]earch [F]iles' }) vim.keymap.set('n', 'ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) vim.keymap.set('n', 'sw', builtin.grep_string, { desc = '[S]earch current [W]ord' }) vim.keymap.set('n', '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/ local servers = { -- clangd = {}, - -- gopls = {}, + gopls = {}, + tailwindcss = { + filetypes = { "templ" }, + init_options = { userLanguages = { templ = "html" } }, + }, + htmx = { + filetypes = { 'templ', 'html' } + }, + emmet_ls = { + filetypes = { 'html', 'templ' } + }, -- pyright = {}, -- rust_analyzer = {}, -- ... 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. -- This will auto-import if your LSP supports it. -- This will expand snippets if the LSP sent a snippet. - [''] = cmp.mapping.confirm { select = true }, + [''] = cmp.mapping.confirm { select = true }, -- Manually trigger a completion from nvim-cmp. -- 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 -- -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme` - 'folke/tokyonight.nvim', - priority = 1000, -- make sure to load this before all the other start plugins - init = function() - -- Load the colorscheme here. - -- Like many other themes, this one has different styles, and you could load - -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. - vim.cmd.colorscheme 'tokyonight-night' - - -- You can configure highlights by doing something like - vim.cmd.hi 'Comment gui=none' - end, + -- 'folke/tokyonight.nvim', + -- priority = 1000, -- make sure to load this before all the other start plugins + -- init = function() + -- -- Load the colorscheme here. + -- -- Like many other themes, this one has different styles, and you could load + -- -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. + -- vim.cmd.colorscheme 'tokyonight-night' + -- + -- -- You can configure highlights by doing something like + -- vim.cmd.hi 'Comment gui=none' + -- end, }, -- Highlight todo, notes, etc in comments @@ -793,7 +808,7 @@ require('lazy').setup({ 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', 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 auto_install = true, highlight = { diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index be0eb9d8..7df6a584 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -2,4 +2,115 @@ -- I promise not to create any merge conflicts in this directory :) -- -- 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 + }, + }, +} diff --git a/lua/keymaps.lua b/lua/keymaps.lua new file mode 100644 index 00000000..0298123c --- /dev/null +++ b/lua/keymaps.lua @@ -0,0 +1,62 @@ +vim.keymap.set("n", "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 '>+1gv=gv") +vim.keymap.set("v", "K", ":m '<-2gv=gv") + +-- not sure +-- vim.keymap.set("n", "J", "mzJ`z") +-- vim.keymap.set("n", "", "zz") +-- vim.keymap.set("n", "", "zz") +-- vim.keymap.set("n", "n", "nzzzv") +-- vim.keymap.set("n", "N", "Nzzzv") + +-- greatest remap ever, also not sure +-- vim.keymap.set("x", "p", "\"_dP") + +-- This is going to get me cancelled +vim.keymap.set("i", "", "") + +-- thank theprimeagen later +vim.keymap.set('n', 're', "oif err != nil {}Oreturn err") + +-- wiki +vim.keymap.set('n', 'ww', vim.cmd.WikiIndex, { noremap = true, silent = true, desc = "Open Wiki" }) +vim.keymap.set('n', 'mj', vim.cmd.WikiJournal, { noremap = true, silent = true, desc = "[M]ake [J]ournal" }) +vim.keymap.set('n', 'ji', vim.cmd.WikiJournalIndex, + { noremap = true, silent = true, desc = "Make [J]ournal [I]ndex" }) + +-- diffview +vim.keymap.set("n", 'vf', 'DiffviewFileHistory %') +vim.keymap.set("n", 'vb', 'DiffviewFileHistory') +vim.keymap.set("n", 'vc', 'DiffviewClose') + +-- zenmode +vim.keymap.set("n", 'zm', 'ZenMode') + +-- undo tree +vim.keymap.set("n", "u", vim.cmd.UndotreeToggle) + +-- copilot +vim.keymap.set('i', "", "copilot#Accept('')", { + expr = true, + replace_keycodes = false +}) + +vim.keymap.set('i', "", "(copilot-next)") + +vim.keymap.set('i', "", "(copilot-previous)") + +vim.keymap.set('i', "", "(copilot-accept-word)") + +vim.keymap.set('i', "", "(copilot-suggest)") + +-- oil +vim.keymap.set("n", "o", "Oil", { desc = "Open parent directory" }) + +-- lazygit +vim.keymap.set("n", "gg", "LazyGit", { desc = "Open lazygit" }) diff --git a/lua/options.lua b/lua/options.lua new file mode 100644 index 00000000..6e278c7e --- /dev/null +++ b/lua/options.lua @@ -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