commit fdf977246da21dbc06aa6ec9fa2e2192213accf6 Author: kalmenn Date: Mon Dec 18 09:11:00 2023 +0100 switched to a submodule diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..d79b525 --- /dev/null +++ b/init.lua @@ -0,0 +1,22 @@ +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 + +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({ { import = "plugins" } }) + +require("sets") +require("remaps") + +vim.notify("starting nvim 🏕️") diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..b185a12 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,17 @@ +{ + "barbar.nvim": { "branch": "master", "commit": "a8fe0abe538f15997a543e0f653993ef3727455f" }, + "fd": { "branch": "master", "commit": "00b64f3ccbfb832ef744bb42bbdfabaf929b5ee2" }, + "feline.nvim": { "branch": "main", "commit": "a6bebd903e84d5ce0e97c597e0ca85cd24109002" }, + "gitsigns.nvim": { "branch": "main", "commit": "d195f0c35ced5174d3ecce1c4c8ebb3b5bc23fa9" }, + "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "230ff118613fa07138ba579b89d13ec2201530b9" }, + "nui.nvim": { "branch": "main", "commit": "c9b4de623d19a85b353ff70d2ae9c77143abe69c" }, + "nvim": { "branch": "main", "commit": "079500a625f3ae5aa6efb758f1a17fe4c7a57e52" }, + "nvim-lspconfig": { "branch": "master", "commit": "e50a8fcd6267cb9b2d2a880dcf3a8ac113b75abc" }, + "nvim-treesitter": { "branch": "master", "commit": "25ddfde8d7167d7d81403d6809242439037d2b68" }, + "nvim-web-devicons": { "branch": "master", "commit": "a1425903ab52a0a0460622519e827f224e5b4fee" }, + "plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" }, + "ripgrep": { "branch": "master", "commit": "3f2fe0afee0d1a1eeb3235904cfef4f35c4644dc" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }, + "undotree": { "branch": "master", "commit": "36ff7abb6b60980338344982ad4cdf03f7961ecd" } +} \ No newline at end of file diff --git a/lua/plugins/barbar.lua b/lua/plugins/barbar.lua new file mode 100644 index 0000000..2cc89d6 --- /dev/null +++ b/lua/plugins/barbar.lua @@ -0,0 +1,13 @@ +return { 'romgrk/barbar.nvim', + dependencies = { + 'lewis6991/gitsigns.nvim', -- OPTIONAL: for git status + 'nvim-tree/nvim-web-devicons', -- OPTIONAL: for file icons + }, + init = function() vim.g.barbar_auto_setup = false end, + opts = { + -- lazy.nvim will automatically call setup for you. put your options here, anything missing will use the default: + -- animation = true, + -- insert_at_start = true, + -- …etc. + }, +} diff --git a/lua/plugins/catppuccin.lua b/lua/plugins/catppuccin.lua new file mode 100644 index 0000000..a2e2668 --- /dev/null +++ b/lua/plugins/catppuccin.lua @@ -0,0 +1,13 @@ +return { { + "catppuccin/nvim", + priority = 1000, + config = function() + require("catppuccin").setup({ + flavour = "mocha", + integrations = { + treesitter = false, + }, + }) + vim.cmd.colorscheme("catppuccin") + end +} } diff --git a/lua/plugins/feline.lua b/lua/plugins/feline.lua new file mode 100644 index 0000000..36ac3c8 --- /dev/null +++ b/lua/plugins/feline.lua @@ -0,0 +1,11 @@ +return { + 'freddiehaddad/feline.nvim', + opts = {}, + config = function(_, opts) + require('feline').setup() + -- require('feline').winbar.setup() -- to use winbar + require('feline').statuscolumn.setup() -- to use statuscolumn + + -- require('feline').use_theme() -- to use a custom theme + end +} diff --git a/lua/plugins/gitsigns.lua b/lua/plugins/gitsigns.lua new file mode 100644 index 0000000..3adbda8 --- /dev/null +++ b/lua/plugins/gitsigns.lua @@ -0,0 +1,11 @@ +return { + "lewis6991/gitsigns.nvim", + config = function() + require("gitsigns").setup({ + current_line_blame = true, + yadm = { + enable = true, + }, + }) + end +} diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua new file mode 100644 index 0000000..f8152e7 --- /dev/null +++ b/lua/plugins/lsp.lua @@ -0,0 +1,58 @@ +vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('UserLspConfig', {}), + callback = function(ev) + -- Enable completion triggered by + vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc' + + -- Buffer local mappings. + -- See `:help vim.lsp.*` for documentation on any of the below functions + local opts = { buffer = ev.buf } + vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) + vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) + vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts) + vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts) + vim.keymap.set('n', '', vim.lsp.buf.signature_help, opts) + vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, opts) + vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, opts) + vim.keymap.set('n', 'wl', function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, opts) + vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, opts) + vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) + vim.keymap.set({ 'n', 'v' }, 'ca', vim.lsp.buf.code_action, opts) + vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) + vim.keymap.set('n', 'f', function() + vim.lsp.buf.format { async = true } + end, opts) + end, +}) + +return { + "neovim/nvim-lspconfig", + config = function() + local lspconfig = require("lspconfig") + + lspconfig.pyright.setup({}) + + lspconfig.rust_analyzer.setup({}) + + lspconfig.lua_ls.setup({ + settings = { + Lua = { + runtime = { + -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) + version = "LuaJIT", + }, + workspace = { + -- Make the server aware of Neovim runtime files + library = vim.api.nvim_get_runtime_file("", true), + }, + -- Do not send telemetry data containing a randomized but unique identifier + telemetry = { + enable = false, + }, + }, + }, + }) + end +} diff --git a/lua/plugins/neo-tree.lua b/lua/plugins/neo-tree.lua new file mode 100644 index 0000000..b547928 --- /dev/null +++ b/lua/plugins/neo-tree.lua @@ -0,0 +1,32 @@ +-- TODO: set keymaps + +return { + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended + "MunifTanjim/nui.nvim", + -- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information + }, + lazy = false, + config = function() + require('neo-tree').setup({ + filesystem = { + filtered_items = { + visible = true, + }, + }, + window = { + position = "right", + width = 30, + }, + }) + end, + keys = { + { "t", "Neotree toggle", "Toggle Neotree" }, + { "f", "Neotree filesystem focus", "Focus filesystem in Neotree" }, + { "b", "Neotree buffers focus", "Focus buffers in Neotree" }, + { "g", "Neotree git_status focus", "Focus git status in Neotree" }, + }, +} diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua new file mode 100644 index 0000000..f1f63b7 --- /dev/null +++ b/lua/plugins/telescope.lua @@ -0,0 +1,16 @@ +return { + "nvim-telescope/telescope.nvim", + branch = "0.1.x", + dependencies = { + "BurntSushi/ripgrep", + "nvim-lua/plenary.nvim", + "sharkdp/fd", + "nvim-treesitter/nvim-treesitter", + "nvim-tree/nvim-web-devicons", + }, + keys = { + { "f", "Telescope find_files", desc = "Fuzzy find files with Telescope" }, + { "", "Telescope find_files", desc = "Fuzzy find files with Telescope" }, + { "b", "Telescope buffers", desc = "Fuzzy find open buffers with Telescope" }, + } +} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua new file mode 100644 index 0000000..210677f --- /dev/null +++ b/lua/plugins/treesitter.lua @@ -0,0 +1,16 @@ +return { + "nvim-treesitter/nvim-treesitter", + config = function() + require('nvim-treesitter.configs').setup({ + modules = {}, + ensure_installed = { "lua", "rust" }, + sync_install = false, + auto_install = true, + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, + ignore_install = {}, + }) + end +} diff --git a/lua/plugins/undotree.lua b/lua/plugins/undotree.lua new file mode 100644 index 0000000..90aa1b9 --- /dev/null +++ b/lua/plugins/undotree.lua @@ -0,0 +1,12 @@ +return { + "mbbill/undotree", + keys = { + { + "", + function() + vim.cmd.UndotreeToggle(); + vim.cmd.UndotreeFocus(); + end + }, + }, +} diff --git a/lua/remaps.lua b/lua/remaps.lua new file mode 100644 index 0000000..3c9fd6f --- /dev/null +++ b/lua/remaps.lua @@ -0,0 +1,12 @@ +-- move selected lines and auto indent + +vim.keymap.set("v", "", ":m '>+1gv=gv") +vim.keymap.set("v", "", ":m '<-2gv=gv") + +-- zz centers the cursor + +vim.keymap.set("n", "", "zz") +vim.keymap.set("n", "", "zz") + +vim.keymap.set("n", "n", "nzzzv") +vim.keymap.set("n", "N", "Nzzzv") diff --git a/lua/sets.lua b/lua/sets.lua new file mode 100644 index 0000000..f467a90 --- /dev/null +++ b/lua/sets.lua @@ -0,0 +1,39 @@ +-- line numbers + +vim.o.number = true +vim.o.relativenumber = true + +-- show hidden characters +vim.opt.list = true +vim.opt.listchars = { tab = '→ ', trail = '·' } + +-- indentation +vim.opt.expandtab = true +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.smartindent = true + +-- line wrapping +vim.opt.wrap = false + +-- undo history +vim.opt.swapfile = false +vim.opt.backup = false +vim.opt.undodir = os.getenv("HOME") .. "/.local/state/nvim/undodir" +vim.opt.undofile = true +vim.opt.updatetime = 50 + +-- end search when exiting +vim.opt.hlsearch = false +vim.opt.incsearch = true + +-- stuff + +vim.opt.fillchars:append({ eob = ' ' }) + +vim.opt.termguicolors = true + +vim.opt.scrolloff = 8 + +vim.opt.colorcolumn = "80" diff --git a/stylua.toml b/stylua.toml new file mode 100644 index 0000000..f7eadb0 --- /dev/null +++ b/stylua.toml @@ -0,0 +1,4 @@ +indent_type = "Spaces" +indent_width = 4 +column_width = 120 +quote_style = "ForceDouble"