diff --git a/init.lua b/init.lua index cf4a3790..31f514e0 100644 --- a/init.lua +++ b/init.lua @@ -43,6 +43,9 @@ P.S. You can delete this when you're done too. It's your config now :) -- NOTE: Must happen before plugins are required (otherwise wrong leader will be used) vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 +vim.wo.relativenumber = true -- [[ Install `lazy.nvim` plugin manager ]] -- https://github.com/folke/lazy.nvim @@ -63,7 +66,7 @@ vim.opt.rtp:prepend(lazypath) -- [[ Configure plugins ]] -- NOTE: Here is where you install your plugins. -- You can configure plugins using the `config` key. --- + -- You can also configure plugins after the setup call, -- as they will be available in your neovim runtime. require('lazy').setup({ @@ -91,7 +94,7 @@ require('lazy').setup({ { 'j-hui/fidget.nvim', opts = {} }, -- Additional lua configuration, makes nvim stuff amazing! - 'folke/neodev.nvim', + 'folke/neodev.nvim' }, }, @@ -113,7 +116,7 @@ require('lazy').setup({ }, -- Useful plugin to show you pending keybinds. - { 'folke/which-key.nvim', opts = {} }, + { 'folke/which-key.nvim', opts = {} }, { -- Adds git related signs to the gutter, as well as utilities for managing changes 'lewis6991/gitsigns.nvim', @@ -204,7 +207,7 @@ require('lazy').setup({ -- See `:help lualine.txt` opts = { options = { - icons_enabled = false, + icons_enabled = true, theme = 'onedark', component_separators = '|', section_separators = '', @@ -257,8 +260,8 @@ require('lazy').setup({ -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart -- These are some example plugins that I've included in the kickstart repository. -- Uncomment any of the lines below to enable them. - -- require 'kickstart.plugins.autoformat', - -- require 'kickstart.plugins.debug', + require 'kickstart.plugins.autoformat', + require 'kickstart.plugins.debug', -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping @@ -266,7 +269,7 @@ require('lazy').setup({ -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. -- -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, }, {}) -- [[ Setting options ]] @@ -423,7 +426,8 @@ vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = vim.defer_fn(function() require('nvim-treesitter.configs').setup { -- Add languages to be installed here that you want installed for treesitter - ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim', 'bash' }, + ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim', + 'bash' }, -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) auto_install = false, @@ -485,6 +489,35 @@ vim.defer_fn(function() }, } end, 0) +-- Nvim-Tree keymaps + +vim.keymap.set('n', 't', ':NvimTreeToggle', { desc = 'Toggle File Tree' }) + +-- Terminal Keymaps +function OpenNewTerminalWithAdjustedHeight(height) + vim.cmd(':bo new') + vim.cmd(':term') + vim.cmd(':resize' .. height) + vim.cmd('wincmd w') +end + +vim.keymap.set('n', 'f', ':NvimTreeFocus', { desc = 'Focus on NvimTree' }) +vim.keymap.set('n', 'T', ':lua OpenNewTerminalWithAdjustedHeight(20)', { desc = 'Open new terminal' }) +vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) +vim.keymap.set('n', '|', ':vsplit new | terminal', { desc = 'Split Terminal' }) +vim.keymap.set('t', '', '', { desc = 'terminate running command' }) +-- Moving Windows Keymaps +vim.keymap.set('n', '', 'h', { desc = 'Move to the window to the left' }) +vim.keymap.set('n', '', 'l', { desc = 'Move to the window to the right' }) +vim.keymap.set('n', '', 'k', { desc = 'Move to the window above' }) +vim.keymap.set('n', '', 'j', { desc = 'Move to the window below' }) +vim.keymap.set('n', 'n', ':tabnext', { desc = 'Move to the next tab' }) +vim.keymap.set('n', 'p', ':tabprevious', { desc = ' Move to the previous tab' }) +-- Diagnostic keymaps +vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' }) +vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' }) +vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' }) +vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' }) -- [[ Configure LSP ]] -- This function gets run when an LSP connects to a particular buffer. @@ -564,11 +597,11 @@ require('mason-lspconfig').setup() -- define the property 'filetypes' to the map in question. local servers = { -- clangd = {}, - -- gopls = {}, - -- pyright = {}, + gopls = {}, + pyright = {}, -- rust_analyzer = {}, - -- tsserver = {}, - -- html = { filetypes = { 'html', 'twig', 'hbs'} }, + tsserver = {}, + html = { filetypes = { 'html', 'twig', 'hbs' } }, lua_ls = { Lua = { diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 00000000..9e5ad747 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,37 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, + "LuaSnip": { "branch": "master", "commit": "1def35377854535bb3b0f4cc7a33c083cdb12571" }, + "auto-save.nvim": { "branch": "main", "commit": "979b6c82f60cfa80f4cf437d77446d0ded0addf0" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, + "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, + "fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" }, + "friendly-snippets": { "branch": "main", "commit": "53d3df271d031c405255e99410628c26a8f0d2b0" }, + "gitsigns.nvim": { "branch": "main", "commit": "6ef8c54fb526bf3a0bc4efb0b2fe8e6d9a7daed2" }, + "indent-blankline.nvim": { "branch": "master", "commit": "29be0919b91fb59eca9e90690d76014233392bef" }, + "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, + "lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "41674c9d50f23cfa3e11f0ca964eb9100c2a8922" }, + "mason-nvim-dap.nvim": { "branch": "main", "commit": "5b4db7c0d6873436b42bcda0ba7cd4efa9206745" }, + "mason.nvim": { "branch": "main", "commit": "41e75af1f578e55ba050c863587cffde3556ffa6" }, + "neodev.nvim": { "branch": "main", "commit": "eab4a55c43e0dec631acec992e52490b3f1b5a17" }, + "nvim-autopairs": { "branch": "master", "commit": "0f04d78619cce9a5af4f355968040f7d675854a1" }, + "nvim-cmp": { "branch": "main", "commit": "0b751f6beef40fd47375eaf53d3057e0bfa317e4" }, + "nvim-dap": { "branch": "master", "commit": "13ce59d4852be2bb3cd4967947985cb0ceaff460" }, + "nvim-dap-go": { "branch": "main", "commit": "a5cc8dcad43f0732585d4793deb02a25c4afb766" }, + "nvim-dap-ui": { "branch": "master", "commit": "34160a7ce6072ef332f350ae1d4a6a501daf0159" }, + "nvim-lspconfig": { "branch": "master", "commit": "39546f730bdff8eccf7cec344cfce694f19ac908" }, + "nvim-tree.lua": { "branch": "master", "commit": "05f55c1fd6470b31627655c528245794e3cd4b2c" }, + "nvim-treesitter": { "branch": "master", "commit": "8f16c39f5b439bd9540336c4d5da705d180e34b9" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "dbcd9388e3b119a87c785e10a00d62876077d23d" }, + "nvim-web-devicons": { "branch": "master", "commit": "5efb8bd06841f91f97c90e16de85e96d57e9c862" }, + "onedark.nvim": { "branch": "master", "commit": "e7c656ac6b6460aaab817cbd0c9d5c043eda4b43" }, + "plenary.nvim": { "branch": "master", "commit": "366b0837486f60ae0e7550c15de8ff66d057c4cd" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }, + "vim-fugitive": { "branch": "master", "commit": "46eaf8918b347906789df296143117774e827616" }, + "vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" }, + "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, + "vim-tmux-navigator": { "branch": "master", "commit": "7db70e08ea03b3e4d91f63713d76134512e28d7e" }, + "vim-wakatime": { "branch": "master", "commit": "87c6861ea81700ec4a6a27c81413cf07cb2c883c" }, + "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" } +} \ No newline at end of file diff --git a/lua/custom/plugins/autopairs.lua b/lua/custom/plugins/autopairs.lua new file mode 100644 index 00000000..d271227f --- /dev/null +++ b/lua/custom/plugins/autopairs.lua @@ -0,0 +1,15 @@ +return { + "windwp/nvim-autopairs", + -- Optional dependency + dependencies = { 'hrsh7th/nvim-cmp' }, + config = function() + require("nvim-autopairs").setup {} + -- If you want to automatically add `(` after selecting a function or method + local cmp_autopairs = require('nvim-autopairs.completion.cmp') + local cmp = require('cmp') + cmp.event:on( + 'confirm_done', + cmp_autopairs.on_confirm_done() + ) + end, +} diff --git a/lua/custom/plugins/autosave.lua b/lua/custom/plugins/autosave.lua new file mode 100644 index 00000000..8d93e061 --- /dev/null +++ b/lua/custom/plugins/autosave.lua @@ -0,0 +1,37 @@ +return { + 'pocco81/auto-save.nvim', + opts = { + enabled = true, -- start auto-save when the plugin is loaded (i.e. when your package manager loads it) + execution_message = { + message = function() -- message to print on save + return ("AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S")) + end, + dim = 0.18, -- dim the color of `message` + cleaning_interval = 1250, -- (milliseconds) automatically clean MsgArea after displaying `message`. See :h MsgArea + }, + trigger_events = { "InsertLeave", "TextChanged" }, -- vim events that trigger auto-save. See :h events + -- function that determines whether to save the current buffer or not + -- return true: if buffer is ok to be saved + -- return false: if it's not ok to be saved + condition = function(buf) + local fn = vim.fn + local utils = require("auto-save.utils.data") + + if + fn.getbufvar(buf, "&modifiable") == 1 and + utils.not_in(fn.getbufvar(buf, "&filetype"), {}) then + return true -- met condition(s), can save + end + return false -- can't save + end, + write_all_buffers = false, -- write all buffers when the current one meets `condition` + debounce_delay = 135, -- saves the file at most every `debounce_delay` milliseconds + callbacks = { -- functions to be executed at different intervals + enabling = nil, -- ran when enabling auto-save + disabling = nil, -- ran when disabling auto-save + before_asserting_save = nil, -- ran before checking `condition` + before_saving = nil, -- ran before doing the actual save + after_saving = nil -- ran after doing the actual save + } + } +} diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index be0eb9d8..97aeaddb 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -1,5 +1,2 @@ --- You can add your own plugins here or in other files in this directory! --- I promise not to create any merge conflicts in this directory :) --- --- See the kickstart.nvim README for more information -return {} +return { +} diff --git a/lua/custom/plugins/nvim-tree.lua b/lua/custom/plugins/nvim-tree.lua new file mode 100644 index 00000000..42af72cc --- /dev/null +++ b/lua/custom/plugins/nvim-tree.lua @@ -0,0 +1,13 @@ +return { + "nvim-tree/nvim-tree.lua", + version = "*", + lazy = false, + dependencies = { + "nvim-tree/nvim-web-devicons", + }, + + config = function() + require("nvim-tree").setup { + } + end, +} diff --git a/lua/custom/plugins/vim-tmux-navigator.lua b/lua/custom/plugins/vim-tmux-navigator.lua new file mode 100644 index 00000000..cae77de0 --- /dev/null +++ b/lua/custom/plugins/vim-tmux-navigator.lua @@ -0,0 +1,3 @@ +return { + 'christoomey/vim-tmux-navigator' +} diff --git a/lua/custom/plugins/wakatime.lua b/lua/custom/plugins/wakatime.lua new file mode 100644 index 00000000..3f428bfe --- /dev/null +++ b/lua/custom/plugins/wakatime.lua @@ -0,0 +1,3 @@ +return { + 'wakatime/vim-wakatime', +}