diff --git a/lua/dan/core.lua b/lua/dan/core.lua index 04bcc20..fb40f17 100644 --- a/lua/dan/core.lua +++ b/lua/dan/core.lua @@ -1,12 +1,47 @@ +-- Print variables function +P = function(v) + print(vim.inspect(v)) + return v +end + +-- Custom keymaps vim.g.mapleader = " " -vim.keymap.set("n", "pv", vim.cmd.Ex) vim.keymap.set("n", "gg", vim.cmd.LazyGit) -vim.keymap.set("n", "nt", function() - vim.cmd("tabnew") -end) vim.keymap.set("n", "mv", function() vim.cmd("Markview splitToggle") end) +vim.keymap.set('n', 'r', function() + vim.cmd("w") + vim.cmd("source %") +end) +vim.keymap.set("n", "-", "Oil") +vim.keymap.set("n", "w", "w") +vim.keymap.set("n", "nh", "noh") +vim.keymap.set("n", "wq", "wq!") +vim.keymap.set("n", "fh", "Telescope help_tags") + +-- Terminal in neovim -- +vim.api.nvim_create_autocmd('TermOpen', { + group = vim.api.nvim_create_augroup('open-terminal', { clear = true }), + callback = function() + vim.opt.number = false + vim.opt.relativenumber = false + end, +}) +local job_id = 0 +vim.keymap.set("n", "tt", function() + vim.cmd.vnew() + vim.cmd.term() + vim.cmd.wincmd("J") + vim.api.nvim_win_set_height(0, 15) + job_id = vim.bo.channel +end) + +vim.keymap.set("n", "build", function() + vim.fn.chansend(job_id, { "ls -lah" }) +end) + +-- General config vim.cmd("set expandtab") vim.cmd("set tabstop=2") vim.cmd("set softtabstop=2") @@ -18,8 +53,11 @@ vim.cmd("set relativenumber") vim.cmd("set rnu") vim.cmd("set number relativenumber") vim.cmd("set nu rnu") +-- vim.cmd("set guicursor=n-v-c-i:block") -- vim.cmd("set guicursor=a:blinkon100") vim.api.nvim_set_option("clipboard","unnamed") + +-- Command to turn off diagnostics, if crowding screen vim.api.nvim_create_user_command("DiagnosticsToggle", function() local config = vim.diagnostic.config local vt = config().virtual_text @@ -29,3 +67,4 @@ vim.api.nvim_create_user_command("DiagnosticsToggle", function() signs = not vt, } end, { desc = "toggle diagnostic" }) +vim.keymap.set("n", "dt", "DiagnosticsToggle") diff --git a/lua/plugins.lua b/lua/plugins.lua index 97aeadd..75b571c 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -1,2 +1,3 @@ return { + -- Call local plugins here. } diff --git a/lua/plugins/ahoy.lua b/lua/plugins/ahoy.lua new file mode 100644 index 0000000..bc2e810 --- /dev/null +++ b/lua/plugins/ahoy.lua @@ -0,0 +1,9 @@ +return { + -- dir = "/Users/danchadwick/Projects/neovim/ahoy.nvim", + "calcu1on/ahoy.nvim", + config = function() + local ahoy = require('ahoy') + vim.keymap.set('n', 'sf', function() ahoy.save_file() end) + end +} + diff --git a/lua/plugins/alpha.lua b/lua/plugins/alpha.lua deleted file mode 100644 index 148d4fc..0000000 --- a/lua/plugins/alpha.lua +++ /dev/null @@ -1,76 +0,0 @@ -return { - "goolord/alpha-nvim", - event = "VimEnter", -- load plugin after all configuration is set - dependencies = { - "nvim-tree/nvim-web-devicons", - }, - - config = function() - local alpha = require("alpha") - local dashboard = require("alpha.themes.dashboard") - - dashboard.section.header.val = { - [[ ]], - [[ ]], - [[ ]], - [[ ]], - [[ ]], - [[ ]], - [[ ]], - [[  ]], - [[ ████ ██████ █████ ██ ]], - [[ ███████████ █████  ]], - [[ █████████ ███████████████████ ███ ███████████ ]], - [[ █████████ ███ █████████████ █████ ██████████████ ]], - [[ █████████ ██████████ █████████ █████ █████ ████ █████ ]], - [[ ███████████ ███ ███ █████████ █████ █████ ████ █████ ]], - [[ ██████ █████████████████████ ████ █████ █████ ████ ██████ ]], - [[ ]], - [[ ]], - [[ ]], - } - - _Gopts = { - position = "center", - hl = "Type", - -- wrap = "overflow"; - } - - -- Set menu - dashboard.section.buttons.val = { - -- dashboard.button("SPC j", "󰈚 Restore Session", ":SessionRestore"), - dashboard.button("e", " New file", ":ene startinsert "), - dashboard.button("f", " Find file", ":cd $HOME/dotfiles/.config | Telescope find_files"), - dashboard.button("g", "󰱼 Find word", ":Telescope live_grep"), - dashboard.button("r", " Recent", ":Telescope oldfiles"), - dashboard.button("c", " Config", ":e $MYVIMRC "), - dashboard.button("m", "󱌣 Mason", ":Mason"), - dashboard.button("l", "󰒲 Lazy", ":Lazy"), - dashboard.button("u", "󰂖 Update plugins", "lua require('lazy').sync()"), - dashboard.button("q", " Quit NVIM", ":qa"), - } - - --local function footer() - --return "Mohammed Babiker Babai" - --end - - --dashboard.section.footer.val = footer() - - dashboard.opts.opts.noautocmd = true - alpha.setup(dashboard.opts) - - require("alpha").setup(dashboard.opts) - - vim.api.nvim_create_autocmd("User", { - pattern = "LazyVimStarted", - callback = function() - local stats = require("lazy").stats() - local count = (math.floor(stats.startuptime * 100) / 100) - dashboard.section.footer.val = { - "󱐌 " .. stats.count .. " plugins loaded in " .. count .. " ms" - } - pcall(vim.cmd.AlphaRedraw) - end, - }) - end, -} diff --git a/lua/plugins/calendar.lua b/lua/plugins/calendar.lua deleted file mode 100644 index 22adbe7..0000000 --- a/lua/plugins/calendar.lua +++ /dev/null @@ -1,3 +0,0 @@ -return { - "renerocksai/calendar-vim" -} diff --git a/lua/plugins/harpoon.lua b/lua/plugins/harpoon.lua index edff4e0..a152346 100644 --- a/lua/plugins/harpoon.lua +++ b/lua/plugins/harpoon.lua @@ -26,11 +26,11 @@ return { sorter = conf.generic_sorter({}), }):find() end - vim.keymap.set("n", "", function() toggle_telescope(harpoon:list()) end, { desc = "Open harpoon window" }) + -- vim.keymap.set("n", "", function() toggle_telescope(harpoon:list()) end, { desc = "Open harpoon window" }) vim.keymap.set("n", "a", function() harpoon:list():add() end) vim.keymap.set("n", "c", function() harpoon:list():clear() end) vim.keymap.set("n", "r", function() harpoon:list():remove() end) - -- vim.keymap.set("n", "", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end) + vim.keymap.set("n", "h", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end) -- Toggle previous & next buffers stored within Harpoon list -- vim.keymap.set("n", "", function() harpoon:list():prev() end) -- vim.keymap.set("n", "", function() harpoon:list():next() end) diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua index 5095f55..9823da8 100644 --- a/lua/plugins/lualine.lua +++ b/lua/plugins/lualine.lua @@ -4,7 +4,7 @@ return { 'nvim-tree/nvim-web-devicons' }, config = function() - require('lualine'). setup({ + require('lualine').setup({ options= { theme = 'dracula' } diff --git a/lua/plugins/neotree.lua b/lua/plugins/neotree.lua index f03d78b..c648b41 100644 --- a/lua/plugins/neotree.lua +++ b/lua/plugins/neotree.lua @@ -8,6 +8,6 @@ return { }, config = function() vim.keymap.set("n", "", ':Neotree filesystem reveal left', {}) - vim.keymap.set("n", "", ':Neotree position=current', {}) + vim.keymap.set("n", "", ':Neotree filesystem reveal current', {}) end } diff --git a/lua/plugins/oil.lua b/lua/plugins/oil.lua new file mode 100644 index 0000000..47c4e5b --- /dev/null +++ b/lua/plugins/oil.lua @@ -0,0 +1,13 @@ +return { + { + 'stevearc/oil.nvim', + ---@module 'oil' + ---@type oil.SetupOpts + opts = {}, + -- Optional dependencies + dependencies = { { "echasnovski/mini.icons", opts = {} } }, + -- dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if you prefer nvim-web-devicons + -- Lazy loading is not recommended because it is very tricky to make it work correctly in all situations. + lazy = false, + } +} diff --git a/lua/plugins/strudel.lua b/lua/plugins/strudel.lua deleted file mode 100644 index 97aeadd..0000000 --- a/lua/plugins/strudel.lua +++ /dev/null @@ -1,2 +0,0 @@ -return { -}