robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

Ayose C.feat(vim.hl): vim.hl.hl_op() #397773ace049c6a

master
3.7 KiB107 linesraw
1-- Set <space> as the leader key
2-- See `:h mapleader`
3-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
4vim.g.mapleader = ' '
5
6-- OPTIONS
7--
8-- See `:h vim.o`
9-- NOTE: You can change these options as you wish!
10-- For more options, you can see `:h option-list`
11-- To see documentation for an option, you can use `:h 'optionname'`, for example `:h 'number'`
12-- (Note the single quotes)
13
14vim.o.number = true -- Show line numbers in a column.
15
16-- Show line numbers relative to where the cursor is.
17-- Affects the 'number' option above, see `:h number_relativenumber`.
18vim.o.relativenumber = true
19
20-- Sync clipboard between OS and Neovim. Schedule the setting after `UIEnter` because it can
21-- increase startup-time. Remove this option if you want your OS clipboard to remain independent.
22-- See `:h 'clipboard'`
23vim.api.nvim_create_autocmd('UIEnter', {
24  callback = function()
25    vim.o.clipboard = 'unnamedplus'
26  end,
27})
28
29-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
30vim.o.ignorecase = true
31vim.o.smartcase = true
32
33vim.o.cursorline = true -- Highlight the line where the cursor is on.
34vim.o.scrolloff = 10 -- Keep this many screen lines above/below the cursor.
35vim.o.list = true -- Show <tab> and trailing spaces.
36
37-- If performing an operation that would fail due to unsaved changes in the buffer (like `:q`),
38-- instead raise a dialog asking if you wish to save the current file(s). See `:h 'confirm'`
39vim.o.confirm = true
40
41-- KEYMAPS
42--
43-- See `:h vim.keymap.set()`, `:h mapping`, `:h keycodes`
44
45-- Use <Esc> to exit terminal mode
46vim.keymap.set('t', '<Esc>', '<C-\\><C-n>')
47
48-- Map <A-j>, <A-k>, <A-h>, <A-l> to navigate between windows in any modes
49vim.keymap.set({ 't', 'i' }, '<A-h>', '<C-\\><C-n><C-w>h')
50vim.keymap.set({ 't', 'i' }, '<A-j>', '<C-\\><C-n><C-w>j')
51vim.keymap.set({ 't', 'i' }, '<A-k>', '<C-\\><C-n><C-w>k')
52vim.keymap.set({ 't', 'i' }, '<A-l>', '<C-\\><C-n><C-w>l')
53vim.keymap.set({ 'n' }, '<A-h>', '<C-w>h')
54vim.keymap.set({ 'n' }, '<A-j>', '<C-w>j')
55vim.keymap.set({ 'n' }, '<A-k>', '<C-w>k')
56vim.keymap.set({ 'n' }, '<A-l>', '<C-w>l')
57
58-- AUTOCOMMANDS (EVENT HANDLERS)
59--
60-- See `:h lua-guide-autocommands`, `:h autocmd`, `:h nvim_create_autocmd()`
61
62-- Highlight when yanking (copying) text.
63-- Try it with `yap` in normal mode. See `:h vim.hl.hl_op()`
64vim.api.nvim_create_autocmd('TextYankPost', {
65  desc = 'Highlight when yanking (copying) text',
66  callback = function()
67    vim.hl.hl_op()
68  end,
69})
70
71-- USER COMMANDS: DEFINE CUSTOM COMMANDS
72--
73-- See `:h nvim_create_user_command()` and `:h user-commands`
74
75-- Create a command `:GitBlameLine` that print the git blame for the current line
76vim.api.nvim_create_user_command('GitBlameLine', function()
77  local line_number = vim.fn.line('.') -- Get the current line number. See `:h line()`
78  local filename = vim.api.nvim_buf_get_name(0)
79  print(vim.system({ 'git', 'blame', '-L', line_number .. ',+1', filename }):wait().stdout)
80end, { desc = 'Print the git blame for the current line' })
81
82-- PLUGINS
83--
84-- See `:h :packadd`, `:h vim.pack`
85
86-- Add the "nohlsearch" package to automatically disable search highlighting after
87-- 'updatetime' and when going to insert mode.
88vim.cmd('packadd! nohlsearch')
89
90-- Install third-party plugins via "vim.pack.add()".
91vim.pack.add({
92  -- Quickstart configs for LSP
93  'https://github.com/neovim/nvim-lspconfig',
94  -- Fuzzy picker
95  'https://github.com/ibhagwan/fzf-lua',
96  -- Autocompletion
97  'https://github.com/nvim-mini/mini.completion',
98  -- Enhanced quickfix/loclist
99  'https://github.com/stevearc/quicker.nvim',
100  -- Git integration
101  'https://github.com/lewis6991/gitsigns.nvim',
102})
103
104require('fzf-lua').setup { fzf_colors = true }
105require('mini.completion').setup {}
106require('quicker').setup {}
107require('gitsigns').setup {}