Compare commits
5 Commits
dbabc8b550
...
5c6815a6f9
Author | SHA1 | Date |
---|---|---|
Buddy Sandidge | 5c6815a6f9 | 5 days ago |
Buddy Sandidge | 5e80781558 | 5 days ago |
Buddy Sandidge | cc13e44e9f | 6 days ago |
Buddy Sandidge | edc517757b | 6 days ago |
Buddy Sandidge | 233dba0dfe | 6 days ago |
@ -1,5 +1,6 @@
|
|||||||
require('core.config')
|
require("core.config")
|
||||||
vim.opt.runtimepath:prepend(vim.fn.stdpath('data') .. '/lazy/lazy.nvim')
|
require("core.keymaps")
|
||||||
require('lazy').setup('plugins', {
|
vim.opt.runtimepath:prepend(vim.fn.stdpath("data") .. "/lazy/lazy.nvim")
|
||||||
|
require("lazy").setup("plugins", {
|
||||||
version = "*",
|
version = "*",
|
||||||
})
|
})
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
vim.api.nvim_create_user_command("W", "write", {})
|
||||||
|
vim.api.nvim_create_user_command("Q", "qall!", {})
|
||||||
|
|
||||||
|
-- Create a floating terminal
|
||||||
|
vim.api.nvim_create_user_command("FloaTerm", require("core.lib.toggle_terminal"), {
|
||||||
|
desc = "Toggle a floating terminal",
|
||||||
|
})
|
||||||
|
|
||||||
|
-- highlight text on copy
|
||||||
|
vim.api.nvim_create_autocmd("TextYankPost", {
|
||||||
|
desc = "Highlight when yanking (copying) text",
|
||||||
|
callback = vim.highlight.on_yank,
|
||||||
|
group = vim.api.nvim_create_augroup("kickstart-highlight-yank", {
|
||||||
|
clear = true,
|
||||||
|
}),
|
||||||
|
})
|
@ -0,0 +1,23 @@
|
|||||||
|
require("core.commands")
|
||||||
|
local toggle_terminal = require("core.lib.toggle_terminal")
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>l", ":nohlsearch<CR>", { desc = "clear highlighted search" })
|
||||||
|
vim.keymap.set("n", "<leader>ts", [[:%s/\s\s*$//g<CR>]], { desc = "[T]rim trailing [S]pace" })
|
||||||
|
vim.keymap.set("n", "<leader>ss", ":setlocal spell!<CR>", { desc = "[S]et [S]pell" })
|
||||||
|
vim.keymap.set("n", "<leader>p", ":set paste!<CR>", { desc = "[P]aste" })
|
||||||
|
vim.keymap.set("n", "<leader>nn", ":set nonumber norelativenumber<CR>", { desc = "[N]o [N]umber removed number and relative number" })
|
||||||
|
vim.keymap.set("n", "<leader>rn", ":set number relativenumber<CR>", { desc = "[R]elative [N]umber - set relative number and absolute number" })
|
||||||
|
|
||||||
|
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, { desc = "Go to previous [D]iagnostic message" })
|
||||||
|
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, { desc = "Go to next [D]iagnostic message" })
|
||||||
|
vim.keymap.set("n", "<leader>e", vim.diagnostic.open_float, { desc = "Show diagnostic [E]rror messages" })
|
||||||
|
vim.keymap.set("n", "<leader>q", vim.diagnostic.setloclist, { desc = "Open diagnopstic [Q]uickfix list" })
|
||||||
|
|
||||||
|
-- Use <Ctrl-h/j/k/l> to move between windows, no need for <Ctrl-w> first
|
||||||
|
vim.keymap.set("n", "<C-j>", "<C-w><C-j>", { desc = "Move focus up window" })
|
||||||
|
vim.keymap.set("n", "<C-k>", "<C-w><C-k>", { desc = "Move focus down window" })
|
||||||
|
vim.keymap.set("n", "<C-h>", "<C-w><C-h>", { desc = "Move focus left window" })
|
||||||
|
vim.keymap.set("n", "<C-l>", "<C-w><C-l>", { desc = "Move focus right window" })
|
||||||
|
|
||||||
|
vim.keymap.set({ "n", "t" }, "<leader>tt", toggle_terminal)
|
||||||
|
vim.keymap.set("t", "<esc><esc>", "<c-\\><c-n>")
|
@ -0,0 +1,25 @@
|
|||||||
|
-- Telescope live_grep in git root
|
||||||
|
-- Function to find the git root directory based on the current buffer's path
|
||||||
|
local function find_git_root()
|
||||||
|
-- Use the current buffer's path as the starting point for the git search
|
||||||
|
local current_file = vim.api.nvim_buf_get_name(0)
|
||||||
|
local current_dir
|
||||||
|
local cwd = vim.fn.getcwd()
|
||||||
|
-- If the buffer is not associated with a file, return nil
|
||||||
|
if current_file == '' then
|
||||||
|
current_dir = cwd
|
||||||
|
else
|
||||||
|
-- Extract the directory from the current file's path
|
||||||
|
current_dir = vim.fn.fnamemodify(current_file, ':h')
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Find the Git root directory from the current file's path
|
||||||
|
local git_root = vim.fn.systemlist('git -C ' .. vim.fn.escape(current_dir, ' ') .. ' rev-parse --show-toplevel')[1]
|
||||||
|
if vim.v.shell_error ~= 0 then
|
||||||
|
print('Not a git repository. Searching on current working directory')
|
||||||
|
return cwd
|
||||||
|
end
|
||||||
|
return git_root
|
||||||
|
end
|
||||||
|
|
||||||
|
return find_git_root
|
@ -0,0 +1,45 @@
|
|||||||
|
local state = {
|
||||||
|
floating = {
|
||||||
|
buf = -1,
|
||||||
|
win = -1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
local function create_floating_window(ops)
|
||||||
|
ops = ops or {}
|
||||||
|
local width = ops.width or math.floor(vim.o.columns * 0.8)
|
||||||
|
local height = ops.height or math.floor(vim.o.lines * 0.8)
|
||||||
|
|
||||||
|
local buf
|
||||||
|
if vim.api.nvim_buf_is_valid(state.floating.buf) then
|
||||||
|
buf = state.floating.buf
|
||||||
|
vim.cmd("startinsert")
|
||||||
|
else
|
||||||
|
buf = vim.api.nvim_create_buf(false, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
local win = vim.api.nvim_open_win(buf, true, {
|
||||||
|
relative = "editor",
|
||||||
|
style = "minimal",
|
||||||
|
border = "rounded",
|
||||||
|
width = width,
|
||||||
|
height = height,
|
||||||
|
col = math.floor((vim.o.columns - width) / 2),
|
||||||
|
row = math.floor((vim.o.lines - height) / 2),
|
||||||
|
})
|
||||||
|
return { buf = buf, win = win }
|
||||||
|
end
|
||||||
|
|
||||||
|
local function toggle_terminal()
|
||||||
|
if vim.api.nvim_win_is_valid(state.floating.win) then
|
||||||
|
vim.api.nvim_win_hide(state.floating.win)
|
||||||
|
else
|
||||||
|
state.floating = create_floating_window { buf = state.floating.buf }
|
||||||
|
if vim.bo[state.floating.buf].buftype ~= "terminal" then
|
||||||
|
vim.cmd.terminal()
|
||||||
|
vim.cmd("startinsert")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return toggle_terminal
|
@ -1,8 +1,17 @@
|
|||||||
return {
|
-- https://github.com/tpope/vim-surround
|
||||||
'tpope/vim-surround',
|
-- surround.vim: Delete/change/add parentheses/quotes/XML-tags/much more with ease
|
||||||
tag = 'v2.2',
|
local M = { "tpope/vim-surround" }
|
||||||
dependencies = {
|
|
||||||
{ 'tpope/vim-sleuth', tag = 'v2.0' },
|
M.tag = "v2.2"
|
||||||
{ 'numToStr/Comment.nvim', opts = {}, lazy = false },
|
M.dependencies = {
|
||||||
},
|
-- https://github.com/tpope/vim-sleuth
|
||||||
|
-- sleuth.vim: Heuristically set buffer options
|
||||||
|
{ "tpope/vim-sleuth", tag = "v2.0" },
|
||||||
|
|
||||||
|
-- https://github.com/numToStr/Comment.nvim
|
||||||
|
-- 🧠 💪 // Smart and powerful comment plugin for neovim.
|
||||||
|
-- Supports treesitter, dot repeat, left-right/up-down motions, hooks, and more
|
||||||
|
{ "numToStr/Comment.nvim", opts = {}, lazy = false },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return M
|
||||||
|
@ -1,16 +1,20 @@
|
|||||||
local function config()
|
-- https://github.com/ray-x/go.nvim
|
||||||
|
-- A modern go neovim plugin based on treesitter, nvim-lsp and dap debugger.
|
||||||
|
local M = { "ray-x/go.nvim" }
|
||||||
|
|
||||||
|
M.name = "go"
|
||||||
|
M.event = { "CmdlineEnter" }
|
||||||
|
M.ft = { "go", "gomod" }
|
||||||
|
M.dependencies = {
|
||||||
|
-- https://github.com/ray-x/guihua.lua
|
||||||
|
-- Guihua: A Lua Gui and util library for nvim plugins
|
||||||
|
"ray-x/guihua.lua",
|
||||||
|
"lspconfig",
|
||||||
|
"treesitter",
|
||||||
|
}
|
||||||
|
|
||||||
|
function M.config()
|
||||||
require("go").setup()
|
require("go").setup()
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return M
|
||||||
'ray-x/go.nvim',
|
|
||||||
name = 'go',
|
|
||||||
config = config,
|
|
||||||
event = { 'CmdlineEnter' },
|
|
||||||
ft = { 'go', 'gomod' },
|
|
||||||
dependencies = {
|
|
||||||
'ray-x/guihua.lua',
|
|
||||||
'lspconfig',
|
|
||||||
'treesitter',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
local function config()
|
-- https://github.com/L3MON4D3/LuaSnip
|
||||||
local luasnip = require 'luasnip'
|
-- Snippet Engine for Neovim written in Lua.
|
||||||
|
local M = { "L3MON4D3/LuaSnip" }
|
||||||
|
|
||||||
|
M.tag = "v2.3.0"
|
||||||
|
M.dependencies = {}
|
||||||
|
|
||||||
|
function M.config()
|
||||||
|
local luasnip = require "luasnip"
|
||||||
luasnip.setup()
|
luasnip.setup()
|
||||||
luasnip.config.setup({})
|
luasnip.config.setup({})
|
||||||
require("luasnip.loaders.from_snipmate").lazy_load()
|
require("luasnip.loaders.from_snipmate").lazy_load()
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return M
|
||||||
'L3MON4D3/LuaSnip',
|
|
||||||
config = config,
|
|
||||||
tag = 'v2.3.0',
|
|
||||||
dependencies = {},
|
|
||||||
}
|
|
||||||
|
@ -1,25 +1,27 @@
|
|||||||
local function config()
|
-- https://github.com/morhetz/gruvbox
|
||||||
vim.cmd.colorscheme 'gruvbox'
|
local M = { "morhetz/gruvbox" }
|
||||||
end
|
|
||||||
|
|
||||||
return {
|
M.priority = 1000
|
||||||
'morhetz/gruvbox',
|
M.dependencies = {
|
||||||
priority = 1000,
|
-- https://github.com/nvim-lualine/lualine.nvim
|
||||||
config = config,
|
"nvim-lualine/lualine.nvim",
|
||||||
dependencies = {
|
|
||||||
'nvim-lualine/lualine.nvim',
|
|
||||||
opts = {
|
opts = {
|
||||||
options = {
|
options = {
|
||||||
theme = 'gruvbox',
|
theme = "gruvbox",
|
||||||
},
|
},
|
||||||
sections = {
|
sections = {
|
||||||
lualine_a = { 'mode' },
|
lualine_a = { "mode" },
|
||||||
lualine_b = { 'diagnostics' },
|
lualine_b = { "diagnostics" },
|
||||||
lualine_c = { { 'filename', path = 3 } },
|
lualine_c = { { "filename", path = 3 } },
|
||||||
lualine_x = { 'encoding', 'fileformat', 'filetype' },
|
lualine_x = { "encoding", "fileformat", "filetype" },
|
||||||
lualine_y = { 'progress' },
|
lualine_y = { "progress" },
|
||||||
lualine_z = { 'location' }
|
lualine_z = { "location" }
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function M.config()
|
||||||
|
vim.cmd.colorscheme("gruvbox")
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
Loading…
Reference in New Issue