From c5d4e4a23a397ae1dc68682734f2fe26d3adf0f0 Mon Sep 17 00:00:00 2001 From: "David T. Sadler" Date: Sat, 11 Feb 2023 12:51:08 +0000 Subject: Switched to lua and install various plugins --- .config/nvim/lua/dts/init.lua | 3 ++ .config/nvim/lua/dts/packer.lua | 70 +++++++++++++++++++++++++++++++++++++++++ .config/nvim/lua/dts/remap.lua | 57 +++++++++++++++++++++++++++++++++ .config/nvim/lua/dts/set.lua | 37 ++++++++++++++++++++++ 4 files changed, 167 insertions(+) create mode 100644 .config/nvim/lua/dts/init.lua create mode 100644 .config/nvim/lua/dts/packer.lua create mode 100644 .config/nvim/lua/dts/remap.lua create mode 100644 .config/nvim/lua/dts/set.lua (limited to '.config/nvim/lua/dts') diff --git a/.config/nvim/lua/dts/init.lua b/.config/nvim/lua/dts/init.lua new file mode 100644 index 0000000..dab3d06 --- /dev/null +++ b/.config/nvim/lua/dts/init.lua @@ -0,0 +1,3 @@ +-- require("dts.packer") +require("dts.set") +require("dts.remap") diff --git a/.config/nvim/lua/dts/packer.lua b/.config/nvim/lua/dts/packer.lua new file mode 100644 index 0000000..c00e63b --- /dev/null +++ b/.config/nvim/lua/dts/packer.lua @@ -0,0 +1,70 @@ +-- 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" + + -- Automatically add closing brackets, etc. + use { + "windwp/nvim-autopairs", + config = function() + require("nvim-autopairs").setup() + end + } + + -- Split and join arrays and methods. + use { + "AndrewRadev/splitjoin.vim", + config = function() + vim.g.splitjoin_html_attributes_bracket_on_new_line = 1 + vim.g.splitjoin_trailing_comma = 1 + vim.g.splitjoin_php_method_chain_full = 1 + end + } + + -- Automatically fix indentation when pasting. + use "sickill/vim-pasta" + + -- Fuzzy finder. + use { + "nvim-telescope/telescope.nvim", tag = "0.1.1", + requires = { {"nvim-lua/plenary.nvim"} } + } + + -- Colorscheme. + use "shaunsingh/nord.nvim" + + -- Treesitter. + use({"nvim-treesitter/nvim-treesitter", run = ":TSUpdate"}) + + -- Shows the context of the currently visible buffer contents. + use("nvim-treesitter/nvim-treesitter-context"); + + -- LSP. + 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-nvim-lsp"}, + {"hrsh7th/cmp-buffer"}, + {"hrsh7th/cmp-path"}, + {"saadparwaiz1/cmp_luasnip"}, + {"hrsh7th/cmp-nvim-lua"}, + + -- Snippets + {"L3MON4D3/LuaSnip"}, + {"rafamadriz/friendly-snippets"}, + } + } +end) + diff --git a/.config/nvim/lua/dts/remap.lua b/.config/nvim/lua/dts/remap.lua new file mode 100644 index 0000000..f26b792 --- /dev/null +++ b/.config/nvim/lua/dts/remap.lua @@ -0,0 +1,57 @@ +vim.g.mapleader = ' ' + +-- Allow moving of lines with Alt+j and Alt+k. +vim.keymap.set("n", "", ":m .+1==") +vim.keymap.set("n", "", ":m .-2==") +vim.keymap.set("i", "", ":m .+1==gi") +vim.keymap.set("i", "", ":m .-2==gi") +vim.keymap.set("v", "", ":m '>+1gv=gv") +vim.keymap.set("v", "", ":m '<-2gv=gv") + +-- Move between window splits with Ctrl+h, Ctrl+j, Ctrl+k, Ctrl+l +vim.keymap.set("n", "", ":wincmd h") +vim.keymap.set("n", "", ":wincmd j") +vim.keymap.set("n", "", ":wincmd k") +vim.keymap.set("n", "", ":wincmd l") +vim.keymap.set("i", "", ":wincmd h") +vim.keymap.set("i", "", ":wincmd j") +vim.keymap.set("i", "", ":wincmd k") +vim.keymap.set("i", "", ":wincmd l") + +-- Resize window splits with Ctrl+arrows. +vim.keymap.set("n", "", ":resize +2") +vim.keymap.set("n", "", ":resize -2") +vim.keymap.set("n", "", ":vertical resize +2") +vim.keymap.set("n", "", ":vertical resize -2") + +-- Keep cursor in the center of the window when doing half page jumping. +vim.keymap.set("n", "", "zz") +vim.keymap.set("n", "", "zz") + +-- Keep cursor in the center of the windows when moving through search results. +vim.keymap.set("n", "n", "nzzzv") +vim.keymap.set("n", "N", "Nzzzv") + +-- Stops replaced test from been copied. Preserves what was originally yanked. +vim.keymap.set("x", "p", [["_dP]]) +vim.keymap.set("n", "d", [["_d]]) + +-- Append line below to end of current line and do not move cursor to the end of the line. +vim.keymap.set("n", "J", "mzJ`z") + +-- Easy insertion of trailing ; or , in insert mode. +vim.keymap.set("i", ";;", "A;") +vim.keymap.set("i", ",,", "A,") + +-- Allow yanking into system clipboard. +vim.keymap.set({"n", "v"}, "y", [["+y]]) +vim.keymap.set("n", "Y", [["+Y]]) + +-- Globally replace word that cursor is on. +vim.keymap.set("n", "s", [[:%s/\<\>//gI]]) + +-- Toggle hidden characters. +vim.keymap.set("n", "l", function() + vim.opt.list = not(vim.opt.list:get()) +end) + diff --git a/.config/nvim/lua/dts/set.lua b/.config/nvim/lua/dts/set.lua new file mode 100644 index 0000000..07ad9dc --- /dev/null +++ b/.config/nvim/lua/dts/set.lua @@ -0,0 +1,37 @@ +-- EDITOR +vim.opt.shiftwidth = 4 +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 +vim.opt.expandtab = true +vim.opt.wrap = false +vim.opt.smartindent = true +vim.opt.number = true +vim.opt.relativenumber = true +vim.opt.list = false +vim.opt.listchars = { tab = "▸ ", trail = "·" } +vim.opt.fillchars:append({ eob = " " }) +vim.opt.splitbelow = true +vim.opt.splitright = true +vim.opt.scrolloff = 8 +vim.opt.sidescrolloff = 8 + +-- WINDOW APPEARANCE +vim.opt.title = true +vim.opt.termguicolors = true +vim.opt.mouse = "a" + +-- SEARCH +vim.opt.hlsearch = false +vim.opt.incsearch = true +vim.opt.ignorecase = true +vim.opt.smartcase = true + +-- SWAP FILES AND UNDO +vim.opt.swapfile = false +vim.opt.backup = false +vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir" +vim.opt.undofile = true + +-- MISC +vim.opt.wildmode = "longest:full,full" + -- cgit v1.2.3-13-gbd6f