Working config with a few files split up
This commit is contained in:
parent
649cf7b71e
commit
cbc601ca55
387
init.lua
387
init.lua
|
@ -57,191 +57,12 @@ if not vim.loop.fs_stat(lazypath) then
|
||||||
end
|
end
|
||||||
vim.opt.rtp:prepend(lazypath)
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
-- NOTE: Here is where you install your plugins.
|
require('custom.plugins')
|
||||||
-- You can configure plugins using the `config` key.
|
require('custom.key_maps')
|
||||||
--
|
require('custom.autocmd')
|
||||||
-- You can also configure plugins after the setup call,
|
require('custom.leader_shortcuts')
|
||||||
-- as they will be available in your neovim runtime.
|
require('custom.treesitter')
|
||||||
require('lazy').setup({
|
require('custom.which_key')
|
||||||
-- NOTE: First, some plugins that don't require any configuration
|
|
||||||
|
|
||||||
-- Git related plugins
|
|
||||||
'tpope/vim-fugitive',
|
|
||||||
'tpope/vim-rhubarb',
|
|
||||||
|
|
||||||
-- Detect tabstop and shiftwidth automatically
|
|
||||||
'tpope/vim-sleuth',
|
|
||||||
|
|
||||||
-- NOTE: This is where your plugins related to LSP can be installed.
|
|
||||||
-- The configuration is done below. Search for lspconfig to find it below.
|
|
||||||
{
|
|
||||||
-- LSP Configuration & Plugins
|
|
||||||
'neovim/nvim-lspconfig',
|
|
||||||
dependencies = {
|
|
||||||
-- Automatically install LSPs to stdpath for neovim
|
|
||||||
{ 'williamboman/mason.nvim', config = true },
|
|
||||||
'williamboman/mason-lspconfig.nvim',
|
|
||||||
|
|
||||||
-- Useful status updates for LSP
|
|
||||||
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
|
||||||
{ 'j-hui/fidget.nvim', opts = {} },
|
|
||||||
|
|
||||||
-- Additional lua configuration, makes nvim stuff amazing!
|
|
||||||
'folke/neodev.nvim',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
-- Autocompletion
|
|
||||||
'hrsh7th/nvim-cmp',
|
|
||||||
dependencies = {
|
|
||||||
-- Snippet Engine & its associated nvim-cmp source
|
|
||||||
'L3MON4D3/LuaSnip',
|
|
||||||
'saadparwaiz1/cmp_luasnip',
|
|
||||||
|
|
||||||
-- Adds LSP completion capabilities
|
|
||||||
'hrsh7th/cmp-nvim-lsp',
|
|
||||||
'hrsh7th/cmp-path',
|
|
||||||
|
|
||||||
-- Adds a number of user-friendly snippets
|
|
||||||
'rafamadriz/friendly-snippets',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Useful plugin to show you pending keybinds.
|
|
||||||
{ 'folke/which-key.nvim', opts = {} },
|
|
||||||
{
|
|
||||||
-- Adds git releated signs to the gutter, as well as utilities for managing changes
|
|
||||||
'lewis6991/gitsigns.nvim',
|
|
||||||
opts = {
|
|
||||||
-- See `:help gitsigns.txt`
|
|
||||||
signs = {
|
|
||||||
add = { text = '+' },
|
|
||||||
change = { text = '~' },
|
|
||||||
delete = { text = '_' },
|
|
||||||
topdelete = { text = '‾' },
|
|
||||||
changedelete = { text = '~' },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
-- Theme inspired by Atom
|
|
||||||
'navarasu/onedark.nvim',
|
|
||||||
priority = 1000,
|
|
||||||
config = function()
|
|
||||||
vim.cmd.colorscheme 'onedark'
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
-- Set lualine as statusline
|
|
||||||
'nvim-lualine/lualine.nvim',
|
|
||||||
-- See `:help lualine.txt`
|
|
||||||
opts = {
|
|
||||||
options = {
|
|
||||||
icons_enabled = false,
|
|
||||||
theme = 'onedark',
|
|
||||||
component_separators = '|',
|
|
||||||
section_separators = '',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
{ "lukas-reineke/indent-blankline.nvim", main = "ibl", opts = {} },
|
|
||||||
-- "gc" to comment visual regions/lines
|
|
||||||
{ 'numToStr/Comment.nvim', opts = {} },
|
|
||||||
|
|
||||||
-- Fuzzy Finder (files, lsp, etc)
|
|
||||||
{ 'nvim-telescope/telescope.nvim', version = '*', dependencies = { 'nvim-lua/plenary.nvim' } },
|
|
||||||
|
|
||||||
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
|
|
||||||
-- Only load if `make` is available. Make sure you have the system
|
|
||||||
-- requirements installed.
|
|
||||||
{
|
|
||||||
'nvim-telescope/telescope-fzf-native.nvim',
|
|
||||||
-- NOTE: If you are having trouble with this installation,
|
|
||||||
-- refer to the README for telescope-fzf-native for more instructions.
|
|
||||||
build = 'make',
|
|
||||||
cond = function()
|
|
||||||
return vim.fn.executable 'make' == 1
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
-- Highlight, edit, and navigate code
|
|
||||||
'nvim-treesitter/nvim-treesitter',
|
|
||||||
dependencies = {
|
|
||||||
'nvim-treesitter/nvim-treesitter-textobjects',
|
|
||||||
},
|
|
||||||
build = ":TSUpdate",
|
|
||||||
},
|
|
||||||
|
|
||||||
-- 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',
|
|
||||||
|
|
||||||
-- NOTE: The import below automatically adds 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
|
|
||||||
-- up-to-date with whatever is in the kickstart repo.
|
|
||||||
--
|
|
||||||
-- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins
|
|
||||||
--
|
|
||||||
-- An additional note is that if you only copied in the `init.lua`, you can just comment this line
|
|
||||||
-- to get rid of the warning telling you that there are not plugins in `lua/custom/plugins/`.
|
|
||||||
{ 'towolf/vim-helm' },
|
|
||||||
{ 'nvim-tree/nvim-tree.lua' },
|
|
||||||
{ 'nvim-tree/nvim-web-devicons' },
|
|
||||||
|
|
||||||
{ 'neovim/nvim-lspconfig' },
|
|
||||||
{ 'jose-elias-alvarez/null-ls.nvim' },
|
|
||||||
{ 'MunifTanjim/prettier.nvim' },
|
|
||||||
{ 'f-person/git-blame.nvim' },
|
|
||||||
{
|
|
||||||
'ldelossa/gh.nvim',
|
|
||||||
dependencies = {
|
|
||||||
'ldelossa/litee.nvim' }
|
|
||||||
},
|
|
||||||
{ 'tpope/vim-abolish' },
|
|
||||||
{
|
|
||||||
"kdheepak/lazygit.nvim",
|
|
||||||
-- optional for floating window border decoration
|
|
||||||
dependencies = {
|
|
||||||
"nvim-lua/plenary.nvim",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ "almo7aya/openingh.nvim" },
|
|
||||||
{
|
|
||||||
"epwalsh/obsidian.nvim",
|
|
||||||
version = "*", -- recommended, use latest release instead of latest commit
|
|
||||||
ft = "markdown",
|
|
||||||
-- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault:
|
|
||||||
-- event = {
|
|
||||||
-- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'.
|
|
||||||
-- -- E.g. "BufReadPre " .. vim.fn.expand "~" .. "/my-vault/**.md"
|
|
||||||
-- "BufReadPre path/to/my-vault/**.md",
|
|
||||||
-- "BufNewFile path/to/my-vault/**.md",
|
|
||||||
-- },
|
|
||||||
dependencies = {
|
|
||||||
-- Required.
|
|
||||||
"nvim-lua/plenary.nvim",
|
|
||||||
|
|
||||||
-- see below for full list of optional dependencies 👇
|
|
||||||
},
|
|
||||||
opts = {
|
|
||||||
workspaces = {
|
|
||||||
{
|
|
||||||
name = "personal",
|
|
||||||
path = "~/Documents/Projects/notes",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
{ import = 'custom.plugins' },
|
|
||||||
}, {})
|
|
||||||
|
|
||||||
-- [[ Setting options ]]
|
-- [[ Setting options ]]
|
||||||
-- See `:help vim.o`
|
-- See `:help vim.o`
|
||||||
|
@ -284,16 +105,6 @@ vim.o.completeopt = 'menuone,noselect'
|
||||||
-- NOTE: You should make sure your terminal supports this
|
-- NOTE: You should make sure your terminal supports this
|
||||||
vim.o.termguicolors = true
|
vim.o.termguicolors = true
|
||||||
|
|
||||||
-- [[ Basic Keymaps ]]
|
|
||||||
|
|
||||||
-- Keymaps for better default experience
|
|
||||||
-- See `:help vim.keymap.set()`
|
|
||||||
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
|
|
||||||
|
|
||||||
-- 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 })
|
|
||||||
|
|
||||||
--- Autocommands
|
--- Autocommands
|
||||||
|
|
||||||
-- [[ Highlight on yank ]]
|
-- [[ Highlight on yank ]]
|
||||||
|
@ -325,111 +136,13 @@ pcall(require('telescope').load_extension, 'fzf')
|
||||||
require("telescope").setup {
|
require("telescope").setup {
|
||||||
pickers = {
|
pickers = {
|
||||||
live_grep = {
|
live_grep = {
|
||||||
additional_args = function(opts)
|
additional_args = function(_)
|
||||||
return { "--hidden" }
|
return { "--hidden" }
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- See `:help telescope.builtin`
|
|
||||||
vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' })
|
|
||||||
vim.keymap.set('n', '<leader><space>', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' })
|
|
||||||
vim.keymap.set('n', '<leader>/', function()
|
|
||||||
-- You can pass additional configuration to telescope to change theme, layout, etc.
|
|
||||||
require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
|
||||||
winblend = 10,
|
|
||||||
previewer = false,
|
|
||||||
})
|
|
||||||
end, { desc = '[/] Fuzzily search in current buffer' })
|
|
||||||
|
|
||||||
vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
|
|
||||||
vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' })
|
|
||||||
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
|
|
||||||
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
|
|
||||||
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
|
|
||||||
|
|
||||||
-- [[ Configure NvimTree ]]
|
|
||||||
require("nvim-tree").setup()
|
|
||||||
vim.keymap.set('n', '<leader>e', ":NvimTreeToggle<cr>", { desc = 'Toggle NvimTree' })
|
|
||||||
vim.keymap.set('n', '<leader>ef', ':NvimTreeFindFile<cr>', { desc = 'Find file' })
|
|
||||||
vim.keymap.set('n', '<C-h>', '<C-n><left>')
|
|
||||||
vim.keymap.set('n', '<C-j>', '<C-n><up>')
|
|
||||||
vim.keymap.set('n', '<C-k>', '<C-n><down>')
|
|
||||||
vim.keymap.set('n', '<C-l>', '<C-n><right>')
|
|
||||||
|
|
||||||
-- [[ Configure Treesitter ]]
|
|
||||||
-- See `:help nvim-treesitter`
|
|
||||||
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', 'typescript', 'vimdoc', 'vim', 'terraform' },
|
|
||||||
|
|
||||||
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
|
|
||||||
auto_install = false,
|
|
||||||
|
|
||||||
highlight = { enable = true },
|
|
||||||
indent = { enable = true, disable = { 'python' } },
|
|
||||||
incremental_selection = {
|
|
||||||
enable = true,
|
|
||||||
keymaps = {
|
|
||||||
init_selection = '<c-space>',
|
|
||||||
node_incremental = '<c-space>',
|
|
||||||
scope_incremental = '<c-s>',
|
|
||||||
node_decremental = '<M-space>',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
textobjects = {
|
|
||||||
select = {
|
|
||||||
enable = true,
|
|
||||||
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
|
|
||||||
keymaps = {
|
|
||||||
-- You can use the capture groups defined in textobjects.scm
|
|
||||||
['aa'] = '@parameter.outer',
|
|
||||||
['ia'] = '@parameter.inner',
|
|
||||||
['af'] = '@function.outer',
|
|
||||||
['if'] = '@function.inner',
|
|
||||||
['ac'] = '@class.outer',
|
|
||||||
['ic'] = '@class.inner',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
move = {
|
|
||||||
enable = true,
|
|
||||||
set_jumps = true, -- whether to set jumps in the jumplist
|
|
||||||
goto_next_start = {
|
|
||||||
[']m'] = '@function.outer',
|
|
||||||
[']]'] = '@class.outer',
|
|
||||||
},
|
|
||||||
goto_next_end = {
|
|
||||||
[']M'] = '@function.outer',
|
|
||||||
[']['] = '@class.outer',
|
|
||||||
},
|
|
||||||
goto_previous_start = {
|
|
||||||
['[m'] = '@function.outer',
|
|
||||||
['[['] = '@class.outer',
|
|
||||||
},
|
|
||||||
goto_previousqend = {
|
|
||||||
['[M'] = '@function.outer',
|
|
||||||
['[]'] = '@class.outer',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
swap = {
|
|
||||||
enable = true,
|
|
||||||
swap_next = {
|
|
||||||
['<leader>a'] = '@parameter.inner',
|
|
||||||
},
|
|
||||||
swap_previous = {
|
|
||||||
['<leader>A'] = '@parameter.inner',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
-- 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', '<leader>e', vim.diagnostic.open_float, { desc = "Open floating diagnostic message" })
|
|
||||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = "Open diagnostics list" })
|
|
||||||
|
|
||||||
-- LSP settings.
|
-- LSP settings.
|
||||||
-- This function gets run when an LSP connects to a particular buffer.
|
-- This function gets run when an LSP connects to a particular buffer.
|
||||||
local on_attach = function(_, bufnr)
|
local on_attach = function(_, bufnr)
|
||||||
|
@ -532,40 +245,6 @@ vim.api.nvim_create_autocmd({ "BufWritePre" }, {
|
||||||
pattern = { "*.tf", "*.tfvars" },
|
pattern = { "*.tf", "*.tfvars" },
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Configure nullls
|
|
||||||
local null_ls = require("null-ls")
|
|
||||||
|
|
||||||
local group = vim.api.nvim_create_augroup("lsp_format_on_save", { clear = false })
|
|
||||||
local event = "BufWritePre" -- or "BufWritePost"
|
|
||||||
local async = event == "BufWritePost"
|
|
||||||
|
|
||||||
null_ls.setup({
|
|
||||||
on_attach = function(client, bufnr)
|
|
||||||
if client.supports_method("textDocument/formatting") then
|
|
||||||
vim.keymap.set("n", "<Leader>f", function()
|
|
||||||
vim.lsp.buf.format({ bufnr = vim.api.nvim_get_current_buf() })
|
|
||||||
end, { buffer = bufnr, desc = "[lsp] format" })
|
|
||||||
|
|
||||||
-- format on save
|
|
||||||
vim.api.nvim_clear_autocmds({ buffer = bufnr, group = group })
|
|
||||||
vim.api.nvim_create_autocmd(event, {
|
|
||||||
buffer = bufnr,
|
|
||||||
group = group,
|
|
||||||
callback = function()
|
|
||||||
vim.lsp.buf.format({ bufnr = bufnr, async = async })
|
|
||||||
end,
|
|
||||||
desc = "[lsp] format on save",
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
if client.supports_method("textDocument/rangeFormatting") then
|
|
||||||
vim.keymap.set("x", "<Leader>f", function()
|
|
||||||
vim.lsp.buf.format({ bufnr = vim.api.nvim_get_current_buf() })
|
|
||||||
end, { buffer = bufnr, desc = "[lsp] format" })
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Configure prettier
|
-- Configure prettier
|
||||||
local prettier = require("prettier")
|
local prettier = require("prettier")
|
||||||
|
|
||||||
|
@ -679,58 +358,6 @@ require('litee.gh').setup({
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
local wk = require("which-key")
|
|
||||||
wk.register({
|
|
||||||
g = {
|
|
||||||
name = "+Git",
|
|
||||||
h = {
|
|
||||||
name = "+Github",
|
|
||||||
c = {
|
|
||||||
name = "+Commits",
|
|
||||||
c = { "<cmd>GHCloseCommit<cr>", "Close" },
|
|
||||||
e = { "<cmd>GHExpandCommit<cr>", "Expand" },
|
|
||||||
o = { "<cmd>GHOpenToCommit<cr>", "Open To" },
|
|
||||||
p = { "<cmd>GHPopOutCommit<cr>", "Pop Out" },
|
|
||||||
z = { "<cmd>GHCollapseCommit<cr>", "Collapse" },
|
|
||||||
},
|
|
||||||
i = {
|
|
||||||
name = "+Issues",
|
|
||||||
p = { "<cmd>GHPreviewIssue<cr>", "Preview" },
|
|
||||||
},
|
|
||||||
l = {
|
|
||||||
name = "+Litee",
|
|
||||||
t = { "<cmd>LTPanel<cr>", "Toggle Panel" },
|
|
||||||
},
|
|
||||||
r = {
|
|
||||||
name = "+Review",
|
|
||||||
b = { "<cmd>GHStartReview<cr>", "Begin" },
|
|
||||||
c = { "<cmd>GHCloseReview<cr>", "Close" },
|
|
||||||
d = { "<cmd>GHDeleteReview<cr>", "Delete" },
|
|
||||||
e = { "<cmd>GHExpandReview<cr>", "Expand" },
|
|
||||||
s = { "<cmd>GHSubmitReview<cr>", "Submit" },
|
|
||||||
z = { "<cmd>GHCollapseReview<cr>", "Collapse" },
|
|
||||||
},
|
|
||||||
p = {
|
|
||||||
name = "+Pull Request",
|
|
||||||
c = { "<cmd>GHClosePR<cr>", "Close" },
|
|
||||||
d = { "<cmd>GHPRDetails<cr>", "Details" },
|
|
||||||
e = { "<cmd>GHExpandPR<cr>", "Expand" },
|
|
||||||
o = { "<cmd>GHOpenPR<cr>", "Open" },
|
|
||||||
p = { "<cmd>GHPopOutPR<cr>", "PopOut" },
|
|
||||||
r = { "<cmd>GHRefreshPR<cr>", "Refresh" },
|
|
||||||
t = { "<cmd>GHOpenToPR<cr>", "Open To" },
|
|
||||||
z = { "<cmd>GHCollapsePR<cr>", "Collapse" },
|
|
||||||
},
|
|
||||||
t = {
|
|
||||||
name = "+Threads",
|
|
||||||
c = { "<cmd>GHCreateThread<cr>", "Create" },
|
|
||||||
n = { "<cmd>GHNextThread<cr>", "Next" },
|
|
||||||
t = { "<cmd>GHToggleThread<cr>", "Toggle" },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}, { prefix = "<leader>" })
|
|
||||||
|
|
||||||
local configs = require('lspconfig.configs')
|
local configs = require('lspconfig.configs')
|
||||||
local lspconfig = require('lspconfig')
|
local lspconfig = require('lspconfig')
|
||||||
local util = require('lspconfig.util')
|
local util = require('lspconfig.util')
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
-- [[ Basic Keymaps ]]
|
||||||
|
|
||||||
|
-- Keymaps for better default experience
|
||||||
|
-- See `:help vim.keymap.set()`
|
||||||
|
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
|
||||||
|
|
||||||
|
-- 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 })
|
|
@ -0,0 +1,25 @@
|
||||||
|
-- See `:help telescope.builtin`
|
||||||
|
vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' })
|
||||||
|
vim.keymap.set('n', '<leader><space>', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' })
|
||||||
|
vim.keymap.set('n', '<leader>/', function()
|
||||||
|
-- You can pass additional configuration to telescope to change theme, layout, etc.
|
||||||
|
require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
||||||
|
winblend = 10,
|
||||||
|
previewer = false,
|
||||||
|
})
|
||||||
|
end, { desc = '[/] Fuzzily search in current buffer' })
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
|
||||||
|
vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' })
|
||||||
|
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
|
||||||
|
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
|
||||||
|
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
|
||||||
|
|
||||||
|
-- [[ Configure NvimTree ]]
|
||||||
|
require("nvim-tree").setup()
|
||||||
|
vim.keymap.set('n', '<leader>e', ":NvimTreeToggle<cr>", { desc = 'Toggle NvimTree' })
|
||||||
|
vim.keymap.set('n', '<leader>ef', ':NvimTreeFindFile<cr>', { desc = 'Find file' })
|
||||||
|
vim.keymap.set('n', '<C-h>', '<C-n><left>')
|
||||||
|
vim.keymap.set('n', '<C-j>', '<C-n><up>')
|
||||||
|
vim.keymap.set('n', '<C-k>', '<C-n><down>')
|
||||||
|
vim.keymap.set('n', '<C-l>', '<C-n><right>')
|
|
@ -0,0 +1,182 @@
|
||||||
|
-- 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({
|
||||||
|
-- NOTE: First, some plugins that don't require any configuration
|
||||||
|
|
||||||
|
-- Git related plugins
|
||||||
|
'tpope/vim-fugitive',
|
||||||
|
'tpope/vim-rhubarb',
|
||||||
|
|
||||||
|
-- Detect tabstop and shiftwidth automatically
|
||||||
|
'tpope/vim-sleuth',
|
||||||
|
|
||||||
|
-- NOTE: This is where your plugins related to LSP can be installed.
|
||||||
|
-- The configuration is done below. Search for lspconfig to find it below.
|
||||||
|
{
|
||||||
|
-- LSP Configuration & Plugins
|
||||||
|
'neovim/nvim-lspconfig',
|
||||||
|
dependencies = {
|
||||||
|
-- Automatically install LSPs to stdpath for neovim
|
||||||
|
{ 'williamboman/mason.nvim', config = true },
|
||||||
|
'williamboman/mason-lspconfig.nvim',
|
||||||
|
|
||||||
|
-- Useful status updates for LSP
|
||||||
|
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
||||||
|
{ 'j-hui/fidget.nvim', opts = {} },
|
||||||
|
|
||||||
|
-- Additional lua configuration, makes nvim stuff amazing!
|
||||||
|
'folke/neodev.nvim',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
-- Autocompletion
|
||||||
|
'hrsh7th/nvim-cmp',
|
||||||
|
dependencies = {
|
||||||
|
-- Snippet Engine & its associated nvim-cmp source
|
||||||
|
'L3MON4D3/LuaSnip',
|
||||||
|
'saadparwaiz1/cmp_luasnip',
|
||||||
|
|
||||||
|
-- Adds LSP completion capabilities
|
||||||
|
'hrsh7th/cmp-nvim-lsp',
|
||||||
|
'hrsh7th/cmp-path',
|
||||||
|
|
||||||
|
-- Adds a number of user-friendly snippets
|
||||||
|
'rafamadriz/friendly-snippets',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Useful plugin to show you pending keybinds.
|
||||||
|
{ 'folke/which-key.nvim', opts = {} },
|
||||||
|
{
|
||||||
|
-- Adds git releated signs to the gutter, as well as utilities for managing changes
|
||||||
|
'lewis6991/gitsigns.nvim',
|
||||||
|
opts = {
|
||||||
|
-- See `:help gitsigns.txt`
|
||||||
|
signs = {
|
||||||
|
add = { text = '+' },
|
||||||
|
change = { text = '~' },
|
||||||
|
delete = { text = '_' },
|
||||||
|
topdelete = { text = '‾' },
|
||||||
|
changedelete = { text = '~' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
-- Theme inspired by Atom
|
||||||
|
'navarasu/onedark.nvim',
|
||||||
|
priority = 1000,
|
||||||
|
config = function()
|
||||||
|
vim.cmd.colorscheme 'onedark'
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
-- Set lualine as statusline
|
||||||
|
'nvim-lualine/lualine.nvim',
|
||||||
|
-- See `:help lualine.txt`
|
||||||
|
opts = {
|
||||||
|
options = {
|
||||||
|
icons_enabled = false,
|
||||||
|
theme = 'onedark',
|
||||||
|
component_separators = '|',
|
||||||
|
section_separators = '',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{ "lukas-reineke/indent-blankline.nvim", main = "ibl", opts = {} },
|
||||||
|
-- "gc" to comment visual regions/lines
|
||||||
|
{ 'numToStr/Comment.nvim', opts = {} },
|
||||||
|
|
||||||
|
-- Fuzzy Finder (files, lsp, etc)
|
||||||
|
{ 'nvim-telescope/telescope.nvim', version = '*', dependencies = { 'nvim-lua/plenary.nvim' } },
|
||||||
|
|
||||||
|
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
|
||||||
|
-- Only load if `make` is available. Make sure you have the system
|
||||||
|
-- requirements installed.
|
||||||
|
{
|
||||||
|
'nvim-telescope/telescope-fzf-native.nvim',
|
||||||
|
-- NOTE: If you are having trouble with this installation,
|
||||||
|
-- refer to the README for telescope-fzf-native for more instructions.
|
||||||
|
build = 'make',
|
||||||
|
cond = function()
|
||||||
|
return vim.fn.executable 'make' == 1
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
-- Highlight, edit, and navigate code
|
||||||
|
'nvim-treesitter/nvim-treesitter',
|
||||||
|
dependencies = {
|
||||||
|
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||||
|
},
|
||||||
|
build = ":TSUpdate",
|
||||||
|
},
|
||||||
|
|
||||||
|
-- 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',
|
||||||
|
|
||||||
|
-- NOTE: The import below automatically adds 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
|
||||||
|
-- up-to-date with whatever is in the kickstart repo.
|
||||||
|
--
|
||||||
|
-- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins
|
||||||
|
--
|
||||||
|
-- An additional note is that if you only copied in the `init.lua`, you can just comment this line
|
||||||
|
-- to get rid of the warning telling you that there are not plugins in `lua/custom/plugins/`.
|
||||||
|
{ 'towolf/vim-helm' },
|
||||||
|
{ 'nvim-tree/nvim-tree.lua' },
|
||||||
|
{ 'nvim-tree/nvim-web-devicons' },
|
||||||
|
|
||||||
|
{ 'neovim/nvim-lspconfig' },
|
||||||
|
{ 'MunifTanjim/prettier.nvim' },
|
||||||
|
{ 'f-person/git-blame.nvim' },
|
||||||
|
{
|
||||||
|
'ldelossa/gh.nvim',
|
||||||
|
dependencies = {
|
||||||
|
'ldelossa/litee.nvim' }
|
||||||
|
},
|
||||||
|
{ 'tpope/vim-abolish' },
|
||||||
|
{
|
||||||
|
"kdheepak/lazygit.nvim",
|
||||||
|
-- optional for floating window border decoration
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ "almo7aya/openingh.nvim" },
|
||||||
|
{
|
||||||
|
"epwalsh/obsidian.nvim",
|
||||||
|
version = "*", -- recommended, use latest release instead of latest commit
|
||||||
|
ft = "markdown",
|
||||||
|
-- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault:
|
||||||
|
-- event = {
|
||||||
|
-- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'.
|
||||||
|
-- -- E.g. "BufReadPre " .. vim.fn.expand "~" .. "/my-vault/**.md"
|
||||||
|
-- "BufReadPre path/to/my-vault/**.md",
|
||||||
|
-- "BufNewFile path/to/my-vault/**.md",
|
||||||
|
-- },
|
||||||
|
dependencies = {
|
||||||
|
-- Required.
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
|
||||||
|
-- see below for full list of optional dependencies 👇
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
workspaces = {
|
||||||
|
{
|
||||||
|
name = "personal",
|
||||||
|
path = "~/Documents/Projects/notes",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}, {})
|
|
@ -0,0 +1,72 @@
|
||||||
|
-- [[ Configure Treesitter ]]
|
||||||
|
-- See `:help nvim-treesitter`
|
||||||
|
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', 'typescript', 'vimdoc', 'vim', 'terraform' },
|
||||||
|
|
||||||
|
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
|
||||||
|
auto_install = false,
|
||||||
|
|
||||||
|
highlight = { enable = true },
|
||||||
|
indent = { enable = true, disable = { 'python' } },
|
||||||
|
incremental_selection = {
|
||||||
|
enable = true,
|
||||||
|
keymaps = {
|
||||||
|
init_selection = '<c-space>',
|
||||||
|
node_incremental = '<c-space>',
|
||||||
|
scope_incremental = '<c-s>',
|
||||||
|
node_decremental = '<M-space>',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
textobjects = {
|
||||||
|
select = {
|
||||||
|
enable = true,
|
||||||
|
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
|
||||||
|
keymaps = {
|
||||||
|
-- You can use the capture groups defined in textobjects.scm
|
||||||
|
['aa'] = '@parameter.outer',
|
||||||
|
['ia'] = '@parameter.inner',
|
||||||
|
['af'] = '@function.outer',
|
||||||
|
['if'] = '@function.inner',
|
||||||
|
['ac'] = '@class.outer',
|
||||||
|
['ic'] = '@class.inner',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
move = {
|
||||||
|
enable = true,
|
||||||
|
set_jumps = true, -- whether to set jumps in the jumplist
|
||||||
|
goto_next_start = {
|
||||||
|
[']m'] = '@function.outer',
|
||||||
|
[']]'] = '@class.outer',
|
||||||
|
},
|
||||||
|
goto_next_end = {
|
||||||
|
[']M'] = '@function.outer',
|
||||||
|
[']['] = '@class.outer',
|
||||||
|
},
|
||||||
|
goto_previous_start = {
|
||||||
|
['[m'] = '@function.outer',
|
||||||
|
['[['] = '@class.outer',
|
||||||
|
},
|
||||||
|
goto_previousqend = {
|
||||||
|
['[M'] = '@function.outer',
|
||||||
|
['[]'] = '@class.outer',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
swap = {
|
||||||
|
enable = true,
|
||||||
|
swap_next = {
|
||||||
|
['<leader>a'] = '@parameter.inner',
|
||||||
|
},
|
||||||
|
swap_previous = {
|
||||||
|
['<leader>A'] = '@parameter.inner',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- 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', '<leader>e', vim.diagnostic.open_float, { desc = "Open floating diagnostic message" })
|
||||||
|
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = "Open diagnostics list" })
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
local wk = require("which-key")
|
||||||
|
wk.register({
|
||||||
|
g = {
|
||||||
|
name = "+Git",
|
||||||
|
h = {
|
||||||
|
name = "+Github",
|
||||||
|
c = {
|
||||||
|
name = "+Commits",
|
||||||
|
c = { "<cmd>GHCloseCommit<cr>", "Close" },
|
||||||
|
e = { "<cmd>GHExpandCommit<cr>", "Expand" },
|
||||||
|
o = { "<cmd>GHOpenToCommit<cr>", "Open To" },
|
||||||
|
p = { "<cmd>GHPopOutCommit<cr>", "Pop Out" },
|
||||||
|
z = { "<cmd>GHCollapseCommit<cr>", "Collapse" },
|
||||||
|
},
|
||||||
|
i = {
|
||||||
|
name = "+Issues",
|
||||||
|
p = { "<cmd>GHPreviewIssue<cr>", "Preview" },
|
||||||
|
},
|
||||||
|
l = {
|
||||||
|
name = "+Litee",
|
||||||
|
t = { "<cmd>LTPanel<cr>", "Toggle Panel" },
|
||||||
|
},
|
||||||
|
r = {
|
||||||
|
name = "+Review",
|
||||||
|
b = { "<cmd>GHStartReview<cr>", "Begin" },
|
||||||
|
c = { "<cmd>GHCloseReview<cr>", "Close" },
|
||||||
|
d = { "<cmd>GHDeleteReview<cr>", "Delete" },
|
||||||
|
e = { "<cmd>GHExpandReview<cr>", "Expand" },
|
||||||
|
s = { "<cmd>GHSubmitReview<cr>", "Submit" },
|
||||||
|
z = { "<cmd>GHCollapseReview<cr>", "Collapse" },
|
||||||
|
},
|
||||||
|
p = {
|
||||||
|
name = "+Pull Request",
|
||||||
|
c = { "<cmd>GHClosePR<cr>", "Close" },
|
||||||
|
d = { "<cmd>GHPRDetails<cr>", "Details" },
|
||||||
|
e = { "<cmd>GHExpandPR<cr>", "Expand" },
|
||||||
|
o = { "<cmd>GHOpenPR<cr>", "Open" },
|
||||||
|
p = { "<cmd>GHPopOutPR<cr>", "PopOut" },
|
||||||
|
r = { "<cmd>GHRefreshPR<cr>", "Refresh" },
|
||||||
|
t = { "<cmd>GHOpenToPR<cr>", "Open To" },
|
||||||
|
z = { "<cmd>GHCollapsePR<cr>", "Collapse" },
|
||||||
|
},
|
||||||
|
t = {
|
||||||
|
name = "+Threads",
|
||||||
|
c = { "<cmd>GHCreateThread<cr>", "Create" },
|
||||||
|
n = { "<cmd>GHNextThread<cr>", "Next" },
|
||||||
|
t = { "<cmd>GHToggleThread<cr>", "Toggle" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}, { prefix = "<leader>" })
|
Loading…
Reference in New Issue