feat: Set options
This commit is contained in:
parent
6902d22f20
commit
d6bc5033ae
5 changed files with 172 additions and 2 deletions
|
@ -31,9 +31,10 @@ with final.pkgs.lib; let
|
|||
];
|
||||
|
||||
extraPackages = with pkgs; [
|
||||
ripgrep
|
||||
# language servers, etc.
|
||||
lua-language-server
|
||||
nixd # nix LSP
|
||||
nixd
|
||||
];
|
||||
in {
|
||||
# This is the neovim derivation returned by the overlay.
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
-- Native plugins
|
||||
vim.cmd.filetype('plugin', 'indent', 'on')
|
||||
|
||||
-- let sqlite.lua (which some plugins depend on) know where to find sqlite
|
||||
vim.g.sqlite_clib_path = require('luv').os_getenv('LIBSQLITE')
|
||||
|
||||
require('options')
|
||||
require('keymaps')
|
||||
|
|
4
nvim/lua/keymaps.lua
Normal file
4
nvim/lua/keymaps.lua
Normal file
|
@ -0,0 +1,4 @@
|
|||
local g = vim.g
|
||||
|
||||
g.mapleader = ' '
|
||||
g.maplocalleader = '\\'
|
25
nvim/lua/lib/lazyvim/ui.lua
Normal file
25
nvim/lua/lib/lazyvim/ui.lua
Normal file
|
@ -0,0 +1,25 @@
|
|||
--https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/util/ui.lua
|
||||
|
||||
---@class lib.lazyvim.ui
|
||||
local M = {}
|
||||
|
||||
-- Optimized treesitter foldexpr for Neovim >= 0.10.0
|
||||
function M.foldexpr()
|
||||
local buf = vim.api.nvim_get_current_buf()
|
||||
if vim.b[buf].ts_folds == nil then
|
||||
-- as long as we don't have a filetype, don't bother checking if treesitter
|
||||
-- is available (it won't be)
|
||||
if vim.bo[buf].filetype == '' then
|
||||
return '0'
|
||||
end
|
||||
if vim.bo[buf].filetype:find('dashboard') then
|
||||
vim.b[buf].ts_folds = false
|
||||
else
|
||||
vim.b[buf].ts_folds = pcall(vim.treesitter.get_parser, buf)
|
||||
end
|
||||
end
|
||||
|
||||
return vim.b[buf].ts_folds and vim.treesitter.foldexpr() or '0'
|
||||
end
|
||||
|
||||
return M
|
138
nvim/lua/options.lua
Normal file
138
nvim/lua/options.lua
Normal file
|
@ -0,0 +1,138 @@
|
|||
local g = vim.g
|
||||
local opt = vim.opt
|
||||
|
||||
-- Root dir detection options.
|
||||
-- Each entry can be:
|
||||
-- * the name of a detector function like `lsp` or `cwd`
|
||||
-- * a pattern or array of patterns like `.git` or `lua`
|
||||
-- * a function with signature `function(buf) -> string|string[]`
|
||||
g.root_spec = { 'lsp', { '.git', 'lua' }, 'cwd' }
|
||||
|
||||
-- Only set clipboard if not in SSH, to make sure the OSC 52 integration works
|
||||
-- automatically. Requires Neovim >= 0.10.0.
|
||||
-- `unnamedplus` is the system clipboard.
|
||||
opt.clipboard = vim.env.SSH_TTY and '' or 'unnamedplus'
|
||||
|
||||
-- Relative line numbers.
|
||||
opt.number = true
|
||||
opt.relativenumber = true
|
||||
|
||||
-- Set <Tab> to 2 spaces.
|
||||
opt.expandtab = true
|
||||
opt.shiftwidth = 2
|
||||
opt.tabstop = 2
|
||||
|
||||
-- Smart/auto indenting.
|
||||
opt.shiftround = true
|
||||
opt.smartindent = true
|
||||
opt.breakindent = true
|
||||
|
||||
-- Show matches in real time while searching.
|
||||
opt.hlsearch = true
|
||||
opt.incsearch = true
|
||||
|
||||
-- Disable text wrap.
|
||||
opt.wrap = false
|
||||
|
||||
-- Better splitting.
|
||||
opt.splitbelow = true
|
||||
opt.splitright = true
|
||||
|
||||
-- Enable mouse mode.
|
||||
opt.mouse = 'a'
|
||||
|
||||
-- Smart handling of case when searching.
|
||||
opt.ignorecase = true
|
||||
opt.smartcase = true
|
||||
|
||||
-- Use Ripgrep for searching.
|
||||
opt.grepprg = 'rg --vimgrep'
|
||||
opt.grepformat = '%f:%l:%c:%m'
|
||||
|
||||
-- More frequent swap file saving.
|
||||
opt.updatetime = 200
|
||||
|
||||
-- Completion options.
|
||||
opt.completeopt = { 'menu', 'menuone', 'noselect', 'noinsert' }
|
||||
|
||||
-- Persistant & bigger undo history.
|
||||
opt.undofile = true
|
||||
opt.undolevels = 10000
|
||||
|
||||
-- Enable 24-bit colors.
|
||||
opt.termguicolors = true
|
||||
|
||||
-- Always show the signcolumn to keep the text from jumping.
|
||||
opt.signcolumn = 'yes'
|
||||
|
||||
-- Highlight the current line.
|
||||
opt.cursorline = true
|
||||
|
||||
-- Fold settings.
|
||||
opt.foldcolumn = '1'
|
||||
opt.foldlevel = 99
|
||||
opt.foldenable = true
|
||||
opt.foldmethod = 'expr'
|
||||
opt.foldexpr = "v:lua.require'lib.lazyvim.ui'.foldtext()"
|
||||
opt.foldtext = ''
|
||||
|
||||
-- Always keep 4 lines above/below cursor.
|
||||
opt.scrolloff = 4
|
||||
|
||||
-- Max width.
|
||||
opt.textwidth = 80
|
||||
opt.colorcolumn = '+1'
|
||||
|
||||
-- Show some invisible chars.
|
||||
opt.list = true
|
||||
opt.listchars = { tab = '->', trail = '·' }
|
||||
|
||||
-- Only show a single statusline instead of one for each window.
|
||||
opt.laststatus = 3
|
||||
|
||||
-- Preview subsitutions as you type.
|
||||
opt.inccommand = 'split'
|
||||
|
||||
-- Ask to save changes before exiting modified buffer.
|
||||
opt.confirm = true
|
||||
|
||||
-- I don't understand this but LazyVim sets it and it seems like a good idea.
|
||||
opt.jumpoptions = 'view'
|
||||
|
||||
-- Enable a little transparency for pop-ups.
|
||||
opt.pumblend = 10
|
||||
|
||||
-- Disable default line/col numbers in statusline.
|
||||
opt.ruler = false
|
||||
|
||||
-- What to save when calling :mksession.
|
||||
opt.sessionoptions = {
|
||||
'buffers',
|
||||
'curdir',
|
||||
'tabpages',
|
||||
'winsize',
|
||||
'help',
|
||||
'globals',
|
||||
'skiprtp',
|
||||
'folds',
|
||||
}
|
||||
|
||||
-- Scrolling.
|
||||
opt.smoothscroll = true
|
||||
opt.sidescroll = 1
|
||||
opt.sidescrolloff = 8
|
||||
|
||||
-- Spelling suggestions language.
|
||||
opt.spelllang = { 'en' }
|
||||
|
||||
-- Allow cursor to move where there is no text in visual block mode.
|
||||
opt.virtualedit = 'block'
|
||||
|
||||
-- Command mode completion mode.
|
||||
opt.wildmode = { 'longest:full', 'full' }
|
||||
|
||||
-- Min window width when splitting.
|
||||
opt.winminwidth = 5
|
||||
|
||||
-- Disable some messages.
|
||||
opt.shortmess:append({ W = true, I = true, c = true, C = true })
|
Loading…
Reference in a new issue