dotfiles

Personal dotfiles
git clone https://git.bracken.jp/dotfiles.git
Log | Files | Refs | LICENSE

options.lua (2649B)


      1 -- Basic options
      2 vim.opt.mouse = ''                     -- Disable visual-mode mouse select.
      3 vim.opt.clipboard = 'unnamedplus'      -- Use the system clipboard on macOS.
      4 vim.opt.incsearch = true               -- Turn on incremental searching.
      5 vim.opt.hlsearch = true                -- Highlight search.
      6 vim.opt.visualbell = true              -- Less noise.
      7 vim.opt.number = true                  -- Use line numbering.
      8 vim.opt.ruler = true                   -- Show row/col in status.
      9 vim.opt.laststatus = 2                 -- Always show status line.
     10 vim.opt.showmatch = true               -- Highlight matching bracket.
     11 vim.opt.history = 50                   -- Keep 50 lines of cmdline history.
     12 vim.opt.wildmenu = true                -- Nicer autocomplete.
     13 vim.opt.wildmode = {'longest', 'full'}
     14 vim.opt.wildignore = {'*.o', '*.pyc'}  -- Ignore some filetypes during completion.
     15 vim.opt.spelllang = 'en_ca'            -- Set the spelling language.
     16 vim.opt.autocomplete = false             -- Enable native auto-completion.
     17 vim.opt.completeopt = 'menu,menuone,noselect,popup,longest' -- Improved completion behaviour.
     18 vim.opt.autoindent = true              -- Copy indent from current line when starting a new line.
     19 vim.opt.smartindent = true             -- Attempt to autoindent when starting a new line.
     20 vim.opt.smarttab = true                -- Use shiftwidth rather than tabstop at start of line.
     21 vim.opt.tabstop = 2                    -- Number of spaces per tab.
     22 vim.opt.shiftwidth = 2                 -- Number of spaces for each step of autoindent.
     23 vim.opt.softtabstop = 2                -- Number of spaces per tab when editing.
     24 vim.opt.expandtab = true               -- Insert spaces in place of tabs.
     25 
     26 -- Don't show warnings, errors, etc. by default.
     27 vim.diagnostic.enable(false)
     28 
     29 -- Don't try loading non-vimscript/lua plugins.
     30 vim.g.loaded_node_provider = 0
     31 vim.g.loaded_perl_provider = 0
     32 vim.g.loaded_python3_provider = 0
     33 vim.g.loaded_ruby_provider = 0
     34 
     35 -- Use fancy diagnostics icons.
     36 for type, icon in pairs({ Error = "✘", Warn = "▲", Hint = "⚑", Info = "»" }) do
     37   local hl = "DiagnosticSign" .. type
     38   vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
     39 end
     40 
     41 -- Set UI options.
     42 vim.opt.background = 'dark'
     43 vim.opt.termguicolors = true
     44 vim.opt.cursorline = true
     45 vim.opt.colorcolumn = "80"
     46 vim.opt.textwidth = 80
     47 
     48 -- Highlight cursor line only in the active window.
     49 vim.api.nvim_create_autocmd({ "WinEnter", "BufEnter", "WinLeave", "BufLeave" }, {
     50   callback = function(ev)
     51     local enable_cursorline = ev.event == "WinEnter" or ev.event == "BufEnter"
     52     vim.opt_local.cursorline = enable_cursorline
     53   end
     54 })