setting up

This commit is contained in:
BearDad 2024-11-20 18:44:50 +01:00
parent 2ba39c6973
commit c4aabd2da3
18 changed files with 569 additions and 21 deletions

206
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,14 +102,13 @@ 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'
-- Don't show the mode, since it's already in the status line
vim.opt.showmode = false
-- Sync clipboard between OS and Neovim.
-- Schedule the setting after `UiEnter` because it can increase startup-time.
-- Remove this option if you want your OS clipboard to remain independent.
@ -129,7 +128,7 @@ vim.opt.ignorecase = true
vim.opt.smartcase = true
-- Keep signcolumn on by default
vim.opt.signcolumn = 'yes'
vim.opt.signcolumn = 'auto'
-- Decrease update time
vim.opt.updatetime = 250
@ -155,7 +154,7 @@ 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 = 15
-- [[ Basic Keymaps ]]
-- See `:help vim.keymap.set()`
@ -176,10 +175,10 @@ vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagn
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
-- 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>')
-- vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
-- vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
-- Keybinds to make split navigation easier.
-- Use CTRL+<hjkl> to switch between windows
@ -255,7 +254,6 @@ require('lazy').setup({
},
},
},
-- NOTE: Plugins can also be configured to run Lua code when they are loaded.
--
-- This is often very useful to both group configuration, as well as handle
@ -270,7 +268,6 @@ require('lazy').setup({
-- 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'
@ -870,14 +867,12 @@ require('lazy').setup({
-- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren
-- - sd' - [S]urround [D]elete [']quotes
-- - sr)' - [S]urround [R]eplace [)] [']
require('mini.surround').setup()
-- Simple and easy statusline.
require('mini.surround').setup() -- Simple and easy statusline.
-- You could remove this setup call if you don't like it,
-- and try some other statusline plugin
local statusline = require 'mini.statusline'
-- set use_icons to true if you have a Nerd Font
statusline.setup { use_icons = vim.g.have_nerd_font }
statusline.setup { use_icons = true }
-- You can configure sections in the statusline by overriding their
-- default behavior. For example, here we set the section for
@ -891,6 +886,54 @@ require('lazy').setup({
-- Check out: https://github.com/echasnovski/mini.nvim
end,
},
{
'saghen/blink.cmp',
lazy = false, -- lazy loading handled internally
-- optional: provides snippets for the snippet source
dependencies = 'rafamadriz/friendly-snippets',
-- use a release tag to download pre-built binaries
version = 'v0.*',
-- OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust
-- build = 'cargo build --release',
-- If you use nix, you can build from source using latest nightly rust with:
-- build = 'nix run .#build-plugin',
---@module 'blink.cmp'
---@type blink.cmp.Config
opts = {
-- 'default' for mappings similar to built-in completion
-- 'super-tab' for mappings similar to vscode (tab to accept, arrow keys to navigate)
-- 'enter' for mappings similar to 'super-tab' but with 'enter' to accept
-- see the "default configuration" section below for full documentation on how to define
-- your own keymap. when defining your own, no keybinds will be assigned automatically.
keymap = 'enter',
highlight = {
-- sets the fallback highlight groups to nvim-cmp's highlight groups
-- useful for when your theme doesn't support blink.cmp
-- will be removed in a future release, assuming themes add support
use_nvim_cmp_as_default = true,
},
-- set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
-- adjusts spacing to ensure icons are aligned
nerd_font_variant = 'normal',
-- experimental auto-brackets support
-- accept = { auto_brackets = { enabled = true } }
-- experimental signature help support
-- trigger = { signature_help = { enabled = true } }
},
},
-- LSP servers and clients communicate what features they support through "capabilities".
-- By default, Neovim support a subset of the LSP specification.
-- With blink.cmp, Neovim has *more* capabilities which are communicated to the LSP servers.
-- Explanation from TJ: https://youtu.be/m8C0Cq9Uv9o?t=1275
--
-- This can vary by config, but in-general for nvim-lspconfig:
{ -- Highlight, edit, and navigate code
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
@ -926,18 +969,18 @@ 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.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.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.
--
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
-- { import = 'custom.plugins' },
{ import = 'custom.plugins' },
--
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
-- Or use telescope!
@ -967,3 +1010,124 @@ require('lazy').setup({
-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et
--
-- NOTE: THIS IS ROSEPINE CONFIG
--
require('rose-pine').setup {
variant = 'main', -- auto, main, moon, or dawn
dark_variant = 'main', -- main, moon, or dawn
dim_inactive_windows = false,
extend_background_behind_borders = true,
enable = {
terminal = true,
legacy_highlights = true, -- Improve compatibility for previous versions of Neovim
migrations = true, -- Handle deprecated options automatically
},
styles = {
bold = true,
italic = true,
transparency = true,
},
groups = {
border = 'muted',
link = 'iris',
panel = 'surface',
error = 'love',
hint = 'iris',
info = 'foam',
note = 'pine',
todo = 'rose',
warn = 'gold',
git_add = 'foam',
git_change = 'rose',
git_delete = 'love',
git_dirty = 'rose',
git_ignore = 'muted',
git_merge = 'iris',
git_rename = 'pine',
git_stage = 'iris',
git_text = 'rose',
git_untracked = 'subtle',
h1 = 'iris',
h2 = 'foam',
h3 = 'rose',
h4 = 'gold',
h5 = 'pine',
h6 = 'foam',
},
palette = {
-- Override the builtin palette per variant
moon = {
base = '#18191a',
overlay = '#363738',
},
},
highlight_groups = {
Comment = { fg = 'foam' },
VertSplit = { fg = 'muted', bg = 'muted' },
},
before_highlight = function(group, highlight, palette)
-- Disable all undercurls
-- if highlight.undercurl then
-- highlight.undercurl = false
-- end
--
-- Change palette colour
-- if highlight.fg == palette.pine then
-- highlight.fg = palette.foam
-- end
end,
}
vim.cmd 'colorscheme rose-pine'
-- vim.cmd("colorscheme rose-pine-main")
-- vim.cmd("colorscheme rose-pine-moon")
-- vim.cmd("colorscheme rose-pine-dawn")
--
--
--
--
--
-- NOTE: This are my personal keybinds
--
vim.g.vimtex_view_method = ''
vim.g.vimtex_compiler_method = 'latexmk'
vim.opt.guicursor = 'a:block'
vim.keymap.set('v', 'J', ":m '>+1<CR>gv=gv", { desc = 'Move down' })
vim.keymap.set('v', 'K', ":m '<-2<CR>gv=gv", { desc = 'Move up' })
vim.keymap.set('n', '<leader>n', '<cmd>NerdIcons<cr>', { desc = 'Open NerdIcons' })
vim.keymap.set({ 'n', 'v' }, '<C-p>', '"*p', { desc = 'Paste from selection clipboard' })
vim.keymap.set({ 'n', 'v' }, 'p', '"+p', { desc = 'Paste from system clipboard' })
vim.keymap.set({ 'v', 'n' }, '<leader>t', '<cmd>TSBufToggle highlight<cr>', { desc = 'Toggle Tree-sitter highlighting' })
vim.keymap.set('n', '<leader>z', ":!zathura <C-r>=expand('%:r')<cr>.pdf &<cr>", { desc = 'Open PDF' })
vim.keymap.set({ 'n' }, '<leader>p', function()
local file_name = vim.fn.expand '%:t'
if file_name ~= '' then
-- Open Explorer in the current directory and select the file
vim.fn.system { 'explorer.exe', '/select,', file_name }
else
print 'No file name found. Save the buffer first.'
end
end, { desc = 'Open file location in Explorer' })
vim.keymap.set({ 'n' }, '<leader>o', function()
local file_name = vim.fn.expand '%:t'
if file_name ~= '' then
-- Open Explorer in the current directory and select the file
vim.fn.system { 'explorer.exe', file_name }
else
print 'No file found. Make sure the buffer is saved.'
end
end, { desc = 'Open file ' })

9
lazyvim.json Normal file
View File

@ -0,0 +1,9 @@
{
"extras": [
],
"news": {
"NEWS.md": "7429"
},
"version": 7
}

15
lua/config/lazy.lua Normal file
View File

@ -0,0 +1,15 @@
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ 'Failed to clone lazy.nvim:\n', 'ErrorMsg' },
{ out, 'WarningMsg' },
{ '\nPress any key to exit...' },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)

View File

@ -0,0 +1,18 @@
return {
'nvimdev/dashboard-nvim',
event = 'VimEnter',
theme = 'hyper',
config = function()
require('dashboard').setup {
-- config
--
}
end,
hide = {
statusline, -- hide statusline default is true
tabline, -- hide the tabline
winbar, -- hide winbar
},
dependencies = { { 'nvim-tree/nvim-web-devicons' } },
}

1
lua/custom/plugins/emoji.lua Executable file
View File

@ -0,0 +1 @@
return { "xiyaowong/telescope-emoji" }

View File

@ -0,0 +1,8 @@
return {
"rbong/vim-flog",
lazy = true,
cmd = { "Flog", "Flogsplit", "Floggit" },
dependencies = {
"tpope/vim-fugitive",
},
}

View File

@ -0,0 +1,32 @@
return {
'isakbm/gitgraph.nvim',
---@type I.GGConfig
opts = {
symbols = {
merge_commit = 'M',
commit = '*',
},
format = {
timestamp = '%H:%M:%S %d-%m-%Y',
fields = { 'hash', 'timestamp', 'author', 'branch_name', 'tag' },
},
hooks = {
on_select_commit = function(commit)
print('selected commit:', commit.hash)
end,
on_select_range_commit = function(from, to)
print('selected range:', from.hash, to.hash)
end,
},
},
keys = {
{
"<leader>gl",
function()
require('gitgraph').draw({}, { all = true, max_count = 5000 })
end,
desc = "GitGraph - Draw",
},
},
}

View File

@ -0,0 +1,5 @@
return {
'smjonas/inc-rename.nvim',
cmd = 'IncRename',
opts = {},
}

View File

@ -0,0 +1,7 @@
return {
"glepnir/nerdicons.nvim",
cmd = "NerdIcons",
config = function()
require("nerdicons").setup({})
end,
}

View File

@ -0,0 +1,7 @@
return {
'folke/noice.nvim',
optional = true,
opts = {
presets = { inc_rename = true },
},
}

View File

@ -0,0 +1,60 @@
return {
"stevearc/oil.nvim",
config = function()
local oil = require("oil")
oil.setup({
buf_options = {
buflisted = false,
bufhidden = "hide",
},
skip_confirm_for_simple_edits = true,
view_options = {
-- Show files and directories that start with "."
show_hidden = true,
-- This function defines what is considered a "hidden" file
is_hidden_file = function(name, bufnr)
return vim.startswith(name, ".")
end,
-- This function defines what will never be shown, even when `show_hidden` is set
is_always_hidden = function(name, bufnr)
return false
end,
-- Sort file names in a more intuitive order for humans. Is less performant,
-- so you may want to set to false if you work with large directories.
natural_order = true,
-- Sort file and directory names case insensitive
case_insensitive = false,
sort = {
-- sort order can be "asc" or "desc"
-- see :help oil-columns to see which columns are sortable
{ "type", "asc" },
{ "name", "asc" },
},
},
float = {
-- Padding around the floating window
padding = 4,
max_width = 100,
max_height = 15,
border = "rounded",
win_options = {
winblend = 0,
},
-- optionally override the oil buffers window title with custom function: fun(winid: integer): string
get_win_title = nil,
-- preview_split: Split direction: "auto", "left", "right", "above", "below".
preview_split = "auto",
-- This is the config that will be passed to nvim_open_win.
-- Change values here to customize the layout
override = function(conf)
return conf
end,
},
})
vim.keymap.set("n", "-", "<cmd>Oil<cr>", { desc = "Open oil" })
vim.keymap.set("n", "<localleader>-", oil.toggle_float, {})
end,
}

9
lua/custom/plugins/plugins.lua Executable file
View File

@ -0,0 +1,9 @@
return {
"stevearc/aerial.nvim",
opts = {},
-- Optional dependencies
dependencies = {
"nvim-treesitter/nvim-treesitter",
"nvim-tree/nvim-web-devicons",
},
}

View File

@ -0,0 +1 @@
return { "rose-pine/neovim", name = "rose-pine" }

View File

@ -0,0 +1,154 @@
return {
'folke/snacks.nvim',
priority = 1000,
lazy = false,
---@type snacks.Config
opts = {
bigfile = { enabled = true },
dashboard = { enabled = true },
notifier = {
enabled = true,
timeout = 3000,
},
quickfile = { enabled = true },
statuscolumn = { enabled = true },
words = { enabled = true },
styles = {
notification = {
wo = { wrap = true }, -- Wrap notifications
},
},
},
keys = {
{
'<leader>un',
function()
Snacks.notifier.hide()
end,
desc = 'Dismiss All Notifications',
},
{
'<leader>bd',
function()
Snacks.bufdelete()
end,
desc = 'Delete Buffer',
},
{
'<leader>gg',
function()
Snacks.lazygit()
end,
desc = 'Lazygit',
},
{
'<leader>gb',
function()
Snacks.git.blame_line()
end,
desc = 'Git Blame Line',
},
{
'<leader>gB',
function()
Snacks.gitbrowse()
end,
desc = 'Git Browse',
},
{
'<leader>gf',
function()
Snacks.lazygit.log_file()
end,
desc = 'Lazygit Current File History',
},
{
'<leader>gl',
function()
Snacks.lazygit.log()
end,
desc = 'Lazygit Log (cwd)',
},
{
'<leader>cR',
function()
Snacks.rename.rename_file()
end,
desc = 'Rename File',
},
{
'<c-/>',
function()
Snacks.terminal()
end,
desc = 'Toggle Terminal',
},
{
'<c-_>',
function()
Snacks.terminal()
end,
desc = 'which_key_ignore',
},
{
']]',
function()
Snacks.words.jump(vim.v.count1)
end,
desc = 'Next Reference',
mode = { 'n', 't' },
},
{
'[[',
function()
Snacks.words.jump(-vim.v.count1)
end,
desc = 'Prev Reference',
mode = { 'n', 't' },
},
{
'<leader>N',
desc = 'Neovim News',
function()
Snacks.win {
file = vim.api.nvim_get_runtime_file('doc/news.txt', false)[1],
width = 0.6,
height = 0.6,
wo = {
spell = false,
wrap = false,
signcolumn = 'yes',
statuscolumn = ' ',
conceallevel = 3,
},
}
end,
},
},
init = function()
vim.api.nvim_create_autocmd('User', {
pattern = 'VeryLazy',
callback = function()
-- Setup some globals for debugging (lazy-loaded)
_G.dd = function(...)
Snacks.debug.inspect(...)
end
_G.bt = function()
Snacks.debug.backtrace()
end
vim.print = _G.dd -- Override print to use snacks for `:=` command
-- Create some toggle mappings
Snacks.toggle.option('spell', { name = 'Spelling' }):map '<leader>us'
Snacks.toggle.option('wrap', { name = 'Wrap' }):map '<leader>uw'
Snacks.toggle.option('relativenumber', { name = 'Relative Number' }):map '<leader>uL'
Snacks.toggle.diagnostics():map '<leader>ud'
Snacks.toggle.line_number():map '<leader>ul'
Snacks.toggle.option('conceallevel', { off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2 }):map '<leader>uc'
Snacks.toggle.treesitter():map '<leader>uT'
Snacks.toggle.option('background', { off = 'light', on = 'dark', name = 'Dark Background' }):map '<leader>ub'
Snacks.toggle.inlay_hints():map '<leader>uh'
end,
})
end,
}

View File

@ -0,0 +1,8 @@
return {
{
"supermaven-inc/supermaven-nvim",
config = function()
require("supermaven-nvim").setup({})
end,
},
}

17
lua/custom/plugins/tmux-vim.lua Executable file
View File

@ -0,0 +1,17 @@
return {
"christoomey/vim-tmux-navigator",
cmd = {
"TmuxNavigateLeft",
"TmuxNavigateDown",
"TmuxNavigateUp",
"TmuxNavigateRight",
"TmuxNavigatePrevious",
},
keys = {
{ "<c-h>", "<cmd><C-U>TmuxNavigateLeft<cr>" },
{ "<c-j>", "<cmd><C-U>TmuxNavigateDown<cr>" },
{ "<c-k>", "<cmd><C-U>TmuxNavigateUp<cr>" },
{ "<c-l>", "<cmd><C-U>TmuxNavigateRight<cr>" },
{ "<c-\\>", "<cmd><C-U>TmuxNavigatePrevious<cr>" },
},
}

View File

@ -0,0 +1,32 @@
return {
{
"lervag/vimtex",
lazy = false, -- we don't want to lazy load VimTeX
-- tag = "v2.15", -- uncomment to pin to a specific release
init = function()
-- VimTeX configuration goes here, e.g.
vim.g.vimtex_view_general_viewer = ""
vim.g.vimtex_view_general_options = ""
vim.g.vimtex_view_method = ""
vim.g.vimtex_compiler_method = "latexmk"
vim.g.vimtex_view_general_options = '--unique file:@pdf""#src:@line@tex'
vim.g.tex_conceal = "abdmg"
vim.g.tex_flavor = "latex"
vim.g.vimtex_syntax_conceal = {
accents = true,
ligatures = true,
cites = true,
fancy = true,
spacing = true,
greek = true,
math_bounds = true,
math_delimiters = true,
math_fracs = true,
math_super_sub = true,
math_symbols = true,
sections = true,
styles = true,
}
end,
},
}

View File

@ -0,0 +1 @@
return { "wakatime/vim-wakatime", lazy = false }