From 8bb6154263bfd539545d9730a695b4b18207b1e4 Mon Sep 17 00:00:00 2001 From: bob-ross27 <55351437+bob-ross27@users.noreply.github.com> Date: Sun, 8 Oct 2023 13:30:12 -0300 Subject: [PATCH] initial customization. --- init.lua | 32 ++++++------- lazy-lock.json | 43 +++++++++++++++++ lua/custom/plugins/init.lua | 89 ++++++++++++++++++++++++++++++++++- lua/custom/plugins/remaps.lua | 11 +++++ 4 files changed, 158 insertions(+), 17 deletions(-) create mode 100644 lazy-lock.json create mode 100644 lua/custom/plugins/remaps.lua diff --git a/init.lua b/init.lua index 11f55d05..a2cf46a6 100644 --- a/init.lua +++ b/init.lua @@ -150,15 +150,6 @@ require('lazy').setup({ }, }, - { - -- Theme inspired by Atom - 'navarasu/onedark.nvim', - priority = 1000, - config = function() - vim.cmd.colorscheme 'onedark' - end, - }, - { -- Set lualine as statusline 'nvim-lualine/lualine.nvim', @@ -166,7 +157,7 @@ require('lazy').setup({ opts = { options = { icons_enabled = false, - theme = 'onedark', + theme = 'dracula', component_separators = '|', section_separators = '', }, @@ -214,12 +205,11 @@ require('lazy').setup({ }, build = ':TSUpdate', }, - -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart -- These are some example plugins that I've included in the kickstart repository. -- Uncomment any of the lines below to enable them. -- require 'kickstart.plugins.autoformat', - -- require 'kickstart.plugins.debug', + require 'kickstart.plugins.debug', -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping @@ -227,7 +217,7 @@ require('lazy').setup({ -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. -- -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, }, {}) -- [[ Setting options ]] @@ -240,13 +230,16 @@ vim.o.hlsearch = false -- Make line numbers default vim.wo.number = true +-- Relative line numbers +vim.wo.relativenumber = true + -- Enable mouse mode vim.o.mouse = 'a' -- 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' +-- vim.o.clipboard = 'unnamedplus' -- Enable break indent vim.o.breakindent = true @@ -334,7 +327,6 @@ vim.defer_fn(function() require('nvim-treesitter.configs').setup { -- Add languages to be installed here that you want installed for treesitter ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim' }, - -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) auto_install = false, @@ -474,7 +466,8 @@ require('mason-lspconfig').setup() local servers = { -- clangd = {}, -- gopls = {}, - -- pyright = {}, + pyright = {}, + ruff_lsp = {}, -- rust_analyzer = {}, -- tsserver = {}, -- html = { filetypes = { 'html', 'twig', 'hbs'} }, @@ -560,5 +553,12 @@ cmp.setup { }, } +-- Set autoformatting using conform +vim.api.nvim_create_autocmd('BufWritePre', { + pattern = '*', + callback = function(args) + require('conform').format { bufnr = args.buf } + end, +}) -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 00000000..35c9c2f1 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,43 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, + "LuaSnip": { "branch": "master", "commit": "cdbf6f41381e5ee4810b4b09284b603d8f18365d" }, + "auto-pairs": { "branch": "master", "commit": "39f06b873a8449af8ff6a3eee716d3da14d63a76" }, + "bufferline.nvim": { "branch": "main", "commit": "357cc8f8eeb64702e6fcf2995e3b9becee99a5d3" }, + "cheatsheet.nvim": { "branch": "master", "commit": "9716f9aaa94dd1fd6ce59b5aae0e5f25e2a463ef" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, + "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, + "conform.nvim": { "branch": "master", "commit": "e75819642c36810a55a7235b6b5e16a5ce896ed3" }, + "dracula.nvim": { "branch": "main", "commit": "9fe831e685a76e1a1898a694623b33247c4d036c" }, + "fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" }, + "friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" }, + "git-messenger.vim": { "branch": "master", "commit": "8a61bdfa351d4df9a9118ee1d3f45edbed617072" }, + "gitsigns.nvim": { "branch": "main", "commit": "ff01d34daaed72f271a8ffa088a7e839a60c640f" }, + "indent-blankline.nvim": { "branch": "master", "commit": "877c1db2bf957300097dd5348a665666a4d900cb" }, + "lazy.nvim": { "branch": "main", "commit": "f0cfbf995238a42064e119bd1daa694fd1683ea3" }, + "lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "e2705063f395b44f676cd26596a11007a2cbd3bd" }, + "mason-nvim-dap.nvim": { "branch": "main", "commit": "6148b51db945b55b3b725da39eaea6441e59dff8" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "83dcddb6477f9ba5db98971ef27bd18bdca921b4" }, + "mason.nvim": { "branch": "main", "commit": "d66c60e17dd6fd8165194b1d14d21f7eb2c1697a" }, + "neodev.nvim": { "branch": "main", "commit": "f8592cc143a5512b98a2c3683aa43c73f98e34f7" }, + "nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" }, + "nvim-dap": { "branch": "master", "commit": "e79007c6d7a24db3ad19ea9196f1f0b2840e8ae7" }, + "nvim-dap-go": { "branch": "main", "commit": "a5cc8dcad43f0732585d4793deb02a25c4afb766" }, + "nvim-dap-ui": { "branch": "master", "commit": "34160a7ce6072ef332f350ae1d4a6a501daf0159" }, + "nvim-lspconfig": { "branch": "master", "commit": "2b361e043810d5587d9af0787f8ce40da92ec5e9" }, + "nvim-treesitter": { "branch": "master", "commit": "a102053352bd958d84a3e1be3de0203d2af92984" }, + "nvim-treesitter-context": { "branch": "master", "commit": "2095f231dfe796d228eedea96fdaa31f2e343fb2" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "76c7a89b41de77a4f83fb77fa072c5ad7605fe3b" }, + "nvim-web-devicons": { "branch": "master", "commit": "56b3a6ce6d69329cbf603dd38ac59fb4d7774b01" }, + "oil.nvim": { "branch": "master", "commit": "ac2928cca85ba3596e92f9f51940d46be2d606f8" }, + "plenary.nvim": { "branch": "master", "commit": "9ce85b0f7dcfe5358c0be937ad23e456907d410b" }, + "popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" }, + "refactoring.nvim": { "branch": "master", "commit": "bebfcfcc4b604d3647fcce2f4aeb02a95d139c49" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "54930e1abfc94409e1bb9266e752ef8379008592" }, + "vim-fugitive": { "branch": "master", "commit": "99db68d9b3304580bd383da7aaee05c7a954a344" }, + "vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" }, + "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, + "which-key.nvim": { "branch": "main", "commit": "7ccf476ebe0445a741b64e36c78a682c1c6118b7" }, + "zen-mode.nvim": { "branch": "main", "commit": "cb73b8bd0ef9d765b942db09dc762c603a89ae44" } +} \ No newline at end of file diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index be0eb9d8..48a3f7f8 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -2,4 +2,91 @@ -- I promise not to create any merge conflicts in this directory :) -- -- See the kickstart.nvim README for more information -return {} +return { + -- Dracula theme + { + 'Mofiqul/dracula.nvim', + priority = 1000, + config = function() + vim.cmd.colorscheme 'dracula' + end, + }, + + -- Zen Mode with :ZenMode + { + 'folke/zen-mode.nvim', + opts = { + window = { + width = 0.80, + }, + }, + }, + + -- Automatic formatting + { + 'stevearc/conform.nvim', + event = { 'BufWritePre' }, + cmd = { 'ConformInfo' }, + opts = { + formatters_by_ft = { + lua = { 'stylua' }, + python = { 'black' }, + }, + format_on_save = { timeout_ms = 500, lsp_fallback = true }, + }, + }, + + -- Maintain context (function name/loops) at top of buffer + 'nvim-treesitter/nvim-treesitter-context', + + -- Refactor support with :Refactor + { + 'ThePrimeagen/refactoring.nvim', + opts = {}, + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-treesitter/nvim-treesitter', + }, + }, + + -- Automatic bracket pairs + 'jiangmiao/auto-pairs', + + -- Edit files/directories as a buffer + { + 'stevearc/oil.nvim', + opts = {}, + dependencies = { 'nvim-tree/nvim-web-devicons' }, + }, + + -- Buffer tabs at top + { + 'akinsho/bufferline.nvim', + opts = {}, + dependencies = { 'nvim-tree/nvim-web-devicons' }, + }, + + -- Searchable command reference with :CheatSheet + { + 'sudormrfbin/cheatsheet.nvim', + dependencies = { + 'nvim-telescope/telescope.nvim', + 'nvim-lua/popup.nvim', + 'nvim-lua/plenary.nvim', + }, + }, + + -- Automatically install tools through Mason + { + 'WhoIsSethDaniel/mason-tool-installer.nvim', + opts = { + ensure_installed = { + 'black', + 'stylua', + }, + }, + }, + + -- Add inline git history in floating windows + 'rhysd/git-messenger.vim', +} diff --git a/lua/custom/plugins/remaps.lua b/lua/custom/plugins/remaps.lua new file mode 100644 index 00000000..23ecd627 --- /dev/null +++ b/lua/custom/plugins/remaps.lua @@ -0,0 +1,11 @@ +return { + vim.keymap.set('n', '', 'zz'), -- Center after half-page down + vim.keymap.set('n', '', 'zz'), -- Center after half-page up + vim.keymap.set('n', 'n', 'nzzzv'), -- Center after next result + vim.keymap.set('n', 'N', 'Nzzzv'), -- Center after previous result + vim.keymap.set('x', 'p', [["_dP]]), -- Paste without losing register + vim.keymap.set({ 'n', 'v' }, 'y', [["+y]]), -- Yank to OS clipboard + vim.keymap.set('n', 'Y', [["+Y]]), -- ???? + vim.keymap.set({ 'n', 'v' }, 'd', [["_d]]), -- ???? + vim.keymap.set('n', 'cm', vim.cmd.ZenMode, { desc = '[Z]en [M]ode' }), -- Toggle ZenMode +}