First push of own init

This commit is contained in:
MasterUgwae 2025-01-07 23:53:17 +00:00
parent a8f539562a
commit 78d0d9947f
1 changed files with 1111 additions and 971 deletions

226
init.lua
View File

@ -91,7 +91,7 @@ vim.g.mapleader = ' '
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
-- [[ Setting options ]]
-- See `:help vim.opt`
@ -102,7 +102,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'
@ -135,6 +135,7 @@ vim.opt.signcolumn = 'yes'
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
@ -154,11 +155,12 @@ vim.opt.inccommand = 'split'
vim.opt.cursorline = true
-- Minimal number of screen lines to keep above and below the cursor.
vim.opt.scrolloff = 10
vim.opt.scrolloff = 5
-- [[ Basic Keymaps ]]
-- See `:help vim.keymap.set()`
vim.cmd [[command! OpenInit execute 'edit C:/Users/branm/AppData/Local/nvim/init.lua']]
-- Clear highlights on search when pressing <Esc> in normal mode
-- See `:help hlsearch`
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
@ -174,6 +176,9 @@ vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagn
-- or just use <C-\><C-n> to exit terminal mode
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
--vim.keymap.set('n', '<C-e>', ':Neotree toggle<enter>', { desc = 'Opens a Neotree from the User directory' })
--vim.keymap.set('n', '<C-b>', ':Neotree source=buffers<enter>', { desc = 'Opens a Neotree from the User directory' })
-- TIP: Disable arrow keys in normal mode
-- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
-- vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
@ -189,6 +194,13 @@ vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right win
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
vim.keymap.set('n', '<C-_>', function()
require('Comment.api').toggle.linewise.current()
end, { noremap = true, silent = true })
vim.keymap.set('v', '<C-_>', function()
require('Comment.api').toggle.linewise(vim.fn.visualmode())
end, { noremap = true, silent = true })
-- [[ Basic Autocommands ]]
-- See `:help lua-guide-autocommands`
@ -214,7 +226,12 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then
end
end ---@diagnostic disable-next-line: undefined-field
vim.opt.rtp:prepend(lazypath)
vim.keymap.set('n', '<leader>fml', '<cmd>CellularAutomaton make_it_rain<CR>')
vim.keymap.set('n', '<leader>fmg', '<cmd>CellularAutomaton game_of_life<CR>')
vim.keymap.set('n', '<leader>fd', '<cmd>Dealwithit<CR>')
vim.keymap.set('n', '<leader>mc', '<cmd>w<CR><cmd>!g++ ' .. vim.fn.expand '%:t' .. ' -o main.exe<CR>')
vim.keymap.set('n', '<leader>mr', '<cmd>!main.exe<CR>')
-- [[ Configure and install plugins ]]
--
-- To check the current status of your plugins, run
@ -225,22 +242,117 @@ vim.opt.rtp:prepend(lazypath)
-- To update plugins you can run
-- :Lazy update
--
-- NOTE: Here is where you install your plugins.
-- NOTE: here is where you install your plugins.
require('lazy').setup({
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
{
'tpope/vim-sleuth',
}, -- Detect tabstop and shiftwidth automatically},
{
{ 'ap/vim-css-color' },
},
-- extra colour schemes
{
'rktjmp/lush.nvim', -- honestly cannot remember
lazy = false,
},
-- Load jellybeans-nvim
{
'metalelf0/jellybeans-nvim', -- the best colorscheme
requires = { 'rktjmp/lush.nvim' },
},
-- {
-- 'neovim/nvim-lspconfig',
-- config = function()
-- require('lspconfig').clangd.setup {
-- cmd = { 'C:/msys64/mingw64/bin/clangd.exe' },
-- filetypes = { 'cpp', 'c' },
-- root_dir = require('lspconfig/util').root_pattern('compile_commands.json', 'compile_flags.txt', '.git'),
-- }
-- local lspconfig = require 'lspconfig'
-- lspconfig.ruby_lsp.setup {}
-- end,
-- },
{
'neovim/nvim-lspconfig', -- LSPs
config = function()
local lspconfig = require 'lspconfig'
lspconfig.solargraph.setup {
settings = {
solargraph = {
diagnostics = true,
completion = true,
},
},
}
lspconfig.html.setup {
capabilities = {
textDocument = {
completion = {
snippetSupport = true,
},
},
},
}
end,
},
{
'Shopify/ruby-lsp', -- ruby autocomplete
config = function()
local lspconfig = require 'lspconfig'
lspconfig.ruby_lsp.setup {}
end,
},
{
'numToStr/Comment.nvim',
config = function()
require('Comment').setup()
end,
},
--{
-- 'tpope/vim-rails', --ruby autocomplete
--},
{
'mattn/emmet-vim',
},
{
'Eandrju/cellular-automaton.nvim', --CellularAutomaton
},
{
'AndrewRadev/dealwithit.vim', -- dealwithit
},
{
'tamton-aquib/duck.nvim',
config = function()
vim.keymap.set('n', '<leader>dd', function()
require('duck').hatch()
end, {})
vim.keymap.set('n', '<leader>dk', function()
require('duck').cook()
end, {})
vim.keymap.set('n', '<leader>da', function()
require('duck').cook_all()
end, {})
end,
},
{
'skywind3000/vim-keysound',
},
-- NOTE: Plugins can also be added by using a table,
-- with the first argument being the link and the following
-- keys can be used to configure plugin behavior/loading/etc.
--
-- Use `opts = {}` to force a plugin to be loaded.
--
-- Here is a more advanced example where we pass configuration
-- options to `gitsigns.nvim`. This is equivalent to the following Lua:
-- require('gitsigns').setup({ ... })
--
-- See `:help gitsigns` to understand what the configuration keys do
{ -- Adds git related signs to the gutter, as well as utilities for managing changes
'lewis6991/gitsigns.nvim',
@ -266,21 +378,19 @@ require('lazy').setup({
-- which loads which-key before all the UI elements are loaded. Events can be
-- normal autocommands events (`:help autocmd-events`).
--
-- Then, because we use the `opts` key (recommended), the configuration runs
-- after the plugin has been loaded as `require(MODULE).setup(opts)`.
-- Then, because we use the `config` key, the configuration only runs
-- after the plugin has been loaded:
-- config = function() ... end
{ -- Useful plugin to show you pending keybinds.
'folke/which-key.nvim',
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
opts = {
-- delay between pressing a key and opening which-key (milliseconds)
-- this setting is independent of vim.opt.timeoutlen
delay = 0,
icons = {
-- set icon mappings to true if you have a Nerd Font
mappings = vim.g.have_nerd_font,
-- If you are using a Nerd Font: set icons.keys to an empty table which will use the
-- default which-key.nvim defined Nerd Font icons, otherwise define a string table
-- default whick-key.nvim defined Nerd Font icons, otherwise define a string table
keys = vim.g.have_nerd_font and {} or {
Up = '<Up> ',
Down = '<Down> ',
@ -376,14 +486,13 @@ require('lazy').setup({
-- This opens a window that shows you all of the keymaps for the current
-- Telescope picker. This is really useful to discover what Telescope can
-- do as well as how to actually do it!
-- [[ Configure Telescope ]]
-- See `:help telescope` and `:help telescope.setup()`
require('telescope').setup {
-- You can put your default mappings / updates / etc. in here
-- You can put your default mappings / updates / etc. in here
-- All the info you're looking for is in `:help telescope.setup()`
--
-- defaults = {
-- defaults = {
-- mappings = {
-- i = { ['<c-enter>'] = 'to_fuzzy_refine' },
-- },
@ -589,16 +698,6 @@ require('lazy').setup({
end,
})
-- Change diagnostic symbols in the sign column (gutter)
-- if vim.g.have_nerd_font then
-- local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' }
-- local diagnostic_signs = {}
-- for type, icon in pairs(signs) do
-- diagnostic_signs[vim.diagnostic.severity[type]] = icon
-- end
-- vim.diagnostic.config { signs = { text = diagnostic_signs } }
-- end
-- LSP servers and clients are able to communicate to each other what features they support.
-- By default, Neovim doesn't support everything that is in the LSP specification.
-- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities.
@ -616,10 +715,12 @@ require('lazy').setup({
-- - settings (table): Override the default settings passed when initializing the server.
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
local servers = {
-- clangd = {},
clangd = {},
--gopls = {},
-- pyright = {},
-- rust_analyzer = {},
pyright = {},
html = {},
-- ruby_lsp = {},
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:
@ -711,7 +812,7 @@ require('lazy').setup({
formatters_by_ft = {
lua = { 'stylua' },
-- Conform can also run multiple formatters sequentially
-- python = { "isort", "black" },
python = { 'isort', 'black' },
--
-- You can use 'stop_after_first' to run the first available formatter from the list
-- javascript = { "prettierd", "prettier", stop_after_first = true },
@ -798,7 +899,6 @@ require('lazy').setup({
-- Generally you don't need this, because nvim-cmp will display
-- completions whenever it has completion options available.
['<C-Space>'] = cmp.mapping.complete {},
-- Think of <c-l> as moving to the right of your snippet expansion.
-- So if you have a snippet that's like:
-- function $name($args)
@ -846,7 +946,7 @@ require('lazy').setup({
-- 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'
vim.cmd.colorscheme 'tokyonight'
-- You can configure highlights by doing something like:
vim.cmd.hi 'Comment gui=none'
@ -899,7 +999,7 @@ require('lazy').setup({
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
opts = {
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'python', 'cpp' },
-- Autoinstall languages that are not installed
auto_install = true,
highlight = {
@ -919,7 +1019,7 @@ require('lazy').setup({
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
},
-- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the
-- 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.
@ -929,22 +1029,18 @@ require('lazy').setup({
-- 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.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' },
--
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
-- Or use telescope!
-- In normal mode type `<space>sh` then write `lazy.nvim-plugin`
-- you can continue same window with `<space>sr` which resumes last telescope search
}, {
ui = {
-- If you are using a Nerd Font: set icons to an empty table which will use the
@ -966,6 +1062,50 @@ require('lazy').setup({
},
},
})
vim.o.termguicolors = true
vim.cmd 'colorscheme jellybeans-nvim'
vim.g.sleuth_default_shiftwidth = 4
vim.g.sleuth_default_tabstop = 4
vim.g.clang_format_path = 'C:/msys64/mingw64/bin/clang-format.exe'
vim.g.clangd_path = 'C:/msys64/mingw64/bin/clangd.exe'
--vim.g.lspconfig.clangd.setup {
-- cmd = { 'C:/msys64/mingw64/bin/clangd.exe' },
-- filetypes = { 'cpp', 'c' },
--}
-- Filetype detection
vim.filetype.add {
extension = {
['html.erb'] = 'eruby',
},
pattern = {
['*.html.erb'] = 'eruby',
},
}
-- LSP configuration
require('lspconfig').html.setup {
filetypes = { 'html', 'eruby' },
capabilities = {
textDocument = {
completion = {
snippetSupport = true,
},
},
},
}
require('lspconfig').solargraph.setup {
filetypes = { 'ruby', 'eruby' },
settings = {
solargraph = {
diagnostics = true,
completion = true,
},
},
}
-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et