huge reordering of config
add codeium plugin change keymaps for completion picker to up/down/tab remove comments compact config
This commit is contained in:
parent
86fb9d5828
commit
0cf6219bdf
216
init.lua
216
init.lua
|
@ -1,55 +1,14 @@
|
|||
--[[
|
||||
|
||||
=====================================================================
|
||||
==================== READ THIS BEFORE CONTINUING ====================
|
||||
=====================================================================
|
||||
======== .-----. ========
|
||||
======== .----------------------. | === | ========
|
||||
======== |.-""""""""""""""""""-.| |-----| ========
|
||||
======== || || | === | ========
|
||||
======== || KICKSTART.NVIM || |-----| ========
|
||||
======== || || | === | ========
|
||||
======== || || |-----| ========
|
||||
======== ||:Tutor || |:::::| ========
|
||||
======== |'-..................-'| |____o| ========
|
||||
======== `"")----------------(""` ___________ ========
|
||||
======== /::::::::::| |::::::::::\ \ no mouse \ ========
|
||||
======== /:::========| |==hjkl==:::\ \ required \ ========
|
||||
======== '""""""""""""' '""""""""""""' '""""""""""' ========
|
||||
======== ========
|
||||
=====================================================================
|
||||
=====================================================================
|
||||
|
||||
What is Kickstart?
|
||||
|
||||
Kickstart.nvim is *not* a distribution.
|
||||
|
||||
|
||||
If you don't know anything about Lua, I recommend taking some time to read through
|
||||
a guide. One possible example which will only take 10-15 minutes:
|
||||
- https://learnxinyminutes.com/docs/lua/
|
||||
|
||||
After understanding a bit more about Lua, you can use `:help lua-guide` as a
|
||||
reference for how Neovim integrates Lua.
|
||||
- Lua
|
||||
- quick guide: https://learnxinyminutes.com/docs/lua/
|
||||
- :help lua-guide
|
||||
- (or HTML version): https://neovim.io/doc/user/lua-guide.html
|
||||
|
||||
Kickstart Guide:
|
||||
HELP
|
||||
|
||||
|
||||
Next, run AND READ `:help`.
|
||||
This will open up a help window with some basic information
|
||||
about reading, navigating and searching the builtin help documentation.
|
||||
|
||||
This should be the first place you go to look when you're stuck or confused
|
||||
with something. It's one of my favorite Neovim features.
|
||||
|
||||
MOST IMPORTANTLY, we provide a keymap "<space>sh" to [s]earch the [h]elp documentation,
|
||||
which is very useful when you're not exactly sure of what you're looking for.
|
||||
|
||||
I have left several `:help X` comments throughout the init.lua
|
||||
These are hints about where to find more information about the relevant settings,
|
||||
plugins or Neovim features used in Kickstart.
|
||||
- keymap "<space>sh" to [s]earch the [h]elp documentation,
|
||||
- several `:help X` comments throughout the init.lua
|
||||
|
||||
NOTE: Look for lines like this
|
||||
|
||||
|
@ -57,38 +16,22 @@ Kickstart Guide:
|
|||
Feel free to delete them once you know what you're doing, but they should serve as a guide
|
||||
for when you are first encountering a few different constructs in your Neovim config.
|
||||
|
||||
If you experience any errors while trying to install kickstart, run `:checkhealth` for more info.
|
||||
|
||||
I hope you enjoy your Neovim journey,
|
||||
- TJ
|
||||
|
||||
P.S. You can delete this when you're done too. It's your config now! :)
|
||||
--]]
|
||||
|
||||
-- Set <space> as the leader key
|
||||
-- See `:help mapleader`
|
||||
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
|
||||
vim.g.mapleader = ' '
|
||||
vim.g.mapleader = ' ' -- Set <space> as the leader key
|
||||
vim.g.maplocalleader = ' '
|
||||
|
||||
-- Set to true if you have a Nerd Font installed and selected in the terminal
|
||||
vim.g.have_nerd_font = false
|
||||
vim.g.have_nerd_font = true -- Set to true if you have a Nerd Font installed and selected in the terminal
|
||||
|
||||
-- [[ Setting options ]]
|
||||
-- See `:help vim.opt`
|
||||
-- NOTE: You can change these options as you wish!
|
||||
-- For more options, you can see `:help option-list`
|
||||
-- :help vim.opt
|
||||
-- :help option-list
|
||||
|
||||
-- Make line numbers default
|
||||
-- You can also add relative line numbers, to help with jumping.
|
||||
vim.opt.number = false
|
||||
vim.opt.relativenumber = false
|
||||
|
||||
-- Enable mouse mode, can be useful for resizing splits for example!
|
||||
vim.opt.mouse = 'a'
|
||||
|
||||
-- Don't show the mode, since it's already in the status line
|
||||
vim.opt.showmode = false
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = true
|
||||
vim.opt.mouse = 'a' -- Enable mouse mode, can be useful for resizing splits for example!
|
||||
vim.opt.showmode = false -- Don't show the mode, since it's already in the status line
|
||||
|
||||
-- Sync clipboard between OS and Neovim.
|
||||
-- Schedule the setting after `UiEnter` because it can increase startup-time.
|
||||
|
@ -98,29 +41,15 @@ vim.schedule(function()
|
|||
vim.opt.clipboard = 'unnamedplus'
|
||||
end)
|
||||
|
||||
-- Enable break indent
|
||||
vim.opt.breakindent = true
|
||||
|
||||
-- Save undo history
|
||||
vim.opt.undofile = false
|
||||
|
||||
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
|
||||
vim.opt.ignorecase = true
|
||||
vim.opt.breakindent = true -- Enable break indent
|
||||
vim.opt.undofile = false -- Do not save undo history (no undo beyond last save)
|
||||
vim.opt.ignorecase = true -- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
|
||||
vim.opt.smartcase = true
|
||||
|
||||
-- Keep signcolumn on by default
|
||||
vim.opt.signcolumn = 'yes'
|
||||
|
||||
-- Decrease update time
|
||||
vim.opt.updatetime = 250
|
||||
|
||||
-- Decrease mapped sequence wait time
|
||||
-- Displays which-key popup sooner
|
||||
vim.opt.timeoutlen = 300
|
||||
|
||||
-- Configure how new splits should be opened
|
||||
vim.opt.splitright = true
|
||||
vim.opt.splitbelow = true
|
||||
vim.opt.signcolumn = 'yes' -- Keep signcolumn on by default
|
||||
vim.opt.updatetime = 250 -- Decrease update time
|
||||
vim.opt.timeoutlen = 300 -- Decrease mapped sequence wait time + displays which-key popup sooner
|
||||
vim.opt.splitright = true -- Configure how new splits should be opened
|
||||
vim.opt.splitbelow = true -- Configure how new splits should be opened
|
||||
|
||||
-- Sets how neovim will display certain whitespace characters in the editor.
|
||||
-- See `:help 'list'`
|
||||
|
@ -129,14 +58,23 @@ vim.opt.list = false
|
|||
--vim.opt.listchars = { tab = '» ', trail = '·', eol = '$', nbsp = '␣' }
|
||||
vim.opt.listchars = { tab = '▸·', trail = '▸', eol = '$', nbsp = '␣' }
|
||||
|
||||
-- Preview substitutions live, as you type!
|
||||
vim.opt.inccommand = 'split'
|
||||
vim.opt.inccommand = 'split' -- Preview substitutions live, as you type!
|
||||
vim.opt.cursorline = true -- Show which line your cursor is on
|
||||
vim.opt.scrolloff = 3 -- Minimal number of screen lines to keep above and below the cursor.
|
||||
|
||||
-- Show which line your cursor is on
|
||||
vim.opt.cursorline = true
|
||||
-- [[ Basic Autocommands ]]
|
||||
-- See `:help lua-guide-autocommands`
|
||||
|
||||
-- Minimal number of screen lines to keep above and below the cursor.
|
||||
vim.opt.scrolloff = 3
|
||||
-- Highlight when yanking (copying) text
|
||||
-- Try it with `yap` in normal mode
|
||||
-- See `:help vim.highlight.on_yank()`
|
||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
desc = 'Highlight when yanking (copying) text',
|
||||
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
|
||||
callback = function()
|
||||
vim.highlight.on_yank()
|
||||
end,
|
||||
})
|
||||
|
||||
-- Restore cursor position from last file open
|
||||
vim.api.nvim_create_autocmd('BufRead', {
|
||||
|
@ -155,20 +93,6 @@ vim.api.nvim_create_autocmd('BufRead', {
|
|||
end,
|
||||
})
|
||||
|
||||
-- [[ Basic Autocommands ]]
|
||||
-- See `:help lua-guide-autocommands`
|
||||
|
||||
-- Highlight when yanking (copying) text
|
||||
-- Try it with `yap` in normal mode
|
||||
-- See `:help vim.highlight.on_yank()`
|
||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
desc = 'Highlight when yanking (copying) text',
|
||||
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
|
||||
callback = function()
|
||||
vim.highlight.on_yank()
|
||||
end,
|
||||
})
|
||||
|
||||
-- [[ Install `lazy.nvim` plugin manager ]]
|
||||
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
|
||||
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
||||
|
@ -183,11 +107,6 @@ vim.opt.rtp:prepend(lazypath)
|
|||
|
||||
-- [[ Configure and install plugins ]]
|
||||
--
|
||||
-- To check the current status of your plugins, run
|
||||
-- :Lazy
|
||||
--
|
||||
-- You can press `?` in this menu for help. Use `:q` to close the window
|
||||
--
|
||||
-- To update plugins you can run
|
||||
-- :Lazy update
|
||||
--
|
||||
|
@ -353,6 +272,17 @@ require('lazy').setup({
|
|||
-- },
|
||||
-- },
|
||||
-- pickers = {}
|
||||
|
||||
--[[ layout_config = {
|
||||
defaults = {
|
||||
layout_strategy = 'vertical',
|
||||
height = vim.o.lines, -- maximally available lines
|
||||
width = vim.o.columns, -- maximally available columns
|
||||
prompt_position = 'top',
|
||||
-- preview_height = 0.6, -- 60% of available lines
|
||||
},
|
||||
},
|
||||
--]]
|
||||
extensions = {
|
||||
['ui-select'] = {
|
||||
require('telescope.themes').get_dropdown(),
|
||||
|
@ -744,10 +674,14 @@ require('lazy').setup({
|
|||
--
|
||||
-- No, but seriously. Please read `:help ins-completion`, it is really good!
|
||||
mapping = cmp.mapping.preset.insert {
|
||||
-- Select the [n]ext item
|
||||
['<C-n>'] = cmp.mapping.select_next_item(),
|
||||
-- Select the [p]revious item
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||
['<Down>'] = cmp.mapping.select_next_item(),
|
||||
['<Up>'] = cmp.mapping.select_prev_item(),
|
||||
--['<Tab>'] = cmp.mapping.select_next_item(),
|
||||
--['<S-Tab>'] = cmp.mapping.select_prev_item(),
|
||||
['<Tab>'] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
},
|
||||
|
||||
-- Scroll the documentation window [b]ack / [f]orward
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
|
@ -756,13 +690,6 @@ 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.
|
||||
['<C-y>'] = cmp.mapping.confirm { select = true },
|
||||
|
||||
-- If you prefer more traditional completion keymaps,
|
||||
-- you can uncomment the following lines
|
||||
--['<CR>'] = cmp.mapping.confirm { select = true },
|
||||
--['<Tab>'] = cmp.mapping.select_next_item(),
|
||||
--['<S-Tab>'] = cmp.mapping.select_prev_item(),
|
||||
|
||||
-- Manually trigger a completion from nvim-cmp.
|
||||
-- Generally you don't need this, because nvim-cmp will display
|
||||
|
@ -800,6 +727,7 @@ require('lazy').setup({
|
|||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'path' },
|
||||
{ name = 'codeium' },
|
||||
},
|
||||
}
|
||||
end,
|
||||
|
@ -845,6 +773,7 @@ require('lazy').setup({
|
|||
-- Check out: https://github.com/echasnovski/mini.nvim
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
'nvim-lualine/lualine.nvim',
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
|
@ -852,6 +781,15 @@ require('lazy').setup({
|
|||
require('lualine').setup()
|
||||
end,
|
||||
},
|
||||
-- Nvimtree (File Explorer)
|
||||
{
|
||||
'nvim-tree/nvim-tree.lua',
|
||||
lazy = true,
|
||||
dependencies = {
|
||||
'nvim-tree/nvim-web-devicons',
|
||||
},
|
||||
},
|
||||
|
||||
{ -- Highlight, edit, and navigate code
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
build = ':TSUpdate',
|
||||
|
@ -878,23 +816,23 @@ require('lazy').setup({
|
|||
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
|
||||
},
|
||||
|
||||
-- import core settings
|
||||
{ import = 'core' },
|
||||
|
||||
-- NOTE: Next step on your Neovim journey: Add/Configure additional plugins for Kickstart
|
||||
--
|
||||
-- Here are some example plugins that I've included in the Kickstart repository.
|
||||
-- Uncomment any of the lines below to enable them (you will need to restart nvim).
|
||||
--
|
||||
-- require 'kickstart.plugins.debug',
|
||||
-- require 'kickstart.plugins.indent_line',
|
||||
-- require 'kickstart.plugins.lint',
|
||||
-- require 'kickstart.plugins.autopairs',
|
||||
-- require 'kickstart.plugins.neo-tree',
|
||||
-- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
|
||||
require 'plugins.debug',
|
||||
-- require 'plugins.indent_line',
|
||||
-- require 'plugins.lint',
|
||||
require 'plugins.autopairs',
|
||||
require 'plugins.neo-tree',
|
||||
require 'plugins.gitsigns', -- adds gitsigns recommend keymaps
|
||||
require 'plugins.codeium',
|
||||
require 'plugins.terraform',
|
||||
|
||||
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
||||
-- This is the easiest way to modularize your config.
|
||||
--
|
||||
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
|
||||
{ import = 'custom.plugins' },
|
||||
--
|
||||
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
|
||||
-- Or use telescope!
|
||||
|
|
|
@ -2,6 +2,17 @@ return {
|
|||
-- [[ Basic Keymaps ]]
|
||||
-- See `:help vim.keymap.set()`
|
||||
|
||||
-- function to assist with keymapping
|
||||
--[[
|
||||
function map(mode, lhs, rhs, opts)
|
||||
local options = { noremap = true, silent = true }
|
||||
if opts then
|
||||
options = vim.tbl_extend("force", options, opts)
|
||||
end
|
||||
vim.keymap.set(mode, lhs, rhs, options)
|
||||
end
|
||||
--]]
|
||||
|
||||
-- Clear highlights on search when pressing <Esc> in normal mode
|
||||
-- See `:help hlsearch`
|
||||
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>'),
|
||||
|
@ -17,9 +28,8 @@ return {
|
|||
-- or just use <C-\><C-n> to exit terminal mode
|
||||
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' }),
|
||||
|
||||
-- Keybinds to make split navigation easier.
|
||||
-- Window and buffer handling
|
||||
-- Use CTRL+<hjkl> to switch between windows
|
||||
--
|
||||
-- See `:help wincmd` for a list of all window commands
|
||||
vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' }),
|
||||
vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' }),
|
||||
|
@ -27,12 +37,14 @@ return {
|
|||
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' }),
|
||||
vim.keymap.set('n', '<Tab>', ':bn!<Enter>', { desc = 'Go to next buffer' }),
|
||||
vim.keymap.set('n', '<S-Tab>', ':bp!<Enter>', { desc = 'Go to previous buffer' }),
|
||||
vim.keymap.set('n', '<leader>ws', ':split<Enter>', { desc = 'split window horizontally' }),
|
||||
vim.keymap.set('n', '<leader>wv', ':vsplit<Enter>', { desc = 'split window vertically' }),
|
||||
|
||||
-- terraform
|
||||
vim.keymap.set('n', '<leader>ti', ':!terraform init<CR>', { desc = 'terraform init' }),
|
||||
vim.keymap.set('n', '<leader>tv', ':!terraform validate<CR>', { desc = 'terraform validate' }),
|
||||
vim.keymap.set('n', '<leader>tp', ':!terraform plan<CR>', { desc = 'terraform plan' }),
|
||||
vim.keymap.set('n', '<leader>taa', ':!terraform apply -auto-approve<CR>', { desc = 'terraform apply' }),
|
||||
vim.keymap.set('n', '<leader>ti', ':!terraform init -no-color<CR>', { desc = 'terraform init' }),
|
||||
vim.keymap.set('n', '<leader>tv', ':!terraform validate -no-color<CR>', { desc = 'terraform validate' }),
|
||||
vim.keymap.set('n', '<leader>tp', ':!terraform plan -no-color<CR>', { desc = 'terraform plan' }),
|
||||
vim.keymap.set('n', '<leader>taa', ':!terraform apply -no-color -auto-approve<CR>', { desc = 'terraform apply' }),
|
||||
|
||||
-- Toggles
|
||||
vim.keymap.set('n', '<leader>n', ':set number!<Enter>:set relativenumber!<Enter>'),
|
|
@ -1,5 +0,0 @@
|
|||
-- 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 {}
|
|
@ -0,0 +1,17 @@
|
|||
--
|
||||
-- Codeium
|
||||
-- https://github.com/Exafunction/codeium.nvim
|
||||
--
|
||||
|
||||
return {
|
||||
|
||||
'Exafunction/codeium.nvim',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'hrsh7th/nvim-cmp',
|
||||
},
|
||||
event = 'BufEnter',
|
||||
config = function()
|
||||
require('codeium').setup {}
|
||||
end,
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
return {
|
||||
'mvaldes14/terraform.nvim',
|
||||
ft = 'terraform',
|
||||
}
|
Loading…
Reference in New Issue