From e74fd4c1a559a196b540f90791e01c30ad00b034 Mon Sep 17 00:00:00 2001 From: Jovan Djokic-Sumarac Date: Mon, 28 Jul 2025 23:23:50 +0200 Subject: [PATCH] initial commit --- init.lua | 5 +++ lua/colors.lua | 53 ++++++++++++++++++++++++++ lua/keymap.lua | 41 +++++++++++++++++++++ lua/lsp.lua | 98 +++++++++++++++++++++++++++++++++++++++++++++++++ lua/options.lua | 44 ++++++++++++++++++++++ lua/plug.lua | 76 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 317 insertions(+) create mode 100644 init.lua create mode 100644 lua/colors.lua create mode 100644 lua/keymap.lua create mode 100644 lua/lsp.lua create mode 100644 lua/options.lua create mode 100644 lua/plug.lua diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..551c75f --- /dev/null +++ b/init.lua @@ -0,0 +1,5 @@ +require "plug" +require "colors" +require "options" +require "keymap" +require "lsp" diff --git a/lua/colors.lua b/lua/colors.lua new file mode 100644 index 0000000..30a5e76 --- /dev/null +++ b/lua/colors.lua @@ -0,0 +1,53 @@ +local espresso = require('catppuccin') + +local color_overrides = { + macchiato = { + rosewater = '#F5B8AB', + flamingo = '#F29D9D', + pink = '#AD6FF7', + mauve = '#FF8F40', + red = '#E66767', + maroon = '#EB788B', + peach = '#FAB770', + yellow = '#FACA64', + green = '#70CF67', + teal = '#4CD4BD', + sky = '#61BDFF', + sapphire = '#4BA8FA', + blue = '#00BFFF', + lavender = '#00BBCC', + text = '#C1C9E6', + subtext1 = '#A3AAC2', + subtext0 = '#8E94AB', + overlay2 = '#7D8296', + overlay1 = '#676B80', + overlay0 = '#464957', + surface2 = '#3A3D4A', + surface1 = '#2F313D', + surface0 = '#1D1E29', + base = '#0b0b0b', + mantle = '#11111a', + crust = '#191926', + }, +} + +local integrations = { + cmp = true, + gitsigns = true, + treesitter = true, + telescope = { + enabled = true, + style = 'nvchad', + }, + mini = { + enabled = true, + }, +} + +espresso.setup({ + flavour = 'macchiato', + color_overrides = color_overrides, + integrations = integrations, +}) + + diff --git a/lua/keymap.lua b/lua/keymap.lua new file mode 100644 index 0000000..fa22e07 --- /dev/null +++ b/lua/keymap.lua @@ -0,0 +1,41 @@ +-- Normal mode mappings +vim.keymap.set('n', 'gd', vim.lsp.buf.hover, { noremap = true }) +vim.keymap.set('n', 'tw', function() MiniTrailspace.trim() end, { noremap = true }) + +-- Terminal and buffer mappings +vim.keymap.set('n', 'tt', 'terminal', { noremap = true }) +vim.keymap.set('t', '', '', { noremap = true }) +vim.keymap.set('n', '', 'bprev', { noremap = true }) + +-- Move selected text up/down in visual mode +vim.keymap.set('v', 'J', ":m '>+1gv=gv", { noremap = true }) +vim.keymap.set('v', 'K', ":m '<-2gv=gv", { noremap = true }) + +-- Keep cursor in the middle when jumping or joining lines +vim.keymap.set('n', 'J', 'mzJ`z', { noremap = true }) +vim.keymap.set('n', '', 'zz', { noremap = true }) +vim.keymap.set('n', '', 'zz', { noremap = true }) +vim.keymap.set('n', 'n', 'nzzzv', { noremap = true }) +vim.keymap.set('n', 'N', 'Nzzzv', { noremap = true }) + +-- Interface with system clipboard in normal, visual, and select modes +vim.keymap.set({ 'n', 'v', 'x' }, 'y', '\'+y', { noremap = true, silent = true }) +vim.keymap.set({ 'n', 'v', 'x' }, 'Y', '\'+yy', { noremap = true, silent = true }) +vim.keymap.set({ 'n', 'v', 'x' }, 'p', '\'+p', { noremap = true, silent = true }) + + + + +vim.keymap.set('n', 'ff', ':Pick files') +vim.keymap.set('n', 'fb', ':Pick buffers') +vim.keymap.set('n', 'h', ':Pick help') +vim.keymap.set('n', 'e', ':Oil') +vim.keymap.set('n', 'lf', vim.lsp.buf.format) + +vim.keymap.set('n', 'o', ':update :source') +vim.keymap.set('n', 'w', ':write') +vim.keymap.set('n', 'q', ':quit') + +vim.keymap.set({ 'n', 'v', 'x' }, 'y', "'+y") +vim.keymap.set({ 'n', 'v', 'x' }, 'd', "'+d") + diff --git a/lua/lsp.lua b/lua/lsp.lua new file mode 100644 index 0000000..244556f --- /dev/null +++ b/lua/lsp.lua @@ -0,0 +1,98 @@ +local configs = require('nvim-treesitter.configs') + +configs.setup({ + ensure_installed = { + 'c', + 'bash', + 'c_sharp', + 'fennel', + 'go', + 'haskell', + 'lua', + 'python', + 'query', + 'rust', + 'vim', + 'vimdoc', + 'hyprlang', + }, + sync_install = false, + auto_install = true, + highlight = { + enable = true, + }, +}) + +vim.filetype.add({ + pattern = { + ['.*/hypr/.*%.conf'] = 'hyprlang', + }, +}) + +vim.filetype.add({ + pattern = { + ['*.tex'] = 'latex', + }, +}) + +local mason = require("mason") +mason.setup() + +local mason_lspconfig = require("mason-lspconfig") +mason_lspconfig.setup({ + ensure_installed = { + "fennel_ls", + "lua_ls", + "pylsp", + "ltex", + "zls", + "rust_analyzer", + }, + automatic_installation = true, +}) + +-- vim.api.nvim_create_autocmd('LspAttach', { +-- callback = function(ev) +-- local client = vim.lsp.get_client_by_id(ev.data.client_id) +-- if client:supports_method('textDocument/completion') then +-- vim.lsp.completion.enable(true, client.id, ev.buf, { autotrigger = true }) +-- end +-- end, +-- }) +-- vim.cmd('set completeopt+=noselect') +-- +require 'nvim-treesitter.configs'.setup({ + ensure_installed = { 'lua' }, + highlight = { enable = true } +}) + +vim.lsp.enable({ 'lua_ls' }) + + +require "blink.cmp".setup({ + keymap = { + preset = 'enter', + + [''] = { 'select_prev', 'fallback' }, + [''] = { 'select_next', 'fallback' }, + + -- disable a keymap from the preset + [''] = false, -- or {} + + -- show with a list of providers + [''] = { function(cmp) cmp.show({ providers = { 'snippets' } }) end }, + + }, + appearance = { + nerd_font_variant = 'normal' + }, + completion = { + documentation = { auto_show = true } + }, + sources = { + default = { 'lsp', 'path', 'snippets', 'buffer' }, + }, + fuzzy = { + implementation = "prefer_rust_with_warning" + }, +}) diff --git a/lua/options.lua b/lua/options.lua new file mode 100644 index 0000000..8b5a8ec --- /dev/null +++ b/lua/options.lua @@ -0,0 +1,44 @@ +vim.g.mapleader = ' ' +vim.o.autoindent = true +vim.o.backup = false +vim.o.clipboard = 'unnamedplus' +-- vim.o.cmdheight = 0 +vim.o.compatible = false +vim.o.cursorline = true +vim.o.expandtab = true +vim.o.hlsearch = true +vim.o.ignorecase = true +vim.o.inccommand = 'split' +vim.o.incsearch = true +vim.o.list = true +vim.o.mouse = 'a' +vim.o.mouse = 'v' +vim.o.number = true +vim.o.relativenumber = true +vim.o.shiftwidth = 4 +vim.o.showmatch = true +vim.o.signcolumn = 'yes' +-- vim.o.signcolumn = 'yes:1' +vim.o.smartindent = true +vim.o.smarttab = false +vim.o.softtabstop = 4 +vim.o.splitbelow = true +vim.o.splitkeep = 'screen' +vim.o.splitright = true +vim.o.startofline = false +vim.o.swapfile = false +vim.o.tabstop = 4 +vim.o.termguicolors = true +vim.o.ttyfast = true +vim.o.undofile = true +vim.o.wildmode = 'longest,list' +vim.o.winborder = 'rounded' +vim.o.wrap = false + +vim.o.background = 'dark' +vim.cmd.colorscheme('catppuccin') + +vim.api.nvim_set_hl(0, 'Normal', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'NormalFloat', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'FloatBorder', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'Pmenu', { bg = 'none' }) diff --git a/lua/plug.lua b/lua/plug.lua new file mode 100644 index 0000000..5a6de5c --- /dev/null +++ b/lua/plug.lua @@ -0,0 +1,76 @@ +vim.pack.add({ + { src = 'https://github.com/catppuccin/nvim' }, + { src = 'https://github.com/stevearc/oil.nvim' }, + { src = 'https://github.com/echasnovski/mini.pick' }, + { src = 'https://github.com/echasnovski/mini.cursorword' }, + { src = 'https://github.com/echasnovski/mini.starter' }, + { src = 'https://github.com/echasnovski/mini.trailspace' }, + { src = 'https://github.com/nvim-treesitter/nvim-treesitter' }, + { src = 'https://github.com/neovim/nvim-lspconfig' }, + { src = 'https://github.com/echasnovski/mini.nvim' }, + { src = 'https://github.com/nvim-lualine/lualine.nvim' }, + { src = 'https://github.com/nvim-tree/nvim-web-devicons' }, + { src = 'https://github.com/svampkorg/moody.nvim' }, + { src = 'https://github.com/svampkorg/moody.nvim' }, + { src = 'https://github.com/williamboman/mason.nvim' }, + { src = 'https://github.com/williamboman/mason-lspconfig.nvim' }, + { src = 'https://github.com/Saghen/blink.cmp', version = "v1.6.0" }, + { src = 'https://github.com/rafamadriz/friendly-snippets' } +}) + +-- vim.pack.update() + +-- Conceal 'lambda' with 'λ' +vim.cmd([[syntax match keyword '\' conceal cchar=λ]]) +vim.opt.conceallevel = 1 + +-- List of default plugins to disable +local default_plugins = { + '2html_plugin', + 'getscript', + 'getscriptPlugin', + 'gzip', + 'logipat', + 'netrw', + 'netrwPlugin', + 'netrwSettings', + 'netrwFileHandlers', + 'matchit', + 'tar', + 'tarPlugin', + 'rrhelper', + 'spellfile_plugin', + 'vimball', + 'vimballPlugin', + 'zip', + 'zipPlugin', + 'tutor', + 'rplugin', + 'syntax', + 'synmenu', + 'optwin', + 'compiler', + 'bugreport', + 'ftplugin' +} + +for _, plug in ipairs(default_plugins) do + vim.g['loaded_' .. plug] = 1 +end + + +require 'mini.pick'.setup() +require 'mini.cursorword'.setup() +require 'mini.starter'.setup() +require 'mini.trailspace'.setup() +require 'moody'.setup() +require 'oil'.setup() + + +require('lualine').setup({ + options = { + section_separators = { left = '', right = '' }, + component_separators = { left = '', right = '' }, + } +}) +