-- LSP -- Map leader to space vim.g.mapleader = ' ' local fn = vim.fn local execute = vim.api.nvim_command -- Sensible defaults require('settings') -- Auto install packer.nvim if not exists local install_path = fn.stdpath('data')..'/site/pack/packer/opt/packer.nvim' if fn.empty(fn.glob(install_path)) > 0 then execute('!git clone https://github.com/wbthomason/packer.nvim '..install_path) end vim.cmd [[packadd packer.nvim]] vim.cmd 'autocmd BufWritePost plugins.lua PackerCompile' -- Auto compile when there are changes in plugins.lua vim.opt.autoindent = true vim.opt.background = 'light' vim.opt.errorformat:prepend('%f|%l col %c|%m') vim.opt.expandtab = true vim.opt.fileformat = 'unix' vim.opt.number = true vim.opt.pastetoggle = '' vim.opt.shiftwidth = 4 vim.opt.softtabstop = 4 vim.opt.tabstop = 4 vim.opt.textwidth = 79 vim.opt.undofile = true -- Enable vimrc files per project and disable unsafe commands in project vimrc vim.opt.exrc = true vim.opt.secure = true -- Toggles on different plugins/modes vim.cmd 'nmap :set nonumber!' vim.cmd 'nmap :NvimTreeToggle' -- -- Highlight trailing whitespace (darker red) and remove all with Ctrl+k vim.cmd 'highlight WhitespaceEOL ctermbg=red guibg=#ab0d0d' vim.cmd 'match WhitespaceEOL /\\s\\+\\%#\\@ :let _s=@/:%s/\\s\\+$//e:let @/=_s' vim.cmd 'highlight Visual cterm=bold ctermbg=Grey ctermfg=NONE' vim.cmd 'highlight Search ctermfg=Black' vim.cmd 'highlight Comment ctermfg=DarkGrey' vim.cmd 'highlight SignColumn ctermbg=0' vim.cmd 'highlight LineNr ctermbg=0 ctermfg=248' vim.cmd 'highlight Folded ctermbg=Green ctermfg=Black' vim.cmd 'highlight Pmenu ctermbg=253 guibg=253' vim.cmd 'highlight Pmenu ctermfg=232 guifg=232' vim.cmd 'let g:airline_theme=\'papercolor\'' local keymap = vim.api.nvim_set_keymap local default_opts = { noremap = true, silent = true } -- Use tab and shift+tab to cycle buffers keymap("n", "", "bn", default_opts) keymap("n", "", "bp", default_opts) -- Find files, buffers, grep in folder using Telescope command-line sugar. keymap("n", "ff", "Telescope find_files", default_opts) keymap("n", "fg", "Telescope live_grep", default_opts) keymap("n", "fb", "Telescope buffers", default_opts) keymap("n", "fh", "Telescope help_tags", default_opts) keymap("n", "fl", "Telescope git_files", default_opts) -- Turn spellchecker on keymap("n", "s", "setlocal spell spelllang=en_us", default_opts) -- Install plugins require('plugins') -- Key mappings require('keymappings') -- Setup Lua language server using submodule require('lsp_lua') -- OR you can invoke them individually here --require('colorscheme') -- color scheme require('config.compe') -- completion --require('fugitive') -- fugitive require('lang') require('filetypes')