position cursor at last position
add colorschemes move keymaps to keymaps section disable undofile
This commit is contained in:
parent
8ffeeceb75
commit
df97b1979e
74
init.lua
74
init.lua
|
@ -102,7 +102,6 @@ vim.g.have_nerd_font = false
|
|||
-- You can also add relative line numbers, to help with jumping.
|
||||
vim.opt.number = false
|
||||
vim.opt.relativenumber = false
|
||||
vim.keymap.set('n', '<leader>n', '<Esc>:set number!<Enter>:set relativenumber!<Enter>')
|
||||
|
||||
-- Enable mouse mode, can be useful for resizing splits for example!
|
||||
vim.opt.mouse = 'a'
|
||||
|
@ -122,7 +121,7 @@ end)
|
|||
vim.opt.breakindent = true
|
||||
|
||||
-- Save undo history
|
||||
vim.opt.undofile = true
|
||||
vim.opt.undofile = false
|
||||
|
||||
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
|
||||
vim.opt.ignorecase = true
|
||||
|
@ -157,6 +156,23 @@ vim.opt.cursorline = true
|
|||
-- Minimal number of screen lines to keep above and below the cursor.
|
||||
vim.opt.scrolloff = 10
|
||||
|
||||
-- Restore cursor position form last file open
|
||||
vim.api.nvim_create_autocmd('BufRead', {
|
||||
callback = function(opts)
|
||||
vim.api.nvim_create_autocmd('BufWinEnter', {
|
||||
once = true,
|
||||
buffer = opts.buf,
|
||||
callback = function()
|
||||
local ft = vim.bo[opts.buf].filetype
|
||||
local last_known_line = vim.api.nvim_buf_get_mark(opts.buf, '"')[1]
|
||||
if not (ft:match 'commit' and ft:match 'rebase') and last_known_line > 1 and last_known_line <= vim.api.nvim_buf_line_count(opts.buf) then
|
||||
vim.api.nvim_feedkeys([[g`"]], 'nx', false)
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
-- [[ Basic Keymaps ]]
|
||||
-- See `:help vim.keymap.set()`
|
||||
|
||||
|
@ -175,12 +191,6 @@ vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagn
|
|||
-- or just use <C-\><C-n> to exit terminal mode
|
||||
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
|
||||
|
||||
-- TIP: Disable arrow keys in normal mode
|
||||
-- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
|
||||
-- vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
|
||||
-- vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
|
||||
-- vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
|
||||
|
||||
-- Keybinds to make split navigation easier.
|
||||
-- Use CTRL+<hjkl> to switch between windows
|
||||
--
|
||||
|
@ -190,6 +200,12 @@ vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right win
|
|||
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
|
||||
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
|
||||
|
||||
-- Toggles
|
||||
-- Line numbers
|
||||
vim.keymap.set('n', '<leader>n', '<Esc>:set number!<Enter>:set relativenumber!<Enter>')
|
||||
-- Gitsigns
|
||||
vim.keymap.set('n', '<Leader>g', '<Esc>:Gitsigns toggle_signs<Enter>', { desc = 'Toggle Gitsigns' })
|
||||
|
||||
-- [[ Basic Autocommands ]]
|
||||
-- See `:help lua-guide-autocommands`
|
||||
|
||||
|
@ -437,6 +453,12 @@ require('lazy').setup({
|
|||
end,
|
||||
},
|
||||
|
||||
{ -- Lush colorscheme helper
|
||||
'rktjmp/lush.nvim',
|
||||
-- if you wish to use your own colorscheme:
|
||||
-- { dir = '/absolute/path/to/colorscheme', lazy = true },
|
||||
},
|
||||
|
||||
-- LSP Plugins
|
||||
{
|
||||
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
|
||||
|
@ -833,24 +855,36 @@ require('lazy').setup({
|
|||
end,
|
||||
},
|
||||
|
||||
{ -- You can easily change to a different colorscheme.
|
||||
-- Change the name of the colorscheme plugin below, and then
|
||||
-- change the command in the config to whatever the name of that colorscheme is.
|
||||
--
|
||||
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
|
||||
--
|
||||
-- COLORSCHEMES
|
||||
--
|
||||
{ -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
|
||||
'folke/tokyonight.nvim',
|
||||
priority = 1000, -- Make sure to load this before all the other start plugins.
|
||||
init = function()
|
||||
-- Load the colorscheme here.
|
||||
-- Like many other themes, this one has different styles, and you could load
|
||||
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
|
||||
vim.cmd.colorscheme 'tokyonight-night'
|
||||
|
||||
-- You can configure highlights by doing something like:
|
||||
vim.cmd.hi 'Comment gui=none'
|
||||
vim.cmd.colorscheme 'tokyonight'
|
||||
end,
|
||||
},
|
||||
|
||||
{ 'zenbones-theme/zenbones.nvim', dependencies = 'rktjmp/lush.nvim', lazy = false, priority = 1000 },
|
||||
{ 'catppuccin/nvim', name = 'catppuccin', priority = 1000 },
|
||||
{ 'navarasu/onedark.nvim', name = 'onedark', priority = 1000 },
|
||||
{ 'scottmckendry/cyberdream.nvim', lazy = false, priority = 1000 },
|
||||
|
||||
{
|
||||
'yorik1984/newpaper.nvim',
|
||||
priority = 1000,
|
||||
config = function()
|
||||
vim.g.newpaper_style = 'light'
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
'rebelot/kanagawa.nvim',
|
||||
priority = 1000,
|
||||
},
|
||||
|
||||
-- Highlight todo, notes, etc in comments
|
||||
{ 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },
|
||||
|
||||
|
@ -937,7 +971,7 @@ require('lazy').setup({
|
|||
-- This is the easiest way to modularize your config.
|
||||
--
|
||||
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
|
||||
-- { import = 'custom.plugins' },
|
||||
{ import = 'custom.plugins' },
|
||||
--
|
||||
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
|
||||
-- Or use telescope!
|
||||
|
|
Loading…
Reference in New Issue