initial personalised config
This commit is contained in:
parent
f5c9fe8e15
commit
f59a391996
125
init.lua
125
init.lua
|
@ -1,97 +1,13 @@
|
|||
--[[
|
||||
|
||||
=====================================================================
|
||||
==================== READ THIS BEFORE CONTINUING ====================
|
||||
=====================================================================
|
||||
======== .-----. ========
|
||||
======== .----------------------. | === | ========
|
||||
======== |.-""""""""""""""""""-.| |-----| ========
|
||||
======== || || | === | ========
|
||||
======== || KICKSTART.NVIM || |-----| ========
|
||||
======== || || | === | ========
|
||||
======== || || |-----| ========
|
||||
======== ||:Tutor || |:::::| ========
|
||||
======== |'-..................-'| |____o| ========
|
||||
======== `"")----------------(""` ___________ ========
|
||||
======== /::::::::::| |::::::::::\ \ no mouse \ ========
|
||||
======== /:::========| |==hjkl==:::\ \ required \ ========
|
||||
======== '""""""""""""' '""""""""""""' '""""""""""' ========
|
||||
======== ========
|
||||
=====================================================================
|
||||
=====================================================================
|
||||
|
||||
What is Kickstart?
|
||||
|
||||
Kickstart.nvim is *not* a distribution.
|
||||
|
||||
Kickstart.nvim is a starting point for your own configuration.
|
||||
The goal is that you can read every line of code, top-to-bottom, understand
|
||||
what your configuration is doing, and modify it to suit your needs.
|
||||
|
||||
Once you've done that, you can start exploring, configuring and tinkering to
|
||||
make Neovim your own! That might mean leaving Kickstart just the way it is for a while
|
||||
or immediately breaking it into modular pieces. It's up to you!
|
||||
|
||||
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.
|
||||
- :help lua-guide
|
||||
- (or HTML version): https://neovim.io/doc/user/lua-guide.html
|
||||
|
||||
Kickstart Guide:
|
||||
|
||||
TODO: The very first thing you should do is to run the command `:Tutor` in Neovim.
|
||||
|
||||
If you don't know what this means, type the following:
|
||||
- <escape key>
|
||||
- :
|
||||
- Tutor
|
||||
- <enter key>
|
||||
|
||||
(If you already know the Neovim basics, you can skip this step.)
|
||||
|
||||
Once you've completed that, you can continue working through **AND READING** the rest
|
||||
of the kickstart init.lua.
|
||||
|
||||
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.
|
||||
|
||||
NOTE: Look for lines like this
|
||||
|
||||
Throughout the file. These are for you, the reader, to help you understand what is happening.
|
||||
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.maplocalleader = ' '
|
||||
|
||||
require 'custom'
|
||||
|
||||
-- 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
|
||||
|
||||
-- [[ Setting options ]]
|
||||
-- See `:help vim.opt`
|
||||
|
@ -102,7 +18,7 @@ vim.g.have_nerd_font = false
|
|||
vim.opt.number = true
|
||||
-- You can also add relative line numbers, to help with jumping.
|
||||
-- Experiment for yourself to see if you like it!
|
||||
-- vim.opt.relativenumber = true
|
||||
vim.opt.relativenumber = true
|
||||
|
||||
-- Enable mouse mode, can be useful for resizing splits for example!
|
||||
vim.opt.mouse = 'a'
|
||||
|
@ -238,7 +154,20 @@ require('lazy').setup({
|
|||
-- require('Comment').setup({})
|
||||
|
||||
-- "gc" to comment visual regions/lines
|
||||
{ 'numToStr/Comment.nvim', opts = {} },
|
||||
{
|
||||
'numToStr/Comment.nvim',
|
||||
config = function()
|
||||
require('Comment').setup()
|
||||
|
||||
local api = require 'Comment.api'
|
||||
local esc = vim.api.nvim_replace_termcodes('<ESC>', true, false, true)
|
||||
vim.keymap.set('n', '<leader>/', api.toggle.linewise.current)
|
||||
vim.keymap.set('v', '<leader>/', function()
|
||||
vim.api.nvim_feedkeys(esc, 'nx', false)
|
||||
api.toggle.linewise(vim.fn.visualmode())
|
||||
end)
|
||||
end,
|
||||
},
|
||||
|
||||
-- Here is a more advanced example where we pass configuration
|
||||
-- options to `gitsigns.nvim`. This is equivalent to the following Lua:
|
||||
|
@ -384,13 +313,13 @@ require('lazy').setup({
|
|||
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
||||
|
||||
-- Slightly advanced example of overriding default behavior and theme
|
||||
vim.keymap.set('n', '<leader>/', function()
|
||||
vim.keymap.set('n', '<leader>sb', function()
|
||||
-- You can pass additional configuration to Telescope to change the theme, layout, etc.
|
||||
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
||||
winblend = 10,
|
||||
previewer = false,
|
||||
})
|
||||
end, { desc = '[/] Fuzzily search in current buffer' })
|
||||
end, { desc = 'Fuzzily [S]earch in current [B]uffer' })
|
||||
|
||||
-- It's also possible to pass additional configuration options.
|
||||
-- See `:help telescope.builtin.live_grep()` for information about particular keys
|
||||
|
@ -555,7 +484,7 @@ require('lazy').setup({
|
|||
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
|
||||
local servers = {
|
||||
-- clangd = {},
|
||||
-- gopls = {},
|
||||
gopls = {},
|
||||
-- pyright = {},
|
||||
-- rust_analyzer = {},
|
||||
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
|
||||
|
@ -641,6 +570,7 @@ require('lazy').setup({
|
|||
end,
|
||||
formatters_by_ft = {
|
||||
lua = { 'stylua' },
|
||||
go = { 'gofmt', 'goimports' },
|
||||
-- Conform can also run multiple formatters sequentially
|
||||
-- python = { "isort", "black" },
|
||||
--
|
||||
|
@ -718,7 +648,8 @@ 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 },
|
||||
-- ['<C-y>'] = cmp.mapping.confirm { select = true },
|
||||
['<Enter>'] = cmp.mapping.confirm { select = true },
|
||||
|
||||
-- Manually trigger a completion from nvim-cmp.
|
||||
-- Generally you don't need this, because nvim-cmp will display
|
||||
|
@ -859,16 +790,16 @@ require('lazy').setup({
|
|||
-- 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 'kickstart.plugins.autopairs',
|
||||
require 'kickstart.plugins.neo-tree',
|
||||
require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
|
||||
|
||||
-- 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.
|
||||
-- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins`
|
||||
-- { import = 'custom.plugins' },
|
||||
{ import = 'custom.plugins' },
|
||||
}, {
|
||||
ui = {
|
||||
-- If you are using a Nerd Font: set icons to an empty table which will use the
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
require 'custom.remap'
|
|
@ -2,4 +2,31 @@
|
|||
-- I promise not to create any merge conflicts in this directory :)
|
||||
--
|
||||
-- See the kickstart.nvim README for more information
|
||||
return {}
|
||||
return {
|
||||
{ 'nvim-tree/nvim-web-devicons', opts = {} },
|
||||
{
|
||||
'folke/trouble.nvim',
|
||||
config = function()
|
||||
require('trouble').setup()
|
||||
|
||||
vim.keymap.set('n', '<leader>tt', function()
|
||||
require('trouble').toggle()
|
||||
end)
|
||||
|
||||
vim.keymap.set('n', '[t', function()
|
||||
require('trouble').next { skip_groups = true, jump = true }
|
||||
end)
|
||||
|
||||
vim.keymap.set('n', ']t', function()
|
||||
require('trouble').previous { skip_groups = true, jump = true }
|
||||
end)
|
||||
end,
|
||||
},
|
||||
{
|
||||
'mbbill/undotree',
|
||||
|
||||
config = function()
|
||||
vim.keymap.set('n', '<leader>u', vim.cmd.UndotreeToggle)
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
-- move visually selected lines up/down
|
||||
vim.keymap.set('v', 'J', ":m '>+1<CR>gv=gv")
|
||||
vim.keymap.set('v', 'K', ":m '<-2<CR>gv=gv")
|
||||
|
||||
-- join lines while preserving cursor position
|
||||
vim.keymap.set('n', 'J', 'mzJ`z')
|
||||
|
||||
-- center the current line after various commands
|
||||
vim.keymap.set('n', '<C-d>', '<C-d>zz')
|
||||
vim.keymap.set('n', '<C-u>', '<C-u>zz')
|
||||
vim.keymap.set('n', 'n', 'nzzzv')
|
||||
vim.keymap.set('n', 'N', 'Nzzzv')
|
||||
vim.keymap.set('n', '<C-k>', '<cmd>cnext<CR>zz')
|
||||
vim.keymap.set('n', '<C-j>', '<cmd>cprev<CR>zz')
|
||||
vim.keymap.set('n', '<leader>k', '<cmd>lnext<CR>zz')
|
||||
vim.keymap.set('n', '<leader>j', '<cmd>lprev<CR>zz')
|
||||
|
||||
-- paste/delete using the 'black hole' register
|
||||
vim.keymap.set('x', '<leader>p', [["_dP]])
|
||||
vim.keymap.set({ 'n', 'v' }, '<leader>d', [["_d]])
|
||||
|
||||
vim.keymap.set('n', '<leader><leader>', function()
|
||||
vim.cmd 'so'
|
||||
end)
|
Loading…
Reference in New Issue