66 lines
1.7 KiB
Lua
66 lines
1.7 KiB
Lua
|
|
vim.cmd[[colorscheme nord]]
|
|
vim.cmd[[syntax enable]]
|
|
|
|
-- Switch leader to minus
|
|
vim.g.mapleader = '-'
|
|
|
|
-- Default to utf-8 unix
|
|
vim.opt.encoding = 'utf-8'
|
|
vim.opt.fileformats = 'unix,dos'
|
|
|
|
-- Skip swaps
|
|
vim.opt.backup = false
|
|
vim.opt.writebackup = false
|
|
vim.opt.swapfile = false
|
|
|
|
-- Blink matching brackets
|
|
vim.opt.showmatch = true
|
|
|
|
-- Allow hidden buffers
|
|
vim.opt.hidden = true
|
|
|
|
-- Line numbers
|
|
vim.opt.number = true
|
|
|
|
-- Marker line at 80 and 120 char and enable ruler
|
|
vim.opt.cc = '80,120'
|
|
vim.opt.ruler = true
|
|
|
|
-- Prevent mouse from selecting numbers
|
|
vim.opt.mouse = 'a'
|
|
|
|
-- Show Tab characters and trailing whitespace
|
|
vim.opt.list = true
|
|
vim.opt.listchars='tab:▒░,trail:▓'
|
|
|
|
-- Space-indentation please
|
|
vim.opt.expandtab = true
|
|
vim.opt.shiftwidth = 4
|
|
vim.opt.tabstop = 4
|
|
vim.api.nvim_create_autocmd('FileType', {
|
|
pattern = { 'typescript', 'typescriptreact', 'json', 'javascript' },
|
|
command = 'setlocal shiftwidth=2 softtabstop=2 expandtab',
|
|
})
|
|
|
|
-- Smart searching
|
|
vim.opt.ignorecase = true
|
|
vim.opt.smartcase = true
|
|
vim.opt.incsearch = true
|
|
vim.opt.hlsearch = true
|
|
|
|
-- Support backspace across lines
|
|
vim.opt.backspace = 'indent,eol,start'
|
|
|
|
-- Ripgrep FZF
|
|
vim.cmd[[function! RipgrepFzf(query, fullscreen)
|
|
let command_fmt = 'rg --column --line-number --no-heading --color=always --smart-case %s || true'
|
|
let initial_command = printf(command_fmt, shellescape(a:query))
|
|
let reload_command = printf(command_fmt, '{q}')
|
|
let spec = {'options': ['--phony', '--query', a:query, '--bind', 'change:reload:'.reload_command]}
|
|
call fzf#vim#grep(initial_command, 1, fzf#vim#with_preview(spec), a:fullscreen)
|
|
endfunction
|
|
]]
|
|
|
|
vim.cmd[[command! -nargs=* -bang RG call RipgrepFzf(<q-args>, <bang>0)]]
|