local cmd = vim.cmd local fn = vim.fn local g = vim.g local o = vim.o g.mapleader = ' ' -- key to g.maplocalleader = '\\' require('plugins') require('hardmode') local u = require('utils') -- OPTIONS -- {{{ cmd('set clipboard+=unnamedplus') u.opt('o', 'shiftround', true) u.opt('o', 'termguicolors', true) u.opt('o', 'incsearch', true) u.opt('o', 'inccommand', 'split') u.opt('o', 'smartcase', true) u.opt('o', 'hidden', true) u.opt('w', 'list', true) u.opt('w', 'number', true) u.opt('w', 'wrap', true) u.opt('o', 'scrolloff', 3) cmd('set listchars+=trail:¬') u.opt('o', 'showbreak', '↪ ') u.opt('b', 'textwidth', 80) -- TODO see if this is annoying u.opt('w', 'colorcolumn', '+1') -- depends on 'textwidth' u.opt('w', 'foldenable', true) u.opt('w', 'foldlevel', 0) u.opt('w', 'foldmethod', 'marker') u.opt('o', 'fillchars', 'fold:─') u.opt('o', 'complete', '.,w,b,u') u.opt('o', 'completeopt', 'menuone,noinsert,noselect,preview') cmd('set shortmess+=c') u.opt('w', 'statusline', '%!luaeval("statusline()")') u.opt('o', 'cmdheight', 1) u.opt('o', 'showmode', true) u.opt('o', 'showcmd', false) u.opt('o', 'laststatus', 2) u.opt('o', 'ruler', true) u.opt('o', 'mouse', 'a') u.opt('o', 'spell', false) u.opt('o', 'lazyredraw', true) u.opt('o', 'backspace', 'indent,eol,start') u.opt('o', 'undolevels', 1000) u.opt('o', 'updatetime', 300) u.opt('o', 'signcolumn', 'yes') -- }}} -- COLORS -- {{{ g.nihoncolors_transparent_background = true cmd('colorscheme nihoncolors') -- }}} -- KEY BINDS -- {{{ u.map('n', 'Q', ':quitall', { silent = false }) u.map('n', 'gb', ':bnext') u.map('n', 'gB', ':bprevious') -- terminal u.map('t', '', '') u.map('t', 'qq', ':bdelete!') -- completion u.map('i', '', 'pumvisible() ? "\\" : completion#trigger_completion()', { expr = true }) u.map('i', '', 'pumvisible() ? "\\" : completion#trigger_completion()', { expr = true }) u.map('i', '', 'lua require("completion.source").nextCompletion()') u.map('i', '', 'lua require("completion.source").prevCompletion()') -- }}} -- AUTO GROUPS -- {{{ u.augroup('yank_highlight', {{'TextYankPost', '*', 'silent! lua require("vim.highlight").on_yank()'}}) u.augroup('diagnostics', {{'CursorHold', '*', 'lua vim.lsp.diagnostic.show_line_diagnostics()'}}) -- }}} -- USER COMMANDS -- {{{ u.def('BalenaDiagnosticsFold', 'call balena_diagnostics_fold#apply()') u.def('SortLine', 'call setline(".", join(sort(split(getline("."), " ")), " "))') -- }}} -- STATUS LINE -- {{{ vim.api.nvim_command('hi StatusLineInsert guifg=#00ffff guibg=None') vim.api.nvim_command('hi StatusLineCommand guifg=#ff3300 guibg=None') statusline = function() local sl = '' -- left sl = sl .. statusline_color(vim.fn.mode()) sl = sl .. [[ ⢷ %<%F %-m %-r ]] -- right sl = sl .. [[ %=  %l:%v %y ]] return sl end statusline_color = function(mode) if mode == 'i' then return '%#StatusLineInsert#' elseif mode == 'c' then return '%#StatusLineCommand#' elseif mode == 'v' or mode == 'V' or mode == '' then return '%#Visual#' elseif mode == 'R' or mode == 'Rv' then return '%1*' -- return '%#Include#' else return '%1*' end end -- }}}