commit e2780cfe9d11ca89e187fb605bb3413ca75ff4f0 Author: Philippe Zwietering Date: Sun Apr 9 23:22:45 2023 +0200 Initial commit; lsp treesitter telescope undotree formatter colors diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d547881 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +packer_compiled.lua diff --git a/after/plugin/colors.lua b/after/plugin/colors.lua new file mode 100644 index 0000000..ede8c07 --- /dev/null +++ b/after/plugin/colors.lua @@ -0,0 +1,10 @@ +function ColorMyPencils(color) + color = color or "monokai" + vim.cmd.colorscheme(color) + + vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) + vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" }) + +end + +ColorMyPencils() diff --git a/after/plugin/harpoon.lua b/after/plugin/harpoon.lua new file mode 100644 index 0000000..50033d5 --- /dev/null +++ b/after/plugin/harpoon.lua @@ -0,0 +1,9 @@ +local mark = require("harpoon.mark") +local ui = require("harpoon.ui") + +vim.keymap.set("n", "a", mark.add_file) +vim.keymap.set("n", "", ui.toggle_quick_menu) +vim.keymap.set("n", "", function() ui.nav_file(1) end) +vim.keymap.set("n", "", function() ui.nav_file(2) end) +vim.keymap.set("n", "", function() ui.nav_file(3) end) +vim.keymap.set("n", "", function() ui.nav_file(4) end) diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua new file mode 100644 index 0000000..54fca2c --- /dev/null +++ b/after/plugin/lsp.lua @@ -0,0 +1,16 @@ +local lsp = require('lsp-zero').preset({}) + +lsp.ensure_installed({ + 'lua_ls', -- Lua + 'rust_analyzer', -- rust + 'texlab', -- LaTeX + 'clangd', -- C/C++ + 'jedi_language_server', -- Python +}) + +lsp.on_attach(function(client, bufnr) + lsp.default_keymaps({buffer = bufnr}) +end) + + +lsp.setup() diff --git a/after/plugin/neoformat.lua b/after/plugin/neoformat.lua new file mode 100644 index 0000000..2991492 --- /dev/null +++ b/after/plugin/neoformat.lua @@ -0,0 +1 @@ +vim.keymap.set('n', 'f', vim.cmd.Neoformat) diff --git a/after/plugin/telescope.lua b/after/plugin/telescope.lua new file mode 100644 index 0000000..4806008 --- /dev/null +++ b/after/plugin/telescope.lua @@ -0,0 +1,6 @@ +local builtin = require('telescope.builtin') +vim.keymap.set('n', 'pf', builtin.find_files, {}) +vim.keymap.set('n', '', builtin.git_files, {}) +vim.keymap.set('n', 'ps', function() + builtin.grep_string({ search = vim.fn.input("Grep > ") }); +end) diff --git a/after/plugin/treesitter.lua b/after/plugin/treesitter.lua new file mode 100644 index 0000000..351cb00 --- /dev/null +++ b/after/plugin/treesitter.lua @@ -0,0 +1,21 @@ +require'nvim-treesitter.configs'.setup { + -- A list of parser names, or "all" (the five listed parsers should always be installed) + ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "rust", "cpp", "cmake", "latex", "python" }, + + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, + + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally + auto_install = true, + + highlight = { + enable = true, + + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, +} diff --git a/after/plugin/undotree.lua b/after/plugin/undotree.lua new file mode 100644 index 0000000..b6b9276 --- /dev/null +++ b/after/plugin/undotree.lua @@ -0,0 +1 @@ +vim.keymap.set("n", "u", vim.cmd.UndotreeToggle) diff --git a/after/plugin/vim-fugitive.lua b/after/plugin/vim-fugitive.lua new file mode 100644 index 0000000..80c9070 --- /dev/null +++ b/after/plugin/vim-fugitive.lua @@ -0,0 +1 @@ +vim.keymap.set("n", "gs", vim.cmd.Git) diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..5f6fb8d --- /dev/null +++ b/init.lua @@ -0,0 +1 @@ +require("flip") diff --git a/lua/flip/init.lua b/lua/flip/init.lua new file mode 100644 index 0000000..c1c1118 --- /dev/null +++ b/lua/flip/init.lua @@ -0,0 +1,2 @@ +require("flip.remap") +require("flip.set") diff --git a/lua/flip/packer.lua b/lua/flip/packer.lua new file mode 100644 index 0000000..a7c1345 --- /dev/null +++ b/lua/flip/packer.lua @@ -0,0 +1,52 @@ +-- 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.1', + -- or , branch = '0.1.x', + requires = { {'nvim-lua/plenary.nvim'} } + } + + use ({ + 'tanvirtin/monokai.nvim', + as = 'monokai', + config = function() + vim.cmd('colorscheme monokai') + end + }) + + use ('nvim-treesitter/nvim-treesitter', {run = ':TSUpdate'}) + use ('nvim-treesitter/playground') + use ('theprimeagen/harpoon') + use ('mbbill/undotree') + use ('tpope/vim-fugitive') + use ('sbdchd/neoformat') + + use { + 'VonHeikemen/lsp-zero.nvim', + branch = 'v2.x', + requires = { + -- LSP Support + {'neovim/nvim-lspconfig'}, -- Required + { -- Optional + 'williamboman/mason.nvim', + run = function() + pcall(vim.cmd, 'MasonUpdate') + end, + }, + {'williamboman/mason-lspconfig.nvim'}, -- Optional + + -- Autocompletion + {'hrsh7th/nvim-cmp'}, -- Required + {'hrsh7th/cmp-nvim-lsp'}, -- Required + {'L3MON4D3/LuaSnip'}, -- Required + } + } + +end) diff --git a/lua/flip/remap.lua b/lua/flip/remap.lua new file mode 100644 index 0000000..b760350 --- /dev/null +++ b/lua/flip/remap.lua @@ -0,0 +1,2 @@ +vim.g.mapleader = " " +vim.keymap.set("n", "pv", vim.cmd.Ex) diff --git a/lua/flip/set.lua b/lua/flip/set.lua new file mode 100644 index 0000000..a801071 --- /dev/null +++ b/lua/flip/set.lua @@ -0,0 +1,36 @@ +-- Setting line numbers +vim.opt.nu = true +vim.opt.relativenumber = true + +-- Setting tabs correctly +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.expandtab = true + +vim.opt.smartindent = true + +-- Setting backup / undo stuff +vim.opt.swapfile = false +vim.opt.backup = false +vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir" +vim.opt.undofile = true + +-- Search highlighting +vim.opt.hlsearch = false +vim.opt.incsearch = true + +-- Colouring +vim.opt.termguicolors = true + +-- Scrolling stuff +vim.opt.scrolloff = 8 +vim.opt.signcolumn = "yes" +vim.opt.isfname:append("@-@") + +-- Update time +vim.opt.updatetime = 50 + +vim.opt.colorcolumn = "120" + +vim.g.mapleader = " "