initial commit
This commit is contained in:
7
homemanager/neovim/lua/config/autocommands.lua
Normal file
7
homemanager/neovim/lua/config/autocommands.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
vim.api.nvim_create_autocmd({ 'TextYankPost' }, {
|
||||
desc = "Highlight when yanking",
|
||||
group = vim.api.nvim_create_augroup("YankHighlight", { clear = true }),
|
||||
callback = function()
|
||||
vim.highlight.on_yank()
|
||||
end,
|
||||
})
|
||||
44
homemanager/neovim/lua/config/commands.lua
Normal file
44
homemanager/neovim/lua/config/commands.lua
Normal file
@@ -0,0 +1,44 @@
|
||||
local lib = require('lib.window')
|
||||
|
||||
local command = function(name, callback)
|
||||
vim.api.nvim_create_user_command(name, callback, {})
|
||||
end
|
||||
|
||||
command('Settings', function()
|
||||
local path = vim.fn.expand('~/.config/dotfiles/homes/quirinecker/.config/nvim')
|
||||
lib.new_window(path, 'Settings')
|
||||
end)
|
||||
|
||||
command('TransparencyFix', function()
|
||||
require('lualine').setup(require('plugins.lualine').opts)
|
||||
end)
|
||||
|
||||
command('MavenStartCommand', function()
|
||||
local Path = require("plenary.path")
|
||||
local cwd = Path:new(vim.fn.getcwd()):absolute()
|
||||
local baseName = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(0), ":t")
|
||||
|
||||
if vim.fn.filereadable(cwd .. "/pom.xml") ~= 1 then
|
||||
vim.notify("No pom.xml found in current directory", vim.log.levels.ERROR)
|
||||
return
|
||||
end
|
||||
|
||||
if not baseName:match(".java$") then
|
||||
vim.notify("Current buffer is not a java file", vim.log.levels.ERROR)
|
||||
return
|
||||
end
|
||||
|
||||
local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false)
|
||||
|
||||
local className = baseName:gsub(".java", "")
|
||||
local packageName = ""
|
||||
for _, line in ipairs(lines) do
|
||||
if line:match("^package ") then
|
||||
local value = vim.split(line, " ")[2]
|
||||
packageName = value:gsub(";", "")
|
||||
end
|
||||
end
|
||||
|
||||
vim.fn.setreg("+", "mvn exec:java -Dexec.mainClass=" .. packageName .. "." .. className)
|
||||
vim.notify("Copied Start Command to Clipboard", vim.log.levels.INFO)
|
||||
end)
|
||||
6
homemanager/neovim/lua/config/init.lua
Normal file
6
homemanager/neovim/lua/config/init.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
require('config.settings')
|
||||
require('config.keymap')
|
||||
require('config.commands')
|
||||
require('config.setup')
|
||||
require('config.lazy')
|
||||
require('config.autocommands')
|
||||
44
homemanager/neovim/lua/config/keymap.lua
Normal file
44
homemanager/neovim/lua/config/keymap.lua
Normal file
@@ -0,0 +1,44 @@
|
||||
local keymap = vim.keymap.set
|
||||
keymap({ 'v', 'n' }, ' ', '', {})
|
||||
|
||||
local function vn_map(map, action)
|
||||
keymap({ 'v', 'n' }, map, action)
|
||||
end
|
||||
|
||||
-- splitting
|
||||
|
||||
|
||||
-- Clipboard
|
||||
vn_map('<leader>y', [["+y]])
|
||||
keymap('n', '<leader>yy', [["+yy]])
|
||||
vn_map('<leader>op', [[o<Esc>"+p]])
|
||||
vn_map('<leader>p', [["+p]])
|
||||
|
||||
vn_map('<leader>cl', ':bd <cr>')
|
||||
vn_map('<leader>ss', ':w <cr>')
|
||||
vn_map('<leader>sq', ':wq <cr>')
|
||||
vn_map('<leader>sc', ':w <cr> :bd <cr>')
|
||||
|
||||
-- Quickfix List
|
||||
|
||||
vim.keymap.set('n', '<alt>n', ':cnext<cr>')
|
||||
vim.keymap.set('n', '<alt>p', ':cprevious<cr>')
|
||||
|
||||
-- Terminal
|
||||
vim.keymap.set('n', '<leader>tt', function()
|
||||
os.execute("kitty")
|
||||
end)
|
||||
|
||||
-- Copy Path to clipboard
|
||||
vim.keymap.set('n', '<leader>yrp', function()
|
||||
local path = vim.fn.expand("%:p")
|
||||
local relative_path = vim.fn.fnamemodify(path, ":~:.")
|
||||
vim.fn.setreg("+", relative_path)
|
||||
vim.notify('Copied "' .. relative_path .. '" to the clipboard!')
|
||||
end)
|
||||
|
||||
vim.keymap.set('n', '<leader>yap', function()
|
||||
local path = vim.fn.expand("%:p")
|
||||
vim.fn.setreg("+", path)
|
||||
vim.notify('Copied "' .. path .. '" to the clipboard!')
|
||||
end)
|
||||
6
homemanager/neovim/lua/config/lazy.lua
Normal file
6
homemanager/neovim/lua/config/lazy.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
-- require('lazy').setup("plugins")
|
||||
require('lazy').setup({
|
||||
spec = {
|
||||
{import = "plugins.spec"},
|
||||
}
|
||||
})
|
||||
35
homemanager/neovim/lua/config/settings.lua
Normal file
35
homemanager/neovim/lua/config/settings.lua
Normal file
@@ -0,0 +1,35 @@
|
||||
-- Mapleader
|
||||
vim.g.mapleader = ' '
|
||||
|
||||
-- Colors
|
||||
vim.opt.termguicolors = true
|
||||
|
||||
-- tabsize
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.softtabstop = 4
|
||||
vim.opt.expandtab = true
|
||||
|
||||
-- Line Wrap
|
||||
vim.opt.wrap = false
|
||||
|
||||
-- Searching
|
||||
vim.opt.hlsearch = false
|
||||
vim.opt.incsearch = true
|
||||
|
||||
-- Line Numbering
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = true
|
||||
|
||||
-- Other
|
||||
vim.opt.scrolloff = 8
|
||||
vim.opt.signcolumn = "yes"
|
||||
vim.opt.colorcolumn = "120"
|
||||
vim.opt.smartindent = true
|
||||
|
||||
-- Disabling Netrw
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
|
||||
-- Tabline
|
||||
vim.opt.showtabline = 1
|
||||
12
homemanager/neovim/lua/config/setup.lua
Normal file
12
homemanager/neovim/lua/config/setup.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
1
homemanager/neovim/lua/config/test.txt
Normal file
1
homemanager/neovim/lua/config/test.txt
Normal file
@@ -0,0 +1 @@
|
||||
package com.example.demo;
|
||||
Reference in New Issue
Block a user