Skip to content

Commit 28121ba

Browse files
Current NeoVim Config
1 parent dbba54c commit 28121ba

File tree

2 files changed

+297
-10
lines changed

2 files changed

+297
-10
lines changed

init.lua

Lines changed: 160 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
=====================================================================
2121
=====================================================================
2222
23+
24+
25+
26+
2327
What is Kickstart?
2428
2529
Kickstart.nvim is *not* a distribution.
@@ -84,6 +88,28 @@ I hope you enjoy your Neovim journey,
8488
P.S. You can delete this when you're done too. It's your config now! :)
8589
--]]
8690

91+
vim.api.nvim_set_keymap('n', 'Ø', ':E<CR>', { noremap = true, silent = true })
92+
-- command line height standard 1
93+
vim.opt.cmdheight = 1
94+
95+
-- Remap ø to <CR> in normal, visual, and operator-pending modes
96+
vim.api.nvim_set_keymap('n', 'ø', '<CR>', { noremap = true, silent = true })
97+
vim.api.nvim_set_keymap('v', 'ø', '<CR>', { noremap = true, silent = true })
98+
vim.api.nvim_set_keymap('o', 'ø', '<CR>', { noremap = true, silent = true })
99+
100+
-- Remap ø to <CR> in insert mode
101+
vim.api.nvim_set_keymap('i', 'ø', '<CR>', { noremap = true, silent = true })
102+
103+
-- Remap æ to <Esc> in normal, visual, and operator-pending modes
104+
vim.api.nvim_set_keymap('n', 'æ', '<Esc>', { noremap = true, silent = true })
105+
vim.api.nvim_set_keymap('v', 'æ', '<Esc>', { noremap = true, silent = true })
106+
vim.api.nvim_set_keymap('o', 'æ', '<Esc>', { noremap = true, silent = true })
107+
108+
-- Remap æ to <Esc> in insert mode
109+
vim.api.nvim_set_keymap('i', 'æ', '<Esc>', { noremap = true, silent = true })
110+
111+
-- remap shift æ to delete and fn æ to backspace
112+
87113
-- Set <space> as the leader key
88114
-- See `:help mapleader`
89115
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
@@ -102,7 +128,7 @@ vim.g.have_nerd_font = false
102128
vim.opt.number = true
103129
-- You can also add relative line numbers, to help with jumping.
104130
-- Experiment for yourself to see if you like it!
105-
-- vim.opt.relativenumber = true
131+
vim.opt.relativenumber = false
106132

107133
-- Enable mouse mode, can be useful for resizing splits for example!
108134
vim.opt.mouse = 'a'
@@ -223,10 +249,27 @@ vim.opt.rtp:prepend(lazypath)
223249
-- To update plugins you can run
224250
-- :Lazy update
225251
--
252+
226253
-- NOTE: Here is where you install your plugins.
227254
require('lazy').setup({
255+
256+
{
257+
'kylechui/nvim-surround',
258+
version = '*', -- Use for stability; omit to use `main` branch for the latest features
259+
event = 'VeryLazy',
260+
config = function()
261+
require('nvim-surround').setup {
262+
-- Configuration here, or leave empty to use defaults
263+
}
264+
end,
265+
},
228266
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
229267
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
268+
'sainnhe/gruvbox-material',
269+
-- 'segeljakt/vim-silicon',
270+
271+
{ 'numToStr/Comment.nvim', opts = {} },
272+
-- { 'tris203/precognition.nvim', opts = {} },
230273

231274
-- NOTE: Plugins can also be added by using a table,
232275
-- with the first argument being the link and the following
@@ -236,10 +279,86 @@ require('lazy').setup({
236279
--
237280
-- This is equivalent to:
238281
-- require('Comment').setup({})
282+
{
283+
'ThePrimeagen/harpoon',
284+
branch = 'harpoon2',
285+
dependencies = { 'nvim-lua/plenary.nvim' },
286+
config = function()
287+
local harpoon = require 'harpoon'
288+
289+
-- REQUIRED
290+
harpoon:setup()
291+
-- REQUIRED
292+
293+
vim.keymap.set('n', '<leader>a', function()
294+
harpoon:list():add()
295+
end)
296+
vim.keymap.set('n', '<leader>h', function()
297+
harpoon.ui:toggle_quick_menu(harpoon:list())
298+
end)
299+
300+
vim.keymap.set('n', '<C-h>', function()
301+
harpoon:list():select(1)
302+
end)
303+
vim.keymap.set('n', '<C-j>', function()
304+
harpoon:list():select(2)
305+
end)
306+
vim.keymap.set('n', '<C-k>', function()
307+
harpoon:list():select(3)
308+
end)
309+
vim.keymap.set('n', '<C-l>', function()
310+
harpoon:list():select(4)
311+
end)
312+
313+
-- Toggle previous & next buffers stored within Harpoon list
314+
vim.keymap.set('n', '<C-S-P>', function()
315+
harpoon:list():prev()
316+
end)
317+
vim.keymap.set('n', '<C-S-N>', function()
318+
harpoon:list():next()
319+
end)
320+
local conf = require('telescope.config').values
321+
local function toggle_telescope(harpoon_files)
322+
local file_paths = {}
323+
for _, item in ipairs(harpoon_files.items) do
324+
table.insert(file_paths, item.value)
325+
end
326+
327+
require('telescope.pickers')
328+
.new({}, {
329+
prompt_title = 'Harpoon',
330+
finder = require('telescope.finders').new_table {
331+
results = file_paths,
332+
},
333+
previewer = conf.file_previewer {},
334+
sorter = conf.generic_sorter {},
335+
})
336+
:find()
337+
end
239338

339+
vim.keymap.set('n', '<C-e>', function()
340+
toggle_telescope(harpoon:list())
341+
end, { desc = 'Open harpoon window' })
342+
end,
343+
},
240344
-- "gc" to comment visual regions/lines
241345
{ 'numToStr/Comment.nvim', opts = {} },
242346

347+
-- better editing for directories/files etc
348+
{
349+
'stevearc/oil.nvim',
350+
---@module 'oil'
351+
---@type oil.SetupOpts
352+
opts = {},
353+
-- Optional dependencies
354+
dependencies = { { 'echasnovski/mini.icons', opts = {} } },
355+
config = function()
356+
require('oil').setup()
357+
vim.keymap.set('n', '-', '<CMD>Oil<CR>', { desc = 'Open parent directory' })
358+
end,
359+
-- dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if prefer nvim-web-devicons
360+
},
361+
243362
-- Here is a more advanced example where we pass configuration
244363
-- options to `gitsigns.nvim`. This is equivalent to the following Lua:
245364
-- require('gitsigns').setup({ ... })
@@ -539,8 +658,16 @@ require('lazy').setup({
539658
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
540659
local servers = {
541660
-- clangd = {},
542-
-- gopls = {},
543-
-- pyright = {},
661+
gopls = {},
662+
pyright = {},
663+
html = {},
664+
intelephense = {},
665+
tsserver = {},
666+
cssls = {},
667+
vls = {},
668+
volar = {
669+
filetypes = { 'vue' }, -- Use volar specifically for Vue files
670+
},
544671
-- rust_analyzer = {},
545672
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
546673
--
@@ -614,6 +741,7 @@ require('lazy').setup({
614741
end,
615742
formatters_by_ft = {
616743
lua = { 'stylua' },
744+
ocaml = { 'ocamlformat', 'ocp-indent' },
617745
-- Conform can also run multiple formatters sequentially
618746
-- python = { "isort", "black" },
619747
--
@@ -672,7 +800,11 @@ require('lazy').setup({
672800
luasnip.lsp_expand(args.body)
673801
end,
674802
},
675-
completion = { completeopt = 'menu,menuone,noinsert' },
803+
completion = {
804+
-- removes automatic autocomplete popup, just remove if regret(keep completeopt):
805+
autocomplete = false,
806+
completeopt = 'menu,menuone,noinsert',
807+
},
676808

677809
-- For an understanding of why these mappings were
678810
-- chosen, you will need to read `:help ins-completion`
@@ -730,18 +862,36 @@ require('lazy').setup({
730862
},
731863

732864
{ -- You can easily change to a different colorscheme.
865+
-- This is where i config colorscheme / theme of nvim
733866
-- Change the name of the colorscheme plugin below, and then
734867
-- change the command in the config to whatever the name of that colorscheme is.
735868
--
736869
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
737-
'folke/tokyonight.nvim',
870+
871+
'catppuccin/nvim',
738872
priority = 1000, -- Make sure to load this before all the other start plugins.
739873
init = function()
874+
require('catppuccin').setup {
875+
-- color_overrides = {
876+
-- all = {},
877+
-- latte = {
878+
-- base = '#ffffff',
879+
-- mantle = '#000000',
880+
-- crust = '#474747',
881+
-- },
882+
-- },
883+
custom_highlights = function(colors)
884+
return {
885+
Comment = { fg = colors.pink },
886+
}
887+
end,
888+
}
740889
-- Load the colorscheme here.
741890
-- Like many other themes, this one has different styles, and you could load
742891
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
743-
vim.cmd.colorscheme 'tokyonight-night'
744892

893+
vim.cmd.colorscheme 'catppuccin-latte'
894+
-- vim.cmd.colorscheme 'rose-pine-dawn'
745895
-- You can configure highlights by doing something like:
746896
vim.cmd.hi 'Comment gui=none'
747897
end,
@@ -763,7 +913,7 @@ require('lazy').setup({
763913

764914
-- Add/delete/replace surroundings (brackets, quotes, etc.)
765915
--
766-
-- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren
916+
-- - siw) - [S]urround [A]dd [I]nner [W]ord [)]Paren
767917
-- - sd' - [S]urround [D]elete [']quotes
768918
-- - sr)' - [S]urround [R]eplace [)] [']
769919
require('mini.surround').setup()
@@ -791,15 +941,15 @@ require('lazy').setup({
791941
'nvim-treesitter/nvim-treesitter',
792942
build = ':TSUpdate',
793943
opts = {
794-
ensure_installed = { 'bash', 'c', 'html', 'lua', 'markdown', 'vim', 'vimdoc' },
944+
ensure_installed = { 'bash', 'c', 'html', 'lua', 'markdown', 'vim', 'vimdoc', 'css', 'javascript', 'ocaml' },
795945
-- Autoinstall languages that are not installed
796946
auto_install = true,
797947
highlight = {
798948
enable = true,
799949
-- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules.
800950
-- If you are experiencing weird indenting issues, add the language to
801951
-- the list of additional_vim_regex_highlighting and disabled languages for indent.
802-
additional_vim_regex_highlighting = { 'ruby' },
952+
additional_vim_regex_highlighting = { 'ruby', 'ocaml' },
803953
},
804954
indent = { enable = true, disable = { 'ruby' } },
805955
},
@@ -836,7 +986,7 @@ require('lazy').setup({
836986
--
837987
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
838988
-- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins`
839-
-- { import = 'custom.plugins' },
989+
-- { import = 'custom.plugins' }
840990
}, {
841991
ui = {
842992
-- If you are using a Nerd Font: set icons to an empty table which will use the

0 commit comments

Comments
 (0)