Add .config/nvim/init.lua

Add .config/nvim/lazy-lock.json
Add .config/nvim/lua/nvim_is_strange/lazy.lua
Add .config/nvim/lua/nvim_is_strange/plugins/colorscheme.lua
Add .config/nvim/lua/nvim_is_strange/plugins/git.lua
Add .config/nvim/lua/nvim_is_strange/plugins/harpoon.lua
Add .config/nvim/lua/nvim_is_strange/plugins/lsp.lua
Add .config/nvim/lua/nvim_is_strange/plugins/statusline.lua
Add .config/nvim/lua/nvim_is_strange/plugins/telescope.lua
Add .config/nvim/lua/nvim_is_strange/plugins/treesitter.lua
Add .config/nvim/lua/nvim_is_strange/plugins/undotree.lua
Add .config/nvim/lua/nvim_is_strange/plugins/whichkey.lua
Add .config/nvim/lua/nvim_is_strange/remaps.lua
Add .config/nvim/lua/nvim_is_strange/set.lua
Add .config/nvim/spell/pl.cp1250.spl
Add .config/nvim/spell/pl.iso-8859-2.spl
Add .config/nvim/spell/pl.utf-8.spl
This commit is contained in:
2025-04-30 19:25:34 +02:00
parent 456281893a
commit d3bf78b74a
17 changed files with 497 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
vim.g.mapleader = " "
-- Bootstrap lazy.nvim
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)
vim.opt.rtp:prepend(vim.fn.stdpath("data") .. "/lazy/")
-- Setup lazy.nvim
require("lazy").setup({
spec = {
-- import your plugins
{ import = "nvim_is_strange.plugins" },
},
install = { colorscheme = { "minimal" } },
checker = { enabled = true },
ui = {
border = "rounded"
}
})

View File

@@ -0,0 +1,3 @@
return {
"Yazeed1s/minimal.nvim"
}

View File

@@ -0,0 +1,56 @@
return {
"lewis6991/gitsigns.nvim",
config = function()
require('gitsigns').setup {
signs = {
add = { text = '' },
change = { text = '' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
untracked = { text = '' },
},
signs_staged = {
add = { text = '' },
change = { text = '' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
untracked = { text = '' },
},
signs_staged_enable = true,
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
watch_gitdir = {
follow_files = true
},
auto_attach = true,
attach_to_untracked = false,
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
current_line_blame_opts = {
virt_text = true,
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
delay = 1000,
ignore_whitespace = false,
virt_text_priority = 100,
use_focus = true,
},
current_line_blame_formatter = '<author>, <author_time:%R> - <summary>',
sign_priority = 6,
update_debounce = 100,
status_formatter = nil, -- Use default
max_file_length = 40000, -- Disable if file is longer than this (in lines)
preview_config = {
-- Options passed to nvim_open_win
border = 'single',
style = 'minimal',
relative = 'cursor',
row = 0,
col = 1
},
}
end
}

View File

@@ -0,0 +1,48 @@
return {
"ThePrimeagen/harpoon",
branch = "harpoon2",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
local harpoon = require("harpoon")
-- REQUIRED
harpoon:setup()
-- REQUIRED
vim.keymap.set("n", "<leader>a", function() harpoon:list():add() end, { desc = "Add file to harpoon" })
vim.keymap.set("n", "<leader>r", function() harpoon:list():remove() end, { desc = "Remove file from harpoon" })
vim.keymap.set("n", "<C-e>", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
vim.keymap.set("n", "<C-h>", function() harpoon:list():select(1) end)
vim.keymap.set("n", "<C-j>", function() harpoon:list():select(2) end)
vim.keymap.set("n", "<C-k>", function() harpoon:list():select(3) end)
vim.keymap.set("n", "<C-l>", function() harpoon:list():select(4) end)
-- Toggle previous & next buffers stored within Harpoon list
vim.keymap.set("n", "<C-S-P>", function() harpoon:list():prev() end)
vim.keymap.set("n", "<C-S-N>", function() harpoon:list():next() end)
-- basic telescope configuration
local conf = require("telescope.config").values
local function toggle_telescope(harpoon_files)
local file_paths = {}
for _, item in ipairs(harpoon_files.items) do
table.insert(file_paths, item.value)
end
require("telescope.pickers").new({}, {
prompt_title = "Harpoon",
finder = require("telescope.finders").new_table({
results = file_paths,
}),
previewer = conf.file_previewer({}),
sorter = conf.generic_sorter({}),
}):find()
end
vim.keymap.set("n", "<C-e>", function() toggle_telescope(harpoon:list()) end,
{ desc = "Open harpoon window" })
end
}

View File

@@ -0,0 +1,182 @@
return {
'neovim/nvim-lspconfig',
dependencies = {
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
"hrsh7th/nvim-cmp",
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
"j-hui/fidget.nvim",
"numToStr/Comment.nvim",
"lukas-reineke/indent-blankline.nvim",
"kylechui/nvim-surround",
'm4xshen/autoclose.nvim',
"gbprod/phpactor.nvim",
"RRethy/vim-illuminate",
},
config = function()
local cmp_lsp = require("cmp_nvim_lsp")
local capabilities = vim.tbl_deep_extend(
"force",
{},
vim.lsp.protocol.make_client_capabilities(),
cmp_lsp.default_capabilities()
)
require("fidget").setup({})
require("mason").setup()
require('mason-lspconfig').setup({
ensure_installed = {
"lua_ls",
"intelephense",
"ts_ls",
"emmet_language_server",
"marksman",
"arduino_language_server",
},
handlers = { -- config lsp
function(server_name)
require("lspconfig")[server_name].setup({
capabilities = capabilities,
})
end,
lua_ls = function()
require('lspconfig').lua_ls.setup({
capabilities = capabilities,
settings = {
Lua = {
runtime = {
version = 'LuaJIT'
},
diagnostics = {
globals = { 'vim', 'love' },
},
workspace = {
library = {
vim.env.VIMRUNTIME,
}
}
}
}
})
end,
emmet_language_server = function()
require("lspconfig").emmet_language_server.setup({
filetypes = {
"html",
"css",
"js",
"php",
}
})
end,
marksman = function()
require("lspconfig").marksman.setup({
filetypes = {
"markdown",
}
})
end
}
})
local cmp = require("cmp")
local cmp_select = { behavior = cmp.SelectBehavior.Select }
require("luasnip.loaders.from_vscode").lazy_load()
cmp.setup({
sources = {
{ name = 'path' },
{ name = "nvim_lsp" },
{ name = "luasnip", keyword_lenght = 2 },
{ name = "buffer", keyword_lenght = 3 },
},
mapping = cmp.mapping.preset.insert({
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
['<C-y>'] = cmp.mapping.confirm({ select = true }),
}),
snippets = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
formatting = {
fields = { 'menu', 'abbr', 'kind' },
format = function(entry, item)
local menu_icon = {
nvim_lsp = 'λ',
luasnip = '',
buffer = 'Ω',
path = '🖫',
nvim_lua = 'Π',
}
item.menu = menu_icon[entry.source.name]
return item
end,
}
})
-- autoformat --
local buffer_autoformat = function(bufnr)
local group = 'lsp_autoformat'
vim.api.nvim_create_augroup(group, { clear = false })
vim.api.nvim_clear_autocmds({ group = group, buffer = bufnr })
vim.api.nvim_create_autocmd('BufWritePre', {
buffer = bufnr,
group = group,
desc = "LSP format on save",
callback = function()
vim.lsp.buf.format({ async = false, timeout_ms = 10000 })
end
})
end
vim.api.nvim_create_autocmd('LspAttach', {
callback = function(event)
local id = vim.tbl_get(event, 'data', 'client_id')
local client = id and vim.lsp.get_client_by_id(id)
if client == nil then
return
end
if client.supports_method('textDocument/formatting') then
buffer_autoformat(event.buf)
end
end
})
require("Comment").setup({
mappings = {
basic = true
},
opleader = {
line = '<leader>cl',
block = '<leader>cb',
}
})
require("ibl").setup()
require("nvim-surround").setup()
require("autoclose").setup()
end
}

View File

@@ -0,0 +1,11 @@
return {
"NTBBloodbath/galaxyline.nvim",
dependencies = {
"kyazdani42/nvim-web-devicons",
},
config = function()
require("galaxyline.themes.eviline")
end
}

View File

@@ -0,0 +1,4 @@
return {
'nvim-telescope/telescope.nvim', tag = '0.1.8',
dependencies = { 'nvim-lua/plenary.nvim' }
}

View File

@@ -0,0 +1,3 @@
return {
'nvim-treesitter/nvim-treesitter',
}

View File

@@ -0,0 +1,30 @@
return {
"jiaoshijie/undotree",
dependencies = "nvim-lua/plenary.nvim",
keys = { -- load the plugin only when using it's keybinding:
{ "<leader>u", "<cmd>lua require('undotree').toggle()<cr>", desc = "Show undotree" },
},
config = function()
require('undotree').setup({
float_diff = true, -- using float window previews diff, set this `true` will disable layout option
layout = "left_bottom", -- "left_bottom", "left_left_bottom"
position = "left", -- "right", "bottom"
ignore_filetype = { 'undotree', 'undotreeDiff', 'qf', 'TelescopePrompt', 'spectre_panel', 'tsplayground' },
window = {
winblend = 30,
},
keymaps = {
['j'] = "move_next",
['k'] = "move_prev",
['gj'] = "move2parent",
['J'] = "move_change_next",
['K'] = "move_change_prev",
['<cr>'] = "action_enter",
['p'] = "enter_diffbuf",
['q'] = "quit",
},
}
)
end
}

View File

@@ -0,0 +1,18 @@
return {
"folke/which-key.nvim",
event = "VeryLazy",
opts = {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
},
keys = {
{
"<leader>?",
function()
require("which-key").show({ global = false })
end,
desc = "Buffer Local Keymaps (which-key)",
},
},
}

View File

@@ -0,0 +1,30 @@
-- telescope --
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = 'Telescope find files' })
vim.keymap.set('n', '<leader>fg', builtin.git_files, { desc = 'Telescope find git' })
-- lsp --
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, { noremap = true, silent = true, desc = "Code action" })
vim.keymap.set('n', '<leader>cf', vim.lsp.buf.format, { desc = "Code format" })
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, { desc = "Go to definition" })
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, { desc = "Go to implementation" })
vim.keymap.set('n', '<leader>r', vim.lsp.buf.rename, { desc = "Rename symbol" })
-- move shit --
vim.keymap.set('x', '>', ">gv", { desc = "Move code right" })
vim.keymap.set('x', '<', "<gv", { desc = "Move code left" })
-- autosave in markdown--
vim.api.nvim_create_autocmd("InsertLeave", {
callback = function()
if vim.bo.modified and vim.bo.ft == "markdown" then
vim.cmd("w");
end
end
})
-- other --
vim.keymap.set('n', '<space>', '<Nop>')

View File

@@ -0,0 +1,45 @@
-- Kolorystyka
vim.cmd.colorscheme("minimal")
-- Wygląd
vim.opt.relativenumber = true
vim.opt.number = true
vim.opt.signcolumn = 'yes'
vim.opt.cursorline = false
-- Automatyczne podświetlanie skopiowanej linii po użyciu 'yy'
vim.api.nvim_create_augroup("YankHighlight", { clear = true })
vim.api.nvim_create_autocmd("TextYankPost", {
group = "YankHighlight",
callback = function()
vim.highlight.on_yank({ higroup = "IncSearch", timeout = 200 })
end,
})
-- Włącz widoczność whitespaces
vim.opt.list = true
-- Tabulatory i wcięcia
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
vim.opt.smartindent = true
-- Przewijanie i kursor
vim.opt.scrolloff = 8
vim.o.sidescrolloff = 8
vim.opt.cursorline = true
-- Wyszukiwanie
vim.opt.incsearch = true
vim.opt.hlsearch = false
-- Ogólne ustawienia
vim.opt.clipboard = "unnamedplus"
vim.opt.wrap = false
vim.opt.updatetime = 50
-- Język --
vim.opt.spell = true
vim.opt.spelllang = { 'pl', 'en' }