Skip to content

Commit caf0fee

Browse files
committed
continue refact
1 parent b0112c0 commit caf0fee

File tree

4 files changed

+117
-109
lines changed

4 files changed

+117
-109
lines changed

init.lua

Lines changed: 2 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -7,115 +7,8 @@ vim.g.maplocalleader = ' '
77
-- Custom remaps
88
require 'custom.remap'
99

10-
-- Set to true if you have a Nerd Font installed and selected in the terminal
11-
vim.g.have_nerd_font = true
12-
13-
-- [[ Setting options ]]
14-
-- See `:help vim.opt`
15-
-- NOTE: You can change these options as you wish!
16-
-- For more options, you can see `:help option-list`
17-
18-
-- Make line numbers default
19-
vim.opt.number = true
20-
-- You can also add relative line numbers, to help with jumping.
21-
-- Experiment for yourself to see if you like it!
22-
vim.opt.relativenumber = true
23-
24-
-- Enable mouse mode, can be useful for resizing splits for example!
25-
vim.opt.mouse = 'a'
26-
27-
-- Don't show the mode, since it's already in the status line
28-
vim.opt.showmode = false
29-
30-
-- Sync clipboard between OS and Neovim.
31-
-- Schedule the setting after `UiEnter` because it can increase startup-time.
32-
-- Remove this option if you want your OS clipboard to remain independent.
33-
-- See `:help 'clipboard'`
34-
vim.schedule(function()
35-
vim.opt.clipboard = 'unnamedplus'
36-
end)
37-
38-
-- Enable break indent
39-
vim.opt.breakindent = true
40-
41-
-- Save undo history
42-
vim.opt.undofile = true
43-
44-
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
45-
vim.opt.ignorecase = true
46-
vim.opt.smartcase = true
47-
48-
-- Keep signcolumn on by default
49-
vim.opt.signcolumn = 'yes'
50-
51-
-- Decrease update time
52-
vim.opt.updatetime = 250
53-
54-
-- Decrease mapped sequence wait time
55-
vim.opt.timeoutlen = 300
56-
57-
-- Configure how new splits should be opened
58-
vim.opt.splitright = true
59-
vim.opt.splitbelow = true
60-
61-
-- Sets how neovim will display certain whitespace characters in the editor.
62-
-- See `:help 'list'`
63-
-- and `:help 'listchars'`
64-
vim.opt.list = true
65-
vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '' }
66-
67-
-- Preview substitutions live, as you type!
68-
vim.opt.inccommand = 'split'
69-
70-
-- Show which line your cursor is on
71-
vim.opt.cursorline = true
72-
73-
-- Minimal number of screen lines to keep above and below the cursor.
74-
vim.opt.scrolloff = 10
75-
76-
-- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`),
77-
-- instead raise a dialog asking if you wish to save the current file(s)
78-
-- See `:help 'confirm'`
79-
vim.opt.confirm = true
80-
81-
-- [[ Basic Keymaps ]]
82-
-- See `:help vim.keymap.set()`
83-
84-
-- Clear highlights on search when pressing <Esc> in normal mode
85-
-- See `:help hlsearch`
86-
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
87-
88-
-- Diagnostic keymaps
89-
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
90-
91-
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
92-
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
93-
-- is not what someone will guess without a bit more experience.
94-
--
95-
-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping
96-
-- or just use <C-\><C-n> to exit terminal mode
97-
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
98-
99-
-- TIP: Disable arrow keys in normal mode
100-
vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
101-
vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
102-
vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
103-
vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
104-
105-
-- Keybinds to make split navigation easier.
106-
-- Use CTRL+<hjkl> to switch between windows
107-
--
108-
-- See `:help wincmd` for a list of all window commands
109-
vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' })
110-
vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
111-
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
112-
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
113-
114-
-- NOTE: Some terminals have colliding keymaps or are not able to send distinct keycodes
115-
-- vim.keymap.set("n", "<C-S-h>", "<C-w>H", { desc = "Move window to the left" })
116-
-- vim.keymap.set("n", "<C-S-l>", "<C-w>L", { desc = "Move window to the right" })
117-
-- vim.keymap.set("n", "<C-S-j>", "<C-w>J", { desc = "Move window to the lower" })
118-
-- vim.keymap.set("n", "<C-S-k>", "<C-w>K", { desc = "Move window to the upper" })
10+
-- Sets
11+
require 'custom.sets'
11912

12013
-- [[ Basic Autocommands ]]
12114
-- See `:help lua-guide-autocommands`

lua/custom/remap.lua

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,42 @@ vim.api.nvim_set_hl(0, 'NormalFloat', { bg = 'none' })
1212

1313
-- Undotree
1414
vim.keymap.set('n', '<F5>', vim.cmd.UndotreeToggle)
15+
16+
-- [[ Basic Keymaps ]]
17+
-- See `:help vim.keymap.set()`
18+
19+
-- Clear highlights on search when pressing <Esc> in normal mode
20+
-- See `:help hlsearch`
21+
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
22+
23+
-- Diagnostic keymaps
24+
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
25+
26+
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
27+
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
28+
-- is not what someone will guess without a bit more experience.
29+
--
30+
-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping
31+
-- or just use <C-\><C-n> to exit terminal mode
32+
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
33+
34+
-- TIP: Disable arrow keys in normal mode
35+
vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
36+
vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
37+
vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
38+
vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
39+
40+
-- Keybinds to make split navigation easier.
41+
-- Use CTRL+<hjkl> to switch between windows
42+
--
43+
-- See `:help wincmd` for a list of all window commands
44+
vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' })
45+
vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
46+
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
47+
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
48+
49+
-- NOTE: Some terminals have colliding keymaps or are not able to send distinct keycodes
50+
-- vim.keymap.set("n", "<C-S-h>", "<C-w>H", { desc = "Move window to the left" })
51+
-- vim.keymap.set("n", "<C-S-l>", "<C-w>L", { desc = "Move window to the right" })
52+
-- vim.keymap.set("n", "<C-S-j>", "<C-w>J", { desc = "Move window to the lower" })
53+
-- vim.keymap.set("n", "<C-S-k>", "<C-w>K", { desc = "Move window to the upper" })

lua/custom/sets.lua

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
-- Set to true if you have a Nerd Font installed and selected in the terminal
2+
vim.g.have_nerd_font = true
3+
4+
-- [[ Setting options ]]
5+
-- See `:help vim.opt`
6+
-- NOTE: You can change these options as you wish!
7+
-- For more options, you can see `:help option-list`
8+
9+
-- Make line numbers default
10+
vim.opt.number = true
11+
-- You can also add relative line numbers, to help with jumping.
12+
-- Experiment for yourself to see if you like it!
13+
vim.opt.relativenumber = true
14+
15+
-- Enable mouse mode, can be useful for resizing splits for example!
16+
vim.opt.mouse = 'a'
17+
18+
-- Don't show the mode, since it's already in the status line
19+
vim.opt.showmode = false
20+
21+
-- Sync clipboard between OS and Neovim.
22+
-- Schedule the setting after `UiEnter` because it can increase startup-time.
23+
-- Remove this option if you want your OS clipboard to remain independent.
24+
-- See `:help 'clipboard'`
25+
vim.schedule(function()
26+
vim.opt.clipboard = 'unnamedplus'
27+
end)
28+
29+
-- Enable break indent
30+
vim.opt.breakindent = true
31+
32+
-- Save undo history
33+
vim.opt.undofile = true
34+
35+
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
36+
vim.opt.ignorecase = true
37+
vim.opt.smartcase = true
38+
39+
-- Keep signcolumn on by default
40+
vim.opt.signcolumn = 'yes'
41+
42+
-- Decrease update time
43+
vim.opt.updatetime = 250
44+
45+
-- Decrease mapped sequence wait time
46+
vim.opt.timeoutlen = 300
47+
48+
-- Configure how new splits should be opened
49+
vim.opt.splitright = true
50+
vim.opt.splitbelow = true
51+
52+
-- Sets how neovim will display certain whitespace characters in the editor.
53+
-- See `:help 'list'`
54+
-- and `:help 'listchars'`
55+
vim.opt.list = true
56+
vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '' }
57+
58+
-- Preview substitutions live, as you type!
59+
vim.opt.inccommand = 'split'
60+
61+
-- Show which line your cursor is on
62+
vim.opt.cursorline = true
63+
64+
-- Minimal number of screen lines to keep above and below the cursor.
65+
vim.opt.scrolloff = 10
66+
67+
-- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`),
68+
-- instead raise a dialog asking if you wish to save the current file(s)
69+
-- See `:help 'confirm'`
70+
vim.opt.confirm = true

package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)