commit 74dcfc08fdf75cc064285017b86a1326e76c9d02 Author: Zev Averbach Date: Mon Feb 5 15:52:12 2024 +0100 first diff --git a/README.md b/README.md new file mode 100644 index 0000000..6dd1484 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# Install + +```bash +> git clone https://github.com/zevaverbach/nvim_setup +> ln -s /init.lua ~/.config/nvim/init.lua +> sudo npm install -g pyright +``` diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..e03058e --- /dev/null +++ b/init.lua @@ -0,0 +1,121 @@ +-- initialize and install lazynvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" + +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, +}) +end + +vim.opt.rtp:prepend(lazypath) + +-- specify and install plugins +require("lazy").setup({ + {'nvim-telescope/telescope.nvim', + tag = '0.1.5', + dependencies = { 'nvim-lua/plenary.nvim' } + }, + {'VonHeikemen/lsp-zero.nvim', branch = 'v3.x'}, + {'neovim/nvim-lspconfig'}, + { + "kylechui/nvim-surround", + version = "*", -- Use for stability; omit to use `main` branch for the latest features + event = "VeryLazy", + config = function() + require("nvim-surround").setup({ + -- Configuration here, or leave empty to use defaults + }) + end + }, + {'hrsh7th/cmp-nvim-lsp'}, + {'hrsh7th/nvim-cmp'}, + {'L3MON4D3/LuaSnip'}, + {'neoclide/coc.nvim', branch = 'release'}, + { + 'folke/tokyonight.nvim', + lazy = false, + priority = 1000, + opts = {} + } +}) + +-- initialize plugins +require('telescope').setup{} +local lsp_zero = require('lsp-zero') + +-- color +vim.cmd("colorscheme tokyonight-night") + +-- initialize and configure LSP + +lsp_zero.on_attach(function(client, bufnr) + lsp_zero.default_keymaps({buffer = bufnr}) +end) + +require('lspconfig').pyright.setup{} + +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 = "120" + + +local function map(mode, lhs, rhs, opts) + local options = { noremap = true, silent = true } + if opts then + if opts.desc then + opts.desc = "keymaps.lua: " .. opts.desc + end + options = vim.tbl_extend('force', options, opts) + end + vim.keymap.set(mode, lhs, rhs, options) +end + +-- remap keys +vim.g.mapleader = " " +map("n", "q", ":xa", {}) +map("n", "", ":w", {}) +map("n", "", ":bn") +map("n", "", ":bp") +map("i", "", ":wi") +map("n", "w", ":w:bw") +map("n", "v", ":e ~/.config/nvim/init.lua") +map("n", "r", ":e ~/.config/nvim/vimrc.vim") +map("n", "s", ":source ~/.config/nvim/init.lua") +map("n", "x", ":Sex") +map("n", "f", "Telescope find_files") +map("n", "g", "Telescope live_grep") +map("i", "", 'pumvisible() ? "\\" : "\\"', {expr = true, silent = true}) +map("i", "", 'pumvisible() ? "\\" : "\\"', {expr = true, silent = true})