diff options
author | Matthew Lemon <y@yulqen.org> | 2023-04-07 18:06:20 +0100 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2023-04-07 18:06:20 +0100 |
commit | 6ad9ebb4d05d0f5de73a76b81464db2b673251d0 (patch) | |
tree | 382c545829302449478f0a31c1b2c815c5b446af /nvim/lua | |
parent | 8074753daaad059e407dbb0dae05206ef5f510a3 (diff) |
Adds first neovim config for several years
I copied ThePrimeagen setting up neovim based on his repository at
https://github.com/ThePrimeagen/init.lua. The video itself is at
https://www.youtube.com/watch?v=w7i4amO_zaE.
I tried following each step based on the video, but I for some reason
autocomplete did not work properly after a while. So I cloned his repo
and adapted it to some extent to make it more in line with what I need.
This is an early state, but autocomplete works. There is much to do to
mirror my vimrc, if I am going to go down that route.
Diffstat (limited to '')
-rw-r--r-- | nvim/lua/lemon/init.lua | 7 | ||||
-rw-r--r-- | nvim/lua/lemon/packer.lua | 74 | ||||
-rw-r--r-- | nvim/lua/lemon/remap.lua | 44 | ||||
-rw-r--r-- | nvim/lua/lemon/set.lua | 32 |
4 files changed, 157 insertions, 0 deletions
diff --git a/nvim/lua/lemon/init.lua b/nvim/lua/lemon/init.lua new file mode 100644 index 0000000..e2266b2 --- /dev/null +++ b/nvim/lua/lemon/init.lua @@ -0,0 +1,7 @@ +require("lemon.set") +require("lemon.remap") +require("lemon.packer") + +vim.g.netrw_browse_split = 0 +vim.g.netrw_banner = 0 +vim.g.netrw_winsize = 25 diff --git a/nvim/lua/lemon/packer.lua b/nvim/lua/lemon/packer.lua new file mode 100644 index 0000000..61948cf --- /dev/null +++ b/nvim/lua/lemon/packer.lua @@ -0,0 +1,74 @@ +-- This file can be loaded by calling `lua require('plugins')` from your init.vim + +-- Only required if you have packer configured as `opt` +vim.cmd.packadd('packer.nvim') + +return require('packer').startup(function(use) + -- Packer can manage itself + use 'wbthomason/packer.nvim' + + use { + 'nvim-telescope/telescope.nvim', tag = '0.1.0', + -- or , branch = '0.1.x', + requires = { {'nvim-lua/plenary.nvim'} } + } + + use({ + 'rose-pine/neovim', + as = 'rose-pine', + config = function() + vim.cmd('colorscheme rose-pine') + end + }) + + use({ + "folke/trouble.nvim", + config = function() + require("trouble").setup { + icons = false, + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + } + end + }) + + + use({"nvim-treesitter/nvim-treesitter", run = ":TSUpdate"}) + use("nvim-treesitter/playground") + use("theprimeagen/harpoon") +-- use("theprimeagen/refactoring.nvim") + use("mbbill/undotree") + use("tpope/vim-fugitive") + use("nvim-treesitter/nvim-treesitter-context"); + + use { + 'VonHeikemen/lsp-zero.nvim', + branch = 'v1.x', + requires = { + -- LSP Support + {'neovim/nvim-lspconfig'}, + {'williamboman/mason.nvim'}, + {'williamboman/mason-lspconfig.nvim'}, + + -- Autocompletion + {'hrsh7th/nvim-cmp'}, + {'hrsh7th/cmp-buffer'}, + {'hrsh7th/cmp-path'}, + {'saadparwaiz1/cmp_luasnip'}, + {'hrsh7th/cmp-nvim-lsp'}, + {'hrsh7th/cmp-nvim-lua'}, + + -- Snippets + {'L3MON4D3/LuaSnip'}, + {'rafamadriz/friendly-snippets'}, + } + } + + use("folke/zen-mode.nvim") + use("github/copilot.vim") + use("eandrju/cellular-automaton.nvim") +-- use("laytan/cloak.nvim") + +end) + diff --git a/nvim/lua/lemon/remap.lua b/nvim/lua/lemon/remap.lua new file mode 100644 index 0000000..3999c8a --- /dev/null +++ b/nvim/lua/lemon/remap.lua @@ -0,0 +1,44 @@ + +vim.g.mapleader = " " +vim.keymap.set("n", "<leader>pv", vim.cmd.Ex) + +vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv") +vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv") + +vim.keymap.set("n", "J", "mzJ`z") +vim.keymap.set("n", "<C-d>", "<C-d>zz") +vim.keymap.set("n", "<C-u>", "<C-u>zz") +vim.keymap.set("n", "n", "nzzzv") +vim.keymap.set("n", "N", "Nzzzv") + +-- greatest remap ever +vim.keymap.set("x", "<leader>p", [["_dP]]) + +-- next greatest remap ever : asbjornHaland +vim.keymap.set({"n", "v"}, "<leader>y", [["+y]]) +vim.keymap.set("n", "<leader>Y", [["+Y]]) + +vim.keymap.set({"n", "v"}, "<leader>d", [["_d]]) + +-- This is going to get me cancelled +vim.keymap.set("i", "<C-c>", "<Esc>") + +vim.keymap.set("n", "Q", "<nop>") +vim.keymap.set("n", "<C-f>", "<cmd>silent !tmux neww tmux-sessionizer<CR>") +-- vim.keymap.set("n", "<leader>f", vim.lsp.buf.format) + +vim.keymap.set("n", "<C-k>", "<cmd>cnext<CR>zz") +vim.keymap.set("n", "<C-j>", "<cmd>cprev<CR>zz") +vim.keymap.set("n", "<leader>k", "<cmd>lnext<CR>zz") +vim.keymap.set("n", "<leader>j", "<cmd>lprev<CR>zz") + +vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]]) +vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true }) + +vim.keymap.set("n", "<leader>ev", "<cmd>e ~/dotfiles/nvim/lua/lemon/packer.lua<CR>"); +vim.keymap.set("n", "<leader>mr", "<cmd>CellularAutomaton make_it_rain<CR>"); + +vim.keymap.set("n", "<leader><leader>", function() + vim.cmd("so") +end) + diff --git a/nvim/lua/lemon/set.lua b/nvim/lua/lemon/set.lua new file mode 100644 index 0000000..18acbf1 --- /dev/null +++ b/nvim/lua/lemon/set.lua @@ -0,0 +1,32 @@ +vim.opt.guicursor = "" + +vim.opt.nu = true +vim.opt.relativenumber = true + +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.expandtab = true + +vim.opt.smartindent = true + +vim.opt.wrap = false + +vim.opt.swapfile = false +vim.opt.backup = false +vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir" +vim.opt.undofile = true + +vim.opt.hlsearch = false +vim.opt.incsearch = true + +vim.opt.termguicolors = true + +vim.opt.scrolloff = 8 +vim.opt.signcolumn = "yes" +vim.opt.isfname:append("@-@") + +vim.opt.updatetime = 50 + +vim.opt.colorcolumn = "80" + |