Skip to content

Instantly share code, notes, and snippets.

@dobrowins
Last active March 24, 2024 16:58
Show Gist options
  • Save dobrowins/e3041b8af22d8d0566ce0907b6eb9a00 to your computer and use it in GitHub Desktop.
Save dobrowins/e3041b8af22d8d0566ce0907b6eb9a00 to your computer and use it in GitHub Desktop.
init.lua
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
-- Sync clipboard between OS and Neovim.
-- Remove this option if you want your OS clipboard to remain independent.
-- See `:help 'clipboard'`
vim.o.clipboard = 'unnamedplus'
-- Enable break indent
vim.o.breakindent = true
-- Save undo history
vim.o.undofile = true
-- Case-insensitive searching UNLESS \C or capital in search
vim.o.ignorecase = true
vim.o.smartcase = true
-- bg
vim.o.background = "dark"
-- Decrease update time
vim.o.updatetime = 250
vim.o.timeoutlen = 300
-- show lines of code
vim.wo.nu = true
vim.wo.rnu = true
-- tabs
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
-- [[ Lazy ]]
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)
require("lazy").setup({
{ "catppuccin/nvim", name = "catppuccin", priority = 1000 },
{
'neovim/nvim-lspconfig',
dependencies = {
'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim',
}
},
-- Useful plugin to show you pending keybinds.
{ 'folke/which-key.nvim', opts = {} },
{
-- Fuzzy Finder (files, lsp, etc)
'nvim-telescope/telescope.nvim',
branch = '0.1.5',
dependencies = { 'nvim-lua/plenary.nvim' },
},
{
-- Highlight, edit, and navigate code
'nvim-treesitter/nvim-treesitter',
dependencies = { 'nvim-treesitter/nvim-treesitter-textobjects' },
build = ':TSUpdate',
},
{
'stevearc/oil.nvim',
opts = {},
dependencies = { 'nvim-tree/nvim-web-devicons' }
},
{
"ThePrimeagen/harpoon",
branch = "harpoon2",
dependencies = { "nvim-lua/plenary.nvim" }
}
}, opts)
-- [[ Plugins configs ]]
-- Mason
require('mason').setup()
require('mason-lspconfig').setup()
-- Oil
require('oil').setup({
default_file_explorer = true,
columns = {},
delete_to_trash = true,
})
-- Treesitter
require('nvim-treesitter.configs').setup({
highlight = { enable = true },
indent = { enable = true },
ensure_installed = {
'java', 'kotlin', 'markdown', 'python', 'lua', 'vim'
},
auto_install = true,
})
require('nvim-treesitter')
-- Harpoon
local harpoon = require('harpoon')
harpoon.setup()
vim.keymap.set("n", "<leader>a", function() harpoon:list():append() end)
vim.keymap.set("n", "<C-e>", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
vim.keymap.set('n', '-', '<CMD>Oil<CR>', { desc = 'Open parent directory' })
-- Telescope
local builtin = require('telescope.builtin')
require("telescope").setup()
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
-- [[ Theme ]]
require('catppuccin').setup()
vim.cmd('colorscheme catppuccin')
-- [[ Custom keymaps ]]
vim.keymap.set('n', '<C-D>', '<C-D>zz', { silent = true })
vim.keymap.set('n', '<C-U>', '<C-U>zz', { silent = true })
vim.keymap.set('n', '}', '}zz', { silent = true })
vim.keymap.set('n', '{', '{zz', { silent = true })
vim.keymap.set('i', 'jk', '<Esc>', { silent = true })
-- [[ Highlight on yank ]]
-- See `:help vim.highlight.on_yank()`
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
vim.api.nvim_create_autocmd('TextYankPost', {
callback = function()
vim.highlight.on_yank()
end,
group = highlight_group,
pattern = '*',
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment