Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: my config #1248

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
177 changes: 113 additions & 64 deletions init.lua
Original file line number Diff line number Diff line change
@@ -1,37 +1,5 @@
--[[

=====================================================================
==================== 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/
Expand Down Expand Up @@ -90,8 +58,14 @@ P.S. You can delete this when you're done too. It's your config now! :)
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '

-- Remap Esc key
vim.api.nvim_set_keymap('i', ';;', '<Esc>', { noremap = true, silent = true })

-- Toggle floating lspsaga term (my own)
vim.keymap.set('n', 't', '<cmd>Lspsaga term_toggle<CR>')

-- 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`
Expand Down Expand Up @@ -154,6 +128,11 @@ vim.opt.cursorline = true
-- Minimal number of screen lines to keep above and below the cursor.
vim.opt.scrolloff = 10

-- folding
vim.opt.foldmethod = 'expr'
vim.opt.foldexpr = 'nvim_treesitter#foldexpr()'
vim.cmd 'set nofoldenable'

-- [[ Basic Keymaps ]]
-- See `:help vim.keymap.set()`

Expand Down Expand Up @@ -204,6 +183,20 @@ vim.api.nvim_create_autocmd('TextYankPost', {
end,
})

-- for entering neovim terminal in insert mode
vim.api.nvim_create_autocmd({ 'TermOpen', 'WinEnter' }, { pattern = 'term://*', command = 'startinsert' })

-- -- Mine: For ray-x go nvim plugin
-- -- Run gofmt + goimports on save
-- local format_sync_grp = vim.api.nvim_create_augroup('goimports', {})
-- vim.api.nvim_create_autocmd('BufWritePre', {
-- pattern = '*.go',
-- callback = function()
-- require('go.format').goimports()
-- end,
-- group = format_sync_grp,
-- })

-- [[ 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'
Expand Down Expand Up @@ -237,7 +230,8 @@ require('lazy').setup({
-- This is equivalent to:
-- require('Comment').setup({})

-- "gc" to comment visual regions/lines
-- "gc" in VISUAL mode to comment visual regions/lines
-- "gcc" in NORMAL mode to toggle comment for single line
{ 'numToStr/Comment.nvim', opts = {} },

-- Here is a more advanced example where we pass configuration
Expand All @@ -257,6 +251,22 @@ require('lazy').setup({
},
},
},
-- {
-- -- my own: lspsaga
-- 'nvimdev/lspsaga.nvim',
-- opts = {
-- lightbulb = {
-- enable = false,
-- },
-- },
-- config = function()
-- require('lspsaga').setup {}
-- end,
-- dependencies = {
-- 'nvim-treesitter/nvim-treesitter', -- optional
-- 'nvim-tree/nvim-web-devicons', -- optional
-- },
-- },

-- NOTE: Plugins can also be configured to run Lua code when they are loaded.
--
Expand Down Expand Up @@ -353,11 +363,14 @@ require('lazy').setup({
-- You can put your default mappings / updates / etc. in here
-- All the info you're looking for is in `:help telescope.setup()`
--
-- defaults = {
-- mappings = {
-- i = { ['<c-enter>'] = 'to_fuzzy_refine' },
-- },
-- },
defaults = {
mappings = {
i = {
['<c-enter>'] = 'to_fuzzy_refine',
['<c-d>'] = 'delete_buffer',
},
},
},
-- pickers = {}
extensions = {
['ui-select'] = {
Expand Down Expand Up @@ -566,16 +579,16 @@ 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 = {},
rust_analyzer = {},
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
--
-- Some languages (like typescript) have entire language plugins that can be useful:
-- https://github.com/pmizio/typescript-tools.nvim
--
-- But for many setups, the LSP (`tsserver`) will work just fine
-- tsserver = {},
tsserver = {},
--

lua_ls = {
Expand Down Expand Up @@ -653,6 +666,7 @@ require('lazy').setup({
formatters_by_ft = {
lua = { 'stylua' },
-- Conform can also run multiple formatters sequentially
go = { 'goimports', 'gofmt' },
-- python = { "isort", "black" },
--
-- You can use a sub-list to tell conform to run *until* a formatter
Expand Down Expand Up @@ -773,21 +787,33 @@ require('lazy').setup({
end,
},

{ -- You can easily change to a different colorscheme.
-- Change the name of the colorscheme plugin below, and then
-- change the command in the config to whatever the name of that colorscheme is.
--
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
'folke/tokyonight.nvim',
priority = 1000, -- Make sure to load this before all the other start plugins.
init = function()
-- Load the colorscheme here.
-- Like many other themes, this one has different styles, and you could load
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
vim.cmd.colorscheme 'tokyonight-night'

-- You can configure highlights by doing something like:
vim.cmd.hi 'Comment gui=none'
-- { -- You can easily change to a different colorscheme.
-- -- Change the name of the colorscheme plugin below, and then
-- -- change the command in the config to whatever the name of that colorscheme is.
-- --
-- -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
-- 'folke/tokyonight.nvim',
-- priority = 1000, -- Make sure to load this before all the other start plugins.
-- init = function()
-- -- Load the colorscheme here.
-- -- Like many other themes, this one has different styles, and you could load
-- -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
-- vim.cmd.colorscheme 'tokyonight-night'
--
-- -- You can configure highlights by doing something like:
-- vim.cmd.hi 'Comment gui=none'
-- end,
-- },

{
'ribru17/bamboo.nvim',
lazy = false,
priority = 1000,
config = function()
require('bamboo').setup {
-- optional configuration here
}
require('bamboo').load()
end,
},

Expand Down Expand Up @@ -863,7 +889,30 @@ require('lazy').setup({
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
end,
},

{
'ray-x/go.nvim',
dependencies = { -- optional packages
'ray-x/guihua.lua',
'neovim/nvim-lspconfig',
'nvim-treesitter/nvim-treesitter',
},
config = function()
require('go').setup()
end,
event = { 'CmdlineEnter' },
ft = { 'go', 'gomod' },
build = ':lua require("go.install").update_all_sync()', -- if you need to install/update all binaries
},
{
'kylechui/nvim-surround',
version = '*', -- Use for stability; omit to use `main` branch for the latest features
event = 'VeryLazy',
config = function()
require('nvim-surround').setup {
-- Configuration here, or leave empty to use defaults
}
end,
},
-- The following two comments only work if you have downloaded the kickstart repo, not just copy pasted the
-- init.lua. If you want these files, they are in the repository, so you can just download them and
-- place them in the correct locations.
Expand All @@ -873,12 +922,12 @@ require('lazy').setup({
-- 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 '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

-- 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.
Expand Down