aboutsummaryrefslogtreecommitdiffstats
path: root/nvim/.config
diff options
context:
space:
mode:
Diffstat (limited to 'nvim/.config')
-rw-r--r--nvim/.config/nvim/init.lua3
-rw-r--r--nvim/.config/nvim/lazy-lock.json25
-rw-r--r--nvim/.config/nvim/lua/config/keybinds.lua72
-rw-r--r--nvim/.config/nvim/lua/config/lazy.lua26
-rw-r--r--nvim/.config/nvim/lua/config/options.lua55
-rw-r--r--nvim/.config/nvim/lua/plugins/colors.lua20
-rw-r--r--nvim/.config/nvim/lua/plugins/lsp.lua231
-rw-r--r--nvim/.config/nvim/lua/plugins/one-liners.lua16
-rw-r--r--nvim/.config/nvim/lua/plugins/telescope.lua15
-rw-r--r--nvim/.config/nvim/lua/plugins/treesitter.lua35
10 files changed, 498 insertions, 0 deletions
diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua
new file mode 100644
index 0000000..e7df95d
--- /dev/null
+++ b/nvim/.config/nvim/init.lua
@@ -0,0 +1,3 @@
+require('config.options')
+require('config.keybinds')
+require('config.lazy')
diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json
new file mode 100644
index 0000000..baa0789
--- /dev/null
+++ b/nvim/.config/nvim/lazy-lock.json
@@ -0,0 +1,25 @@
+{
+ "LuaSnip": { "branch": "master", "commit": "dae4f5aaa3574bd0c2b9dd20fb9542a02c10471c" },
+ "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
+ "cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
+ "cmp-nvim-lua": { "branch": "main", "commit": "e3a22cb071eb9d6508a156306b102c45cd2d573d" },
+ "cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
+ "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
+ "friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" },
+ "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
+ "lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" },
+ "mason-lspconfig.nvim": { "branch": "main", "commit": "21c2a84ce368e99b18f52ab348c4c02c32c02fcf" },
+ "mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" },
+ "nvim-cmp": { "branch": "main", "commit": "da88697d7f45d16852c6b2769dc52387d1ddc45f" },
+ "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
+ "nvim-highlight-colors": { "branch": "main", "commit": "e2cb22089cc2358b2b995c09578224f142de6039" },
+ "nvim-lspconfig": { "branch": "master", "commit": "44acfe887d4056f704ccc4f17513ed41c9e2b2e6" },
+ "nvim-osc52": { "branch": "main", "commit": "04cfaba1865ae5c53b6f887c3ca7304973824fb2" },
+ "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
+ "nvim-web-devicons": { "branch": "master", "commit": "746ffbb17975ebd6c40142362eee1b0249969c5c" },
+ "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
+ "telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" },
+ "telescope.nvim": { "branch": "master", "commit": "3333a52ff548ba0a68af6d8da1e54f9cd96e9179" },
+ "tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" },
+ "vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" }
+}
diff --git a/nvim/.config/nvim/lua/config/keybinds.lua b/nvim/.config/nvim/lua/config/keybinds.lua
new file mode 100644
index 0000000..0b1f345
--- /dev/null
+++ b/nvim/.config/nvim/lua/config/keybinds.lua
@@ -0,0 +1,72 @@
+-- KEYBINDS
+vim.g.mapleader = " "
+vim.keymap.set("n", "<leader>cd", vim.cmd.Ex)
+
+vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv") -- Alt Up/Down in vscode
+vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
+
+vim.keymap.set("n", "J", "mzJ`z") -- Remap joining lines
+vim.keymap.set("n", "<C-d>", "<C-d>zz") -- Keep cursor in place while moving up/down page
+vim.keymap.set("n", "<C-u>", "<C-u>zz")
+vim.keymap.set("n", "n", "nzzzv") -- center screen when looping search results
+vim.keymap.set("n", "N", "Nzzzv")
+
+-- map for quick quit, save files using leader key
+---- Normal mode
+vim.keymap.set('n', '<Leader>w', ':write<CR>')
+vim.keymap.set('n', '<Leader>a', ':wqa<CR>')
+vim.keymap.set('n', '<Leader>x', ':wq<CR>')
+
+-- paste and don't replace clipboard over deleted text
+vim.keymap.set("x", "<leader>p", [["_dP]])
+vim.keymap.set({ "n", "v" }, "<leader>d", [["_d]])
+
+
+-- sometimes in insert mode, control-c doesn't exactly work like escape
+vim.keymap.set("i", "<C-c>", "<Esc>")
+
+-- add binds for Control J/K to scroll thru quickfix list
+vim.keymap.set("n", "<C-j>", "<cmd>cnext<CR>zz")
+vim.keymap.set("n", "<C-k>", "<cmd>cprev<CR>zz")
+
+-- What the heck is Ex mode?
+vim.keymap.set("n", "Q", "<nop>")
+
+vim.keymap.set("n", "<leader>k", "<cmd>lnext<CR>zz")
+vim.keymap.set("n", "<leader>j", "<cmd>lprev<CR>zz")
+
+-- getting Alex off my back :)
+vim.keymap.set("n", "<leader>dg", "<cmd>DogeGenerate<cr>")
+
+-- lint / format php files for LC
+vim.keymap.set("n", "<leader>cc", "<cmd>!php-cs-fixer fix % --using-cache=no<cr>")
+
+-- Replace all instances of whatever is under cursor (on line)
+vim.keymap.set("n", "<leader>s", [[:s/\<<C-r><C-w>\>//gI<Left><Left><Left>]])
+
+-- make file executable
+vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true })
+
+-- yank into clipboard even if on ssh
+vim.keymap.set('n', '<leader>y', '<Plug>OSCYankOperator')
+vim.keymap.set('v', '<leader>y', '<Plug>OSCYankVisual')
+
+-- reload without exiting vim
+vim.keymap.set("n", "<leader>rl", "<cmd>source ~/.config/nvim/init.lua<cr>")
+
+vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
+
+-- Quickfix list stuff
+vim.keymap.set("n", "<leader>cl", ":cclose<CR>", { silent = true })
+vim.keymap.set("n", "<leader>co", ":copen<CR>", { silent = true })
+vim.keymap.set("n", "<leader>cn", ":cnext<CR>zz")
+vim.keymap.set("n", "<leader>cp", ":cprev<CR>zz")
+vim.keymap.set("n", "<leader>li", ":checkhealth vim.lsp<CR>", { desc = "LSP Info" })
+
+-- run make in current working directory
+vim.keymap.set("n", "<leader>mm", "<cmd>make<CR>")
+
+-- source file
+vim.keymap.set("n", "<leader><leader>", function()
+ vim.cmd("so")
+end)
diff --git a/nvim/.config/nvim/lua/config/lazy.lua b/nvim/.config/nvim/lua/config/lazy.lua
new file mode 100644
index 0000000..d37016f
--- /dev/null
+++ b/nvim/.config/nvim/lua/config/lazy.lua
@@ -0,0 +1,26 @@
+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)
+
+vim.g.mapleader = " "
+vim.g.maplocalleader = "\\"
+
+require("lazy").setup({
+ spec = {
+ -- import your plugins
+ { import = "plugins" },
+ },
+ change_detection = {notify = false}
+})
diff --git a/nvim/.config/nvim/lua/config/options.lua b/nvim/.config/nvim/lua/config/options.lua
new file mode 100644
index 0000000..02c6ef6
--- /dev/null
+++ b/nvim/.config/nvim/lua/config/options.lua
@@ -0,0 +1,55 @@
+-- OPTIONS
+local set = vim.opt
+
+--line nums
+set.relativenumber = true
+set.number = true
+
+-- indentation and tabs
+set.tabstop = 4
+set.shiftwidth = 4
+set.autoindent = true
+set.expandtab = true
+
+-- search settings
+set.ignorecase = true
+set.smartcase = true
+
+-- appearance
+set.termguicolors = true
+set.background = "dark"
+set.signcolumn = "yes"
+
+-- cursor line
+set.cursorline = true
+
+-- 80th column
+-- set.colorcolumn = "80"
+
+-- clipboard
+set.clipboard:append("unnamedplus")
+
+-- backspace
+set.backspace = "indent,eol,start"
+
+-- split windows
+set.splitbelow = true
+set.splitright = true
+
+-- dw/diw/ciw works on full-word
+set.iskeyword:append("-")
+
+-- keep cursor at least 8 rows from top/bot
+set.scrolloff = 8
+
+-- undo dir settings
+set.swapfile = false
+set.backup = false
+set.undodir = os.getenv("HOME") .. "/.vim/undodir"
+set.undofile = true
+
+-- incremental search
+set.incsearch = true
+
+-- faster cursor hold
+set.updatetime = 50
diff --git a/nvim/.config/nvim/lua/plugins/colors.lua b/nvim/.config/nvim/lua/plugins/colors.lua
new file mode 100644
index 0000000..851d256
--- /dev/null
+++ b/nvim/.config/nvim/lua/plugins/colors.lua
@@ -0,0 +1,20 @@
+local function enable_transparency()
+ vim.api.nvim_set_hl(0, "Normal", {bg = "none"})
+end
+return {
+ {
+ "folke/tokyonight.nvim",
+ config = function()
+ vim.cmd.colorscheme "tokyonight"
+ end
+ },
+ {
+ "nvim-lualine/lualine.nvim",
+ dependencies = {
+ "nvim-tree/nvim-web-devicons",
+ },
+ opts = {
+ theme = 'tokyonight',
+ },
+ }
+}
diff --git a/nvim/.config/nvim/lua/plugins/lsp.lua b/nvim/.config/nvim/lua/plugins/lsp.lua
new file mode 100644
index 0000000..2e2c368
--- /dev/null
+++ b/nvim/.config/nvim/lua/plugins/lsp.lua
@@ -0,0 +1,231 @@
+return {
+ 'neovim/nvim-lspconfig',
+ dependencies = {
+ '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',
+ },
+ config = function()
+ local autoformat_filetypes = {
+ "lua",
+ }
+ -- Create a keymap for vim.lsp.buf.implementation
+ vim.api.nvim_create_autocmd('LspAttach', {
+ callback = function(args)
+ local client = vim.lsp.get_client_by_id(args.data.client_id)
+ if not client then return end
+ if vim.tbl_contains(autoformat_filetypes, vim.bo.filetype) then
+ vim.api.nvim_create_autocmd("BufWritePre", {
+ buffer = args.buf,
+ callback = function()
+ vim.lsp.buf.format({
+ formatting_options = { tabSize = 4, insertSpaces = true },
+ bufnr = args.buf,
+ id = client.id
+ })
+ end
+ })
+ end
+ end
+ })
+
+ -- Add borders to floating windows
+ vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
+ vim.lsp.handlers.hover,
+ { border = 'rounded' }
+ )
+ vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(
+ vim.lsp.handlers.signature_help,
+ { border = 'rounded' }
+ )
+
+ -- Configure error/warnings interface
+ vim.diagnostic.config({
+ virtual_text = true,
+ severity_sort = true,
+ float = {
+ style = 'minimal',
+ border = 'rounded',
+ header = '',
+ prefix = '',
+ },
+ signs = {
+ text = {
+ [vim.diagnostic.severity.ERROR] = '✘',
+ [vim.diagnostic.severity.WARN] = '▲',
+ [vim.diagnostic.severity.HINT] = '⚑',
+ [vim.diagnostic.severity.INFO] = '»',
+ },
+ },
+ })
+
+ -- Add cmp_nvim_lsp capabilities settings to lspconfig
+ -- This should be executed before you configure any language server
+ local lspconfig_defaults = require('lspconfig').util.default_config
+ lspconfig_defaults.capabilities = vim.tbl_deep_extend(
+ 'force',
+ lspconfig_defaults.capabilities,
+ require('cmp_nvim_lsp').default_capabilities()
+ )
+
+ -- This is where you enable features that only work
+ -- if there is a language server active in the file
+ vim.api.nvim_create_autocmd('LspAttach', {
+ callback = function(event)
+ local opts = { buffer = event.buf }
+
+ vim.keymap.set('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>', opts)
+ vim.keymap.set('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<cr>', opts)
+ vim.keymap.set('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>', opts)
+ vim.keymap.set('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<cr>', opts)
+ vim.keymap.set('n', 'go', '<cmd>lua vim.lsp.buf.type_definition()<cr>', opts)
+ vim.keymap.set('n', 'gr', '<cmd>lua vim.lsp.buf.references()<cr>', opts)
+ vim.keymap.set('n', 'gs', '<cmd>lua vim.lsp.buf.signature_help()<cr>', opts)
+ vim.keymap.set('n', 'gl', '<cmd>lua vim.diagnostic.open_float()<cr>', opts)
+ vim.keymap.set('n', '<F2>', '<cmd>lua vim.lsp.buf.rename()<cr>', opts)
+ vim.keymap.set({ 'n', 'x' }, '<F3>', '<cmd>lua vim.lsp.buf.format({async = true})<cr>', opts)
+ vim.keymap.set('n', '<F4>', '<cmd>lua vim.lsp.buf.code_action()<cr>', opts)
+ end,
+ })
+
+ require('mason').setup({})
+ require('mason-lspconfig').setup({
+ ensure_installed = {
+ "lua_ls",
+ "intelephense",
+ "ts_ls",
+ "eslint",
+ },
+ handlers = {
+ -- this first function is the "default handler"
+ -- it applies to every language server without a custom handler
+ function(server_name)
+ require('lspconfig')[server_name].setup({})
+ end,
+
+ -- this is the "custom handler" for `lua_ls`
+ lua_ls = function()
+ require('lspconfig').lua_ls.setup({
+ settings = {
+ Lua = {
+ runtime = {
+ version = 'LuaJIT',
+ },
+ diagnostics = {
+ globals = { 'vim' },
+ },
+ workspace = {
+ library = { vim.env.VIMRUNTIME },
+ },
+ },
+ },
+ })
+ end,
+ },
+ })
+
+ local cmp = require('cmp')
+
+ require('luasnip.loaders.from_vscode').lazy_load()
+
+ vim.opt.completeopt = { 'menu', 'menuone', 'noselect' }
+
+ cmp.setup({
+ preselect = 'item',
+ completion = {
+ completeopt = 'menu,menuone,noinsert'
+ },
+ window = {
+ documentation = cmp.config.window.bordered(),
+ },
+ sources = {
+ { name = 'path' },
+ { name = 'nvim_lsp' },
+ { name = 'buffer', keyword_length = 3 },
+ { name = 'luasnip', keyword_length = 2 },
+ },
+ snippet = {
+ expand = function(args)
+ require('luasnip').lsp_expand(args.body)
+ end,
+ },
+ formatting = {
+ fields = { 'abbr', 'menu', 'kind' },
+ format = function(entry, item)
+ local n = entry.source.name
+ if n == 'nvim_lsp' then
+ item.menu = '[LSP]'
+ else
+ item.menu = string.format('[%s]', n)
+ end
+ return item
+ end,
+ },
+ mapping = cmp.mapping.preset.insert({
+ -- confirm completion item
+ ['<CR>'] = cmp.mapping.confirm({ select = false }),
+
+ -- scroll documentation window
+ ['<C-f>'] = cmp.mapping.scroll_docs(5),
+ ['<C-u>'] = cmp.mapping.scroll_docs(-5),
+
+ -- toggle completion menu
+ ['<C-e>'] = cmp.mapping(function(fallback)
+ if cmp.visible() then
+ cmp.abort()
+ else
+ cmp.complete()
+ end
+ end),
+
+ -- tab complete
+ ['<Tab>'] = cmp.mapping(function(fallback)
+ local col = vim.fn.col('.') - 1
+
+ if cmp.visible() then
+ cmp.select_next_item({ behavior = 'select' })
+ elseif col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then
+ fallback()
+ else
+ cmp.complete()
+ end
+ end, { 'i', 's' }),
+
+ -- go to previous item
+ ['<S-Tab>'] = cmp.mapping.select_prev_item({ behavior = 'select' }),
+
+ -- navigate to next snippet placeholder
+ ['<C-d>'] = cmp.mapping(function(fallback)
+ local luasnip = require('luasnip')
+
+ if luasnip.jumpable(1) then
+ luasnip.jump(1)
+ else
+ fallback()
+ end
+ end, { 'i', 's' }),
+
+ -- navigate to the previous snippet placeholder
+ ['<C-b>'] = cmp.mapping(function(fallback)
+ local luasnip = require('luasnip')
+
+ if luasnip.jumpable(-1) then
+ luasnip.jump(-1)
+ else
+ fallback()
+ end
+ end, { 'i', 's' }),
+ }),
+ })
+ end
+}
+
diff --git a/nvim/.config/nvim/lua/plugins/one-liners.lua b/nvim/.config/nvim/lua/plugins/one-liners.lua
new file mode 100644
index 0000000..fe240f1
--- /dev/null
+++ b/nvim/.config/nvim/lua/plugins/one-liners.lua
@@ -0,0 +1,16 @@
+return {
+ { "tpope/vim-fugitive" },
+ { "ojroques/nvim-osc52" },
+ {
+ "norcalli/nvim-colorizer.lua",
+ config = function()
+ require("colorizer").setup()
+ end,
+ },
+ {
+ "brenoprata10/nvim-highlight-colors",
+ config = function()
+ require('nvim-highlight-colors').setup({})
+ end
+ },
+}
diff --git a/nvim/.config/nvim/lua/plugins/telescope.lua b/nvim/.config/nvim/lua/plugins/telescope.lua
new file mode 100644
index 0000000..49d1276
--- /dev/null
+++ b/nvim/.config/nvim/lua/plugins/telescope.lua
@@ -0,0 +1,15 @@
+return {
+ 'nvim-telescope/telescope.nvim', version = '*',
+ dependencies = {
+ 'nvim-lua/plenary.nvim',
+ -- optional but recommended
+ { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' },
+ },
+ config = function()
+ local builtin = require('telescope.builtin')
+ vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = 'Telescope find files' })
+ vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc = 'Telescope live grep' })
+ vim.keymap.set('n', '<leader>fb', builtin.buffers, { desc = 'Telescope buffers' })
+ vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = 'Telescope help tags' })
+ end
+}
diff --git a/nvim/.config/nvim/lua/plugins/treesitter.lua b/nvim/.config/nvim/lua/plugins/treesitter.lua
new file mode 100644
index 0000000..e430504
--- /dev/null
+++ b/nvim/.config/nvim/lua/plugins/treesitter.lua
@@ -0,0 +1,35 @@
+return {
+ 'nvim-treesitter/nvim-treesitter',
+ branch = 'master', -- Important: Use the 'main' branch
+ build = ':TSUpdate',
+ config = function()
+
+ -- Configure nvim-treesitter with ensure_installed
+ require("nvim-treesitter.configs").setup({
+ ensure_installed = {
+ 'lua',
+ 'vim',
+ 'python',
+ 'javascript',
+ 'typescript',
+ 'go',
+ 'yaml',
+ 'bash',
+ 'html',
+ 'css',
+ 'markdown',
+ 'markdown_inline',
+ 'sql',
+ },
+ highlight = {
+ enable = true,
+ },
+ indent = {
+ enable = true,
+ },
+})
+
+
+
+ end,
+}