vim.opt.shell = "zsh" vim.opt.history = 1000 vim.opt.termguicolors = true vim.opt.background = "dark" vim.opt.mouse = "" -- disable -- vim.opt.ruler = true -- Position at the bottom of the screen vim.opt.joinspaces = false vim.opt.hidden = true vim.opt.previewheight = 5 -- vim.opt.shortmess = vim.o.shortmess .. "atI" vim.opt.lazyredraw = true vim.opt.splitbelow = true vim.opt.splitright = true vim.opt.cursorline = true vim.opt.cursorcolumn = true -- Global settings vim.opt.autochdir = true -- Keep vim's directory context same as the current buffer vim.opt.listchars = "tab:> ,trail:.,extends:$,nbsp:_" vim.opt.fillchars = "fold:-" -- Search vim.opt.hlsearch = true vim.opt.incsearch = true vim.opt.ignorecase = true vim.opt.wildmode = "list:longest" -- Autocomplete -- Buffer settings vim.opt.autoindent = true vim.opt.expandtab = true vim.opt.shiftwidth = 2 vim.opt.softtabstop = 4 vim.opt.tabstop = 2 vim.opt.undofile = true vim.opt.number = true vim.opt.relativenumber = true vim.cmd 'colorscheme bamboo' vim.g.floaterm_keymap_toggle = '' vim.g.floaterm_width = 0.9 vim.g.floaterm_height = 0.9 vim.g.floaterm_shell = "/bin/bash" vim.g.rustfmt_autosave = 1 vim.g.rust_use_custom_ctags_defs = 1 vim.g.tagbar_autofocus=1 -- vim.g.UltiSnipsExpandTrigger="" -- vim.g.UltiSnipsJumpForwardTrigger="" -- vim.g.UltiSnipsJumpBackwardTrigger="" -- Highlight yank vim.api.nvim_command([[ au TextYankPost * lua vim.highlight.on_yank {higroup="IncSearch", timeout=150, on_visual=true} ]]) -- TODO: ... the rest of plugin/legacy.vim local map = vim.api.nvim_set_keymap local function t(str) -- Convert termcodes for mapping return vim.api.nvim_replace_termcodes(str, true, true, true) end local check_back_space = function() local col = vim.fn.col(".") - 1 if col == 0 or vim.fn.getline("."):sub(col, col):match("%s") then return true else return false end end _G.tab_complete = function() if vim.fn.pumvisible() == 1 then return t("") elseif vim.fn.call("vsnip#available", { 1 }) == 1 then return t("(vsnip-expand-or-jump)") elseif check_back_space() then return t("") else return vim.fn["compe#complete"]() end end _G.s_tab_complete = function() if vim.fn.pumvisible() == 1 then return t("") elseif vim.fn.call("vsnip#jumpable", { -1 }) == 1 then return t("(vsnip-jump-prev)") else -- If is not working in your terminal, change it to return t("") end end -- vim.api.nvim_set_keymap("i", "", "v:lua.tab_complete()", { expr = true }) -- vim.api.nvim_set_keymap("s", "", "v:lua.tab_complete()", { expr = true }) -- vim.api.nvim_set_keymap("i", "", "v:lua.s_tab_complete()", { expr = true }) -- vim.api.nvim_set_keymap("s", "", "v:lua.s_tab_complete()", { expr = true }) map("v", ">", ">gv", {}) -- Retain visual select when indenting map("v", "<", "bq",":bp bd #", {silent=true}) vim.api.nvim_set_keymap("n", "ff", ":Telescope find_files", {silent=true}) vim.api.nvim_set_keymap("n", "fg", ":Telescope live_grep", {silent=true}) vim.api.nvim_set_keymap("n", "fb", ":Telescope buffers", {silent=true}) vim.api.nvim_set_keymap("n", "fa", ":Ag", {silent=true}) -- vim.api.nvim_set_keymap("n", "fp", ":Telescope projects", {silent=true}) -- vim.api.nvim_set_keymap("n", "gb",":.GBrowse", {silent=true}) -- vim.api.nvim_set_keymap("n", "",":SearchSession", {silent = true }) vim.api.nvim_set_keymap("n", "", ":bprev", {silent = true}) vim.api.nvim_set_keymap("n", "", ":bnext", {silent = true}) vim.api.nvim_set_keymap("n", "", ":NERDTreeToggle", {silent = true}) vim.api.nvim_set_keymap("n", "", ":set invnumber invrelativenumber", {silent = true }) vim.api.nvim_set_keymap("i", "", "", {silent = true }) vim.api.nvim_set_keymap("n", "", ":Tagbar", {silent = true }) vim.api.nvim_set_keymap("n", "", ":FloatermToggle", {silent = true }) -- LSP Diagnostics Options Setup local sign = function(opts) vim.fn.sign_define(opts.name, { texthl = opts.name, text = opts.text, numhl = '' }) end sign({name = 'DiagnosticSignError', text = ''}) sign({name = 'DiagnosticSignWarn', text = ''}) sign({name = 'DiagnosticSignHint', text = ''}) sign({name = 'DiagnosticSignInfo', text = ''}) vim.diagnostic.config({ virtual_text = false, signs = true, update_in_insert = true, underline = true, severity_sort = false, float = { border = 'rounded', source = 'always', header = '', prefix = '', }, }) vim.cmd([[ set signcolumn=yes autocmd CursorHold * lua vim.diagnostic.open_float(nil, { focusable = false }) ]]) -- Vimspector -- KEYS vim.cmd([[ nmap call vimspector#Launch() nmap call vimspector#StepOver() nmap call vimspector#Reset() nmap call vimspector#StepOver() nmap call vimspector#StepOut() nmap call vimspector#StepInto() nmap Db :call vimspector#ToggleBreakpoint() nmap Dw :call vimspector#AddWatch() nmap De :call vimspector#Evaluate() ]]) -- OPTS vim.opt.completeopt = {'menuone', 'noselect', 'noinsert'} vim.opt.shortmess = vim.opt.shortmess + { c = true} vim.api.nvim_set_option('updatetime', 300) -- Fixed column for diagnostics to appear -- Show autodiagnostic popup on cursor hover_range -- Goto previous / next diagnostic warning / error -- Show inlay_hints more frequently vim.cmd([[ set signcolumn=yes autocmd CursorHold * lua vim.diagnostic.open_float(nil, { focusable = false }) ]]) vim.cmd([[ let g:vimspector_sidebar_width = 85 let g:vimspector_bottombar_height = 15 let g:vimspector_terminal_maxwidth = 70 ]])