summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/dts
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua/dts')
-rw-r--r--.config/nvim/lua/dts/init.lua3
-rw-r--r--.config/nvim/lua/dts/packer.lua70
-rw-r--r--.config/nvim/lua/dts/remap.lua57
-rw-r--r--.config/nvim/lua/dts/set.lua37
4 files changed, 167 insertions, 0 deletions
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", "<A-j>", ":m .+1<CR>==")
+vim.keymap.set("n", "<A-k>", ":m .-2<CR>==")
+vim.keymap.set("i", "<A-j>", "<Esc>:m .+1<CR>==gi")
+vim.keymap.set("i", "<A-k>", "<Esc>:m .-2<CR>==gi")
+vim.keymap.set("v", "<A-j>", ":m '>+1<CR>gv=gv")
+vim.keymap.set("v", "<A-k>", ":m '<-2<CR>gv=gv")
+
+-- Move between window splits with Ctrl+h, Ctrl+j, Ctrl+k, Ctrl+l
+vim.keymap.set("n", "<C-h>", ":wincmd h<CR>")
+vim.keymap.set("n", "<C-j>", ":wincmd j<CR>")
+vim.keymap.set("n", "<C-k>", ":wincmd k<CR>")
+vim.keymap.set("n", "<C-l>", ":wincmd l<CR>")
+vim.keymap.set("i", "<C-h>", "<Esc>:wincmd h<CR>")
+vim.keymap.set("i", "<C-j>", "<Esc>:wincmd j<CR>")
+vim.keymap.set("i", "<C-k>", "<Esc>:wincmd k<CR>")
+vim.keymap.set("i", "<C-l>", "<Esc>:wincmd l<CR>")
+
+-- Resize window splits with Ctrl+arrows.
+vim.keymap.set("n", "<C-Up>", ":resize +2<CR>")
+vim.keymap.set("n", "<C-Down>", ":resize -2<CR>")
+vim.keymap.set("n", "<C-Left>", ":vertical resize +2<CR>")
+vim.keymap.set("n", "<C-Right>", ":vertical resize -2<CR>")
+
+-- Keep cursor in the center of the window when doing half page jumping.
+vim.keymap.set("n", "<C-u>", "<C-u>zz")
+vim.keymap.set("n", "<C-d>", "<C-d>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", "<leader>p", [["_dP]])
+vim.keymap.set("n", "<leader>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", ";;", "<Esc>A;")
+vim.keymap.set("i", ",,", "<Esc>A,")
+
+-- Allow yanking into system clipboard.
+vim.keymap.set({"n", "v"}, "<leader>y", [["+y]])
+vim.keymap.set("n", "<leader>Y", [["+Y]])
+
+-- Globally replace word that cursor is on.
+vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
+
+-- Toggle hidden characters.
+vim.keymap.set("n", "<leader>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"
+