dotfiles/init.lua

81 lines
2.5 KiB
Lua
Raw Normal View History

2021-11-25 22:10:31 +01:00
-- 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 = 125
vim.opt.undofile = true
-- Enable vimrc files per project and disable unsafe commands in project vimrc
vim.opt.exrc = true
vim.opt.secure = true
vim.cmd 'noremap <tab> :bn<CR>'
vim.cmd 'noremap <S-tab> :bp<CR>'
-- Toggles on different plugins/modes
vim.cmd 'nmap <F3> :set nonumber!<CR>'
2021-11-26 01:27:00 +01:00
vim.cmd 'nmap <F5> :NvimTreeToggle<CR>'
2021-11-25 22:10:31 +01:00
--
-- 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'
2022-10-23 01:48:10 +02:00
vim.cmd 'highlight Pmenu ctermbg=253 guibg=253'
vim.cmd 'highlight Pmenu ctermfg=232 guifg=232'
2021-11-25 22:10:31 +01:00
vim.cmd 'let g:airline_theme=\'papercolor\''
-- Find files using Telescope command-line sugar.
vim.cmd 'nnoremap <leader>ff <cmd>Telescope find_files<cr>'
vim.cmd 'nnoremap <leader>fg <cmd>Telescope live_grep<cr>'
vim.cmd 'nnoremap <leader>fb <cmd>Telescope buffers<cr>'
vim.cmd 'nnoremap <leader>fh <cmd>Telescope help_tags<cr>'
vim.cmd 'nnoremap <leader>fl <cmd>Telescope git_files<cr>'
-- 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')
2021-12-12 20:07:55 +01:00
require('filetypes')