-- General settings vim.g.loaded_python_provider = 1 vim.g.python3_host_prog = '/Users/michael/.pyenv/shims/python3' vim.g.loaded_perl_provider = 0 vim.g.loaded_ruby_provider = 0 vim.opt.rnu = true vim.opt.number = true vim.opt.hlsearch = true vim.opt.incsearch = true vim.opt.backspace = { 'indent', 'eol', 'start' } vim.opt.visualbell = true vim.opt.clipboard:append { 'unnamedplus' } vim.opt.completeopt = { 'menuone', 'noselect' } vim.opt.cmdheight = 0 vim.opt.expandtab = true vim.opt.wrap = false vim.opt.shiftwidth = 4 vim.opt.softtabstop = 4 vim.opt.smarttab = true vim.opt.encoding = 'utf-8' vim.opt.foldenable = false vim.opt.linebreak = true vim.opt.showbreak = '↪ ' vim.opt.breakindent = true vim.opt.termguicolors = true vim.cmd[[ syntax on filetype on filetype plugin on filetype plugin indent on highlight Comment cterm=italic gui=italic ]] vim.opt.backup = false vim.opt.writebackup = false vim.opt.updatetime = 300 vim.opt.shortmess:append 'c' vim.opt.signcolumn = 'yes' vim.opt.laststatus = 3 if vim.g.neovide then vim.g.neovide_input_macos_option_key_is_meta = 'only_left' end if vim.g.neovide then vim.keymap.set('n', '', ':w') -- Save vim.keymap.set('v', '', '"+y') -- Copy vim.keymap.set('n', '', '"+P') -- Paste normal mode vim.keymap.set('v', '', '"+P') -- Paste visual mode vim.keymap.set('c', '', '+') -- Paste command mode vim.keymap.set('i', '', 'l"+Pli') -- Paste insert mode end -- Allow clipboard copy paste in neovim vim.api.nvim_set_keymap('', '', '+p', { noremap = true, silent = true}) vim.api.nvim_set_keymap('!', '', '+', { noremap = true, silent = true}) vim.api.nvim_set_keymap('t', '', '+', { noremap = true, silent = true}) vim.api.nvim_set_keymap('v', '', '+', { noremap = true, silent = true}) -- Autocommands local indent_rules_augroup = vim.api.nvim_create_augroup('Indents', {}) vim.api.nvim_create_autocmd( { 'FileType' }, { pattern = { 'make', 'sh', 'zsh' }, group = indent_rules_augroup, callback = function() vim.opt_local.tabstop = 8 vim.opt_local.shiftwidth = 8 vim.opt_local.softtabstop = 0 vim.opt_local.expandtab = false end }) vim.api.nvim_create_autocmd( { 'FileType' }, { pattern = { 'go' }, group = indent_rules_augroup, callback = function() vim.opt_local.tabstop = 4 vim.opt_local.shiftwidth = 4 vim.opt_local.softtabstop = 0 vim.opt_local.expandtab = false end }) vim.api.nvim_create_autocmd( { 'FileType' }, { pattern = { 'javascript', 'lua' }, group = indent_rules_augroup, callback = function() vim.opt_local.tabstop = 2 vim.opt_local.shiftwidth = 2 vim.opt_local.softtabstop = 2 end }) local wrap_rules_augroup = vim.api.nvim_create_augroup('Wrap', {}) vim.api.nvim_create_autocmd( { 'FileType' }, { pattern = { 'markdown', 'rst', 'text' }, group = wrap_rules_augroup, callback = function() vim.opt_local.wrap = true end }) local terminal_rules_augroup = vim.api.nvim_create_augroup('Terminal', {}) vim.api.nvim_create_autocmd( { 'TermOpen' }, { pattern = { '*' }, group = terminal_rules_augroup, callback = function() vim.cmd('startinsert') vim.opt_local.scrollback = 100000 vim.opt_local.modified = true vim.opt_local.bufhidden = 'hide' vim.opt_local.statusline = vim.api.nvim_buf_get_var(0, 'term_title') vim.opt_local.number = false vim.opt_local.rnu = false vim.cmd('match Errormsg ""') end }) -- Terminal vim.cmd[[ tnoremap tnoremap h tnoremap j tnoremap k tnoremap l inoremap h inoremap j inoremap k inoremap l nnoremap h nnoremap j nnoremap k nnoremap l let g:term_buf = 0 let g:term_win = 0 function! Term_toggle(height) if win_gotoid(g:term_win) hide else botright new exec "resize ". a:height try exec "buffer " . g:term_buf catch call termopen($SHELL, {"detach": 0}) keepalt file Terminal let g:term_buf = bufnr("") endtry let g:term_win = win_getid() endif endfunction nnoremap t :call Term_toggle(15) ]] -- Tab navigation in gui if vim.fn.has('gui_running') == 1 then vim.keymap.set('n', '', 'tabp', { noremap = true, silent = true }) vim.keymap.set('v', '', 'tabp', { noremap = true, silent = true }) vim.keymap.set('i', '', 'tabp', { noremap = true, silent = true }) vim.keymap.set('n', '', 'tabn', { noremap = true, silent = true }) vim.keymap.set('v', '', 'tabn', { noremap = true, silent = true }) vim.keymap.set('i', '', 'tabn', { noremap = true, silent = true }) vim.keymap.set('n', '', 'tabp', { noremap = true, silent = true }) vim.keymap.set('v', '', 'tabp', { noremap = true, silent = true }) vim.keymap.set('i', '', 'tabp', { noremap = true, silent = true }) vim.keymap.set('n', '', 'tabn', { noremap = true, silent = true }) vim.keymap.set('v', '', 'tabn', { noremap = true, silent = true }) vim.keymap.set('i', '', 'tabn', { noremap = true, silent = true }) end vim.diagnostic.config({ underline = { severity = vim.diagnostic.severity.ERROR }, })