From c0ee49298161bccb75b9e23ed64fe80aacec2fd4 Mon Sep 17 00:00:00 2001 From: mhsn Date: Sat, 23 Nov 2024 17:40:44 +0000 Subject: Initial commit --- lua/config/keymap.lua | 14 ++++++++++++++ lua/config/lazy.lua | 28 ++++++++++++++++++++++++++++ lua/config/opt.lua | 26 ++++++++++++++++++++++++++ lua/plugins/colors.lua | 10 ++++++++++ lua/plugins/conform.lua | 11 +++++++++++ lua/plugins/general.lua | 42 ++++++++++++++++++++++++++++++++++++++++++ lua/plugins/lsp.lua | 24 ++++++++++++++++++++++++ 7 files changed, 155 insertions(+) create mode 100644 lua/config/keymap.lua create mode 100644 lua/config/lazy.lua create mode 100644 lua/config/opt.lua create mode 100644 lua/plugins/colors.lua create mode 100644 lua/plugins/conform.lua create mode 100644 lua/plugins/general.lua create mode 100644 lua/plugins/lsp.lua (limited to 'lua') diff --git a/lua/config/keymap.lua b/lua/config/keymap.lua new file mode 100644 index 0000000..cfe0692 --- /dev/null +++ b/lua/config/keymap.lua @@ -0,0 +1,14 @@ +-- Leaders +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" + +-- Move lines up/down in visual mode +vim.keymap.set("v", "J", ":m '>+1gv=gv") +vim.keymap.set("v", "K", ":m '<-2gv=gv") + +-- Keep cursor position when joining +vim.keymap.set("n", "J", "mzJ`z") + +-- Center search terms +vim.keymap.set("n", "n", "nzz") +vim.keymap.set("n", "N", "Nzz") diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua new file mode 100644 index 0000000..7e90925 --- /dev/null +++ b/lua/config/lazy.lua @@ -0,0 +1,28 @@ +-- 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) + +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + -- import your plugins + { import = "plugins" }, + }, + -- Configure any other settings here. See the documentation for more details. + -- colorscheme that will be used when installing plugins. + install = { colorscheme = { "habamax" } }, + checker = { enabled = false }, +}) diff --git a/lua/config/opt.lua b/lua/config/opt.lua new file mode 100644 index 0000000..60b1d5b --- /dev/null +++ b/lua/config/opt.lua @@ -0,0 +1,26 @@ +-- Relative line numbers +vim.opt.number = true +vim.opt.relativenumber = true + +-- 4 space tabs +vim.opt.tabstop = 4 +vim.opt.softtabstop = 0 +vim.opt.shiftwidth = 4 +vim.opt.smarttab = true + +-- Smart indenting +vim.opt.autoindent = true +vim.opt.smartindent = true + +-- No line wrap +vim.opt.wrap = false + +-- Search highlighting +vim.opt.hlsearch = false +vim.opt.incsearch = true + +-- Keep 9 lines on top/bottom +vim.opt.scrolloff = 9 + +-- 80 char col +vim.opt.colorcolumn = "80" diff --git a/lua/plugins/colors.lua b/lua/plugins/colors.lua new file mode 100644 index 0000000..1c44296 --- /dev/null +++ b/lua/plugins/colors.lua @@ -0,0 +1,10 @@ +return { + { + "sainnhe/gruvbox-material", + lazy = false, + priority = 1000, + config = function() + vim.cmd([[colorscheme gruvbox-material]]) + end, + }, +} diff --git a/lua/plugins/conform.lua b/lua/plugins/conform.lua new file mode 100644 index 0000000..2751524 --- /dev/null +++ b/lua/plugins/conform.lua @@ -0,0 +1,11 @@ +return { + { + "stevearc/conform.nvim", + config = function() + require("conform").setup({ + formatters_by_ft = { lua = { "stylua" } }, + format_on_save = { timeout_ms = 500, lsp_format = "fallback" }, + }) + end, + }, +} diff --git a/lua/plugins/general.lua b/lua/plugins/general.lua new file mode 100644 index 0000000..ee08d88 --- /dev/null +++ b/lua/plugins/general.lua @@ -0,0 +1,42 @@ +return { + { + "nvim-tree/nvim-tree.lua", + version = "*", + lazy = false, + dependencies = { + "nvim-tree/nvim-web-devicons", + }, + keys = { + { "e", "NvimTreeFocus", desc = "NvimTree focus" }, + }, + config = function() + require("nvim-tree").setup({}) + end, + }, + { + "nvim-telescope/telescope.nvim", + tag = "0.1.8", + keys = { + { "", "Telescope find_files", desc = "Telescope find files" }, + }, + }, + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + config = function() + require("nvim-treesitter.configs").setup({ + ensure_installed = { "lua" }, + sync_install = false, + highlight = { enable = true }, + indent = { enable = true }, + }) + end, + }, + { + "ledger/vim-ledger", + version = "*", + config = function() + vim.g.ledger_fuzzy_account_completion = 1 + end, + }, +} diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua new file mode 100644 index 0000000..66a7e76 --- /dev/null +++ b/lua/plugins/lsp.lua @@ -0,0 +1,24 @@ +return { + { + "neovim/nvim-lspconfig", + }, + { + "williamboman/mason.nvim", + config = function() + require("mason").setup() + end, + }, + { + "williamboman/mason-lspconfig.nvim", + dependencies = { "mason.nvim" }, + config = function() + require("mason-lspconfig").setup({ + handlers = { + function(lsp) + require("lspconfig")[lsp].setup({}) + end, + }, + }) + end, + }, +} -- cgit v1.2.3