86 lines
2.9 KiB
Lua
86 lines
2.9 KiB
Lua
-- 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 = '<F2>'
|
|
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 <F3> :set nonumber!<CR>'
|
|
vim.cmd 'nmap <F5> :NvimTreeToggle<CR>'
|
|
--
|
|
-- Highlight trailing whitespace (darker red) and remove all with Ctrl+k
|
|
vim.cmd 'highlight WhitespaceEOL ctermbg=red guibg=#ab0d0d'
|
|
vim.cmd 'match WhitespaceEOL /\\s\\+\\%#\\@<!$/'
|
|
vim.cmd 'nnoremap <C-k> :let _s=@/<Bar>:%s/\\s\\+$//e<Bar>:let @/=_s<Bar><CR>'
|
|
|
|
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", "<tab>", "<cmd>bn<cr>", default_opts)
|
|
keymap("n", "<S-tab>", "<cmd>bp<cr>", default_opts)
|
|
|
|
-- Find files, buffers, grep in folder using Telescope command-line sugar.
|
|
keymap("n", "<leader>ff", "<cmd>Telescope find_files<cr>", default_opts)
|
|
keymap("n", "<leader>fg", "<cmd>Telescope live_grep<cr>", default_opts)
|
|
keymap("n", "<leader>fb", "<cmd>Telescope buffers<cr>", default_opts)
|
|
keymap("n", "<leader>fh", "<cmd>Telescope help_tags<cr>", default_opts)
|
|
keymap("n", "<leader>fl", "<cmd>Telescope git_files<cr>", default_opts)
|
|
|
|
-- Turn spellchecker on
|
|
keymap("n", "<leader>s", "<cmd>setlocal spell spelllang=en_us<cr>", 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')
|