nixhome/rcfiles/neovim.lua

67 lines
1.9 KiB
Lua

vim.opt.ignorecase = true -- search case insensitive
vim.opt.smartcase = true -- search matters if capital letter
vim.opt.inccommand = "split" -- "for incsearch while sub
vim.g.mapleader = ","
vim.opt.ruler = true -- cursor position all the time
vim.opt.autowrite = true -- save before commands
-- softtabs, 2 spaces
vim.opt.tabstop = 2
vim.opt.shiftwidth = 2
vim.opt.shiftround = true
vim.optexpandtab = true
-- listchars (show tabs and trailing whitespace)
vim.opt.list = true
vim.opt.listchars.tab = "»·"
vim.opt.listchars.trail= "·"
vim.opt.listchars.nbsp = "·"
-- width and height indications
vim.opt.textwidth = 80
vim.opt.colorcolumn = "+1"
vim.opt.number = true
vim.opt.numberwidth = 5
-- textwidth but don't wrap
vim.opt.formatoptions:remove { "t" }
-- telescope setup
local tbuiltin = require('telescope.builtin')
vim.keymap.set('n', '<leader>fg', tbuiltin.live_grep, {})
vim.keymap.set('n', '<leader>ff', tbuiltin.find_files, {})
vim.keymap.set('n', '<leader>fo', tbuiltin.oldfiles, {})
vim.keymap.set('n', '<leader>fb', tbuiltin.buffers, {})
vim.keymap.set('n', '<leader>fh', tbuiltin.help_tags, {})
vim.keymap.set('n', '<leader>fs', tbuiltin.spell_suggest, {})
-- set terminal title
function _G.current_tab()
local curr_buf = vim.fn.bufnr()
local total = 0
local curr_tab
for i = 1, vim.fn.tabpagenr('$') do
total = total + 1
for _, bufnr in ipairs(vim.fn.tabpagebuflist(i)) do
if bufnr == curr_buf then
curr_tab = i
end
end
end
return string.format('(%d of %d)', curr_tab, total)
end
vim.opt.title = true
vim.opt.titlestring = [[%f %h%m%r%w - %{v:progname} %{luaeval('current_tab()')}]]
-- vimsense (rich presence) options
vim.g.vimsense_small_text = "NeoVim"
vim.g.vimsense_small_image = "neovim"
vim.g.vimsense_editing_details = "Editing: {}"
vim.g.vimsense_editing_state = "Working on: {}"
vim.g.vimsense_file_explorer_text = "In file manager"
vim.g.vimsense_file_explorer_details = "Looking for files"