summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormhsn <mail@mhsn.net>2024-11-23 17:40:44 +0000
committermhsn <mail@mhsn.net>2024-11-23 17:40:44 +0000
commitc0ee49298161bccb75b9e23ed64fe80aacec2fd4 (patch)
tree7effe9b25db4f355f54828980a60b5f99bd260b8
downloadnvim-c0ee49298161bccb75b9e23ed64fe80aacec2fd4.tar.gz
nvim-c0ee49298161bccb75b9e23ed64fe80aacec2fd4.zip
Initial commit
-rw-r--r--init.lua3
-rw-r--r--lazy-lock.json14
-rw-r--r--lua/config/keymap.lua14
-rw-r--r--lua/config/lazy.lua28
-rw-r--r--lua/config/opt.lua26
-rw-r--r--lua/plugins/colors.lua10
-rw-r--r--lua/plugins/conform.lua11
-rw-r--r--lua/plugins/general.lua42
-rw-r--r--lua/plugins/lsp.lua24
9 files changed, 172 insertions, 0 deletions
diff --git a/init.lua b/init.lua
new file mode 100644
index 0000000..de20a2c
--- /dev/null
+++ b/init.lua
@@ -0,0 +1,3 @@
+require("config.opt")
+require("config.keymap")
+require("config.lazy")
diff --git a/lazy-lock.json b/lazy-lock.json
new file mode 100644
index 0000000..71b3a91
--- /dev/null
+++ b/lazy-lock.json
@@ -0,0 +1,14 @@
+{
+ "conform.nvim": { "branch": "master", "commit": "62d5accad8b29d6ba9b58d3dff90c43a55621c60" },
+ "gruvbox-material": { "branch": "master", "commit": "170148af9350f578f3623f810e54698fa1e5bdbf" },
+ "lazy.nvim": { "branch": "main", "commit": "56ead98e05bb37a4ec28930a54d836d033cf00f2" },
+ "mason-lspconfig.nvim": { "branch": "main", "commit": "43894adcf10bb1190c2184bd7c1750e8ea2b3dce" },
+ "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
+ "nvim-lspconfig": { "branch": "master", "commit": "c646154d6e4db9b2979eeb517d0b817ad00c9c47" },
+ "nvim-tree.lua": { "branch": "master", "commit": "c7639482a1598f4756798df1b2d72f79fe5bb34f" },
+ "nvim-treesitter": { "branch": "master", "commit": "efb2e9c607cab1e4f7171493b7c6f63bd39073fc" },
+ "nvim-web-devicons": { "branch": "master", "commit": "f09be61d05bebcba85bb47be1931322d51b95644" },
+ "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
+ "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
+ "vim-ledger": { "branch": "master", "commit": "3d76cee270b1a9583d535737ac2e63166335d45c" }
+}
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 '>+1<CR>gv=gv")
+vim.keymap.set("v", "K", ":m '<-2<CR>gv=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 = {
+ { "<leader>e", "<cmd>NvimTreeFocus<cr>", desc = "NvimTree focus" },
+ },
+ config = function()
+ require("nvim-tree").setup({})
+ end,
+ },
+ {
+ "nvim-telescope/telescope.nvim",
+ tag = "0.1.8",
+ keys = {
+ { "<C-p>", "<cmd>Telescope find_files<cr>", 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,
+ },
+}