Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
f8d08ae
 Setup: mini config
coderj001 Oct 31, 2023
6d771e3
😳 Added: colorscheme
coderj001 Oct 31, 2023
7606bc5
💋Fix: git, statusline and telescope
coderj001 Oct 31, 2023
a23d3e9
😙Final: added autocmds, basic and extras
coderj001 Oct 31, 2023
d26f958
update code
coderj001 Oct 31, 2023
d600d76
updated code
coderj001 Oct 31, 2023
a0420f4
舘Added: Dashboard
coderj001 Oct 31, 2023
1f3e512
🌱 added: bufferline and rest
coderj001 Oct 31, 2023
980fdae
勇Update: configs, cmp configs and explorer
coderj001 Nov 1, 2023
aa6db89
 Update: few config like noti and treesttter
coderj001 Nov 2, 2023
90470e8
󰩐 update: autocmds, options and settings
coderj001 Nov 3, 2023
db1e045
😆Updates: keymaps for gitsigns
coderj001 Nov 3, 2023
0182ab3
 updated: configs and keymaps
coderj001 Nov 3, 2023
0f653e8
󱖫 Added: config for statusline
coderj001 Nov 5, 2023
c3414d3
 Added: config for lazy, basic and cmp plugins
coderj001 Nov 5, 2023
865b273
 Added: config colorschemes
coderj001 Nov 5, 2023
1b5f1b5
 Add: explorer config
coderj001 Nov 5, 2023
6341c81
 Updated: colorschemes and lazy configs
coderj001 Nov 5, 2023
7d0e612
😆Added: Vscode.vim in lua
coderj001 Nov 6, 2023
6f2a018
😏 Updated: tmux config, wasp config and added gopls
coderj001 Nov 6, 2023
cd16fce
📄 Updated files: colorschemes, nightfox, wilder and galaxyline
coderj001 Nov 7, 2023
7316081
👺Added: snippet/go.lua
coderj001 Nov 7, 2023
d04db81
 Adedd: go snippets/go.lua and changes wilder
coderj001 Nov 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ test.sh
.luarc.json
nvim
plugin/packer_compiled.lua
lazy-locak.json
132 changes: 130 additions & 2 deletions init.lua
Original file line number Diff line number Diff line change
@@ -1,2 +1,130 @@
require "core"
require "plugin"
if vim.g.vscode then
print("VSCode")
-- VSCode
local function split(direction, file)
if direction == 'h' then
vim.fn["VSCodeCall"]('workbench.action.splitEditorDown')
else
vim.fn["VSCodeCall"]('workbench.action.splitEditorRight')
end
if file ~= '' then
vim.fn["VSCodeExtensionNotify"]('open-file', vim.fn["expand"](file), 'all')
end
end

local function splitNew(direction, file)
local fileToOpen = file == '' and '__vscode_new__' or file
split(direction, fileToOpen)
end

local function closeOtherEditors()
vim.fn["VSCodeNotify"]('workbench.action.closeEditorsInOtherGroups')
vim.fn["VSCodeNotify"]('workbench.action.closeOtherEditors')
end

local function manageEditorSize(count, to)
for i = 1, count or 1 do
local action = to == 'increase' and 'workbench.action.increaseViewSize' or 'workbench.action.decreaseViewSize'
vim.fn["VSCodeNotify"](action)
end
end

vim.cmd("command! -complete=file -nargs=? Split call v:lua.split('h', <q-args>)")
vim.cmd("command! -complete=file -nargs=? Vsplit call v:lua.split('v', <q-args>)")
vim.cmd("command! -complete=file -nargs=? New call v:lua.split('h', '__vscode_new__')")
vim.cmd("command! -complete=file -nargs=? Vnew call v:lua.split('v', '__vscode_new__')")
vim.cmd(
"command! -bang Only if <q-bang> == '!' | call v:lua.closeOtherEditors() | else | call VSCodeNotify('workbench.action.joinAllGroups') | endif")

vim.api.nvim_set_keymap('n', '<C-w>s', ':call v:lua.split("h")<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('x', '<C-w>s', ':call v:lua.split("h")<CR>', { noremap = true, silent = true })

vim.api.nvim_set_keymap('n', '<C-w>v', ':call v:lua.split("v")<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('x', '<C-w>v', ':call v:lua.split("v")<CR>', { noremap = true, silent = true })

vim.api.nvim_set_keymap('n', '<C-w>n', ':call v:lua.splitNew("h", "__vscode_new__")<CR>',
{ noremap = true, silent = true })
vim.api.nvim_set_keymap('x', '<C-w>n', ':call v:lua.splitNew("h", "__vscode_new__")<CR>',
{ noremap = true, silent = true })

vim.api.nvim_set_keymap('n', '<C-w>=', ':<C-u>call VSCodeNotify("workbench.action.evenEditorWidths")<CR>',
{ noremap = true, silent = true })
vim.api.nvim_set_keymap('x', '<C-w>=', ':<C-u>call VSCodeNotify("workbench.action.evenEditorWidths")<CR>',
{ noremap = true, silent = true })

vim.api.nvim_set_keymap('n', '<C-w>>', ':<C-u>call v:lua.manageEditorSize(v:count, "increase")<CR>',
{ noremap = true, silent = true })
vim.api.nvim_set_keymap('x', '<C-w>>', ':<C-u>call v:lua.manageEditorSize(v:count, "increase")<CR>',
{ noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<C-w>+', ':<C-u>call v:lua.manageEditorSize(v:count, "increase")<CR>',
{ noremap = true, silent = true })
vim.api.nvim_set_keymap('x', '<C-w>+', ':<C-u>call v:lua.manageEditorSize(v:count, "increase")<CR>',
{ noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<C-w><', ':<C-u>call v:lua.manageEditorSize(v:count, "decrease")<CR>',
{ noremap = true, silent = true })
vim.api.nvim_set_keymap('x', '<C-w><', ':<C-u>call v:lua.manageEditorSize(v:count, "decrease")<CR>',
{ noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<C-w>-', ':<C-u>call v:lua.manageEditorSize(v:count, "decrease")<CR>',
{ noremap = true, silent = true })
vim.api.nvim_set_keymap('x', '<C-w>-', ':<C-u>call v:lua.manageEditorSize(v:count, "decrease")<CR>',
{ noremap = true, silent = true })

-- Better Navigation
vim.api.nvim_set_keymap('n', '<C-j>', ':call VSCodeNotify("workbench.action.navigateDown")<CR>',
{ noremap = true, silent = true })
vim.api.nvim_set_keymap('x', '<C-j>', ':call VSCodeNotify("workbench.action.navigateDown")<CR>',
{ noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<C-k>', ':call VSCodeNotify("workbench.action.navigateUp")<CR>',
{ noremap = true, silent = true })
vim.api.nvim_set_keymap('x', '<C-k>', ':call VSCodeNotify("workbench.action.navigateUp")<CR>',
{ noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<C-h>', ':call VSCodeNotify("workbench.action.navigateLeft")<CR>',
{ noremap = true, silent = true })
vim.api.nvim_set_keymap('x', '<C-h>', ':call VSCodeNotify("workbench.action.navigateLeft")<CR>',
{ noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<C-l>', ':call VSCodeNotify("workbench.action.navigateRight")<CR>',
{ noremap = true, silent = true })
vim.api.nvim_set_keymap('x', '<C-l>', ':call VSCodeNotify("workbench.action.navigateRight")<CR>',
{ noremap = true, silent = true })

-- Bind C-/ to vscode commentary
vim.api.nvim_set_keymap('x', '<C-/>', ':call Comment()<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<C-/>', ':call Comment()<CR>', { noremap = true, silent = true })

vim.api.nvim_set_keymap('n', '<C-w>_', ':<C-u>call VSCodeNotify("workbench.action.toggleEditorWidths")<CR>',
{ noremap = true, silent = true })

vim.api.nvim_set_keymap('n', '<Space>', ':call VSCodeNotify("whichkey.show")<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('x', '<Space>', ':call VSCodeNotify("whichkey.show")<CR>', { noremap = true, silent = true })

-- Relative Number
vim.cmd("command! Nu call VSCodeCall('settings.cycle.relativeLineNumbers')")
vim.cmd("autocmd InsertEnter * :Nu")
vim.cmd("autocmd InsertLeave * :Nu")

-- vim-commentary
vim.api.nvim_set_keymap('x', 'gc', '<Plug>VSCodeCommentary', {})
vim.api.nvim_set_keymap('n', 'gc', '<Plug>VSCodeCommentary', {})
vim.api.nvim_set_keymap('o', 'gc', '<Plug>VSCodeCommentary', {})
vim.api.nvim_set_keymap('n', 'gcc', '<Plug>VSCodeCommentaryLine', {})

-- Theme Changer
local function setCursorLineNrColorInsert(mode)
if mode == "i" then
vim.fn["VSCodeNotify"]('nvim-theme.nvimColorInsert')
elseif mode == "r" then
vim.fn["VSCodeNotify"]('nvim-theme.nvimColorReplace')
end
end

vim.cmd("augroup CursorLineNrColorSwap")
vim.cmd("autocmd!")
vim.cmd("autocmd ModeChanged *:[vV\\x16]* call VSCodeNotify('nvim-theme.nvimColorVisual')")
vim.cmd("autocmd ModeChanged *:[R]* call VSCodeNotify('nvim-theme.nvimColorReplace')")
vim.cmd("autocmd InsertEnter * call setCursorLineNrColorInsert(v:insertmode)")
vim.cmd("autocmd InsertLeave * call VSCodeNotify('nvim-theme.nvimColorNormal')")
vim.cmd("autocmd CursorHold * call VSCodeNotify('nvim-theme.nvimColorNormal')")
vim.cmd("augroup END")
else
require("config")
end
81 changes: 0 additions & 81 deletions lazy-lock.json

This file was deleted.

41 changes: 41 additions & 0 deletions lua/config/autocmds.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
local augroup = vim.api.nvim_create_augroup -- Create/get autocommand group
local autocmd = vim.api.nvim_create_autocmd -- Create autocommand


-- augroup('MyCustomNeogitEvents', { clear = true })
-- autocmd('User', {
-- pattern = 'NeogitPushComplete',
-- group = 'MyCustomNeogitEvents',
-- callback = require('neogit').close,
-- })
--

-- Remove whitespace on save
autocmd('BufWritePre', {
pattern = '',
command = ":%s/\\s\\+$//e"
})

-- Set indentation to 2 spaces
augroup('setIndent', { clear = true })
autocmd('Filetype', {
group = 'setIndent',
pattern = { 'xml', 'html', 'xhtml', 'css', 'scss', 'javascript', 'typescript',
'yaml', 'lua'
},
command = 'setlocal shiftwidth=2 tabstop=2'
})


vim.cmd([[command! Format :lua FormatWithLSP()]])

-- Define a function to trigger LSP formatting
function FormatWithLSP()
vim.lsp.buf.format({ async = true })
end

vim.cmd([[command! LuaEditSnipFunc :lua LuaEditSnipFunc()]])

function LuaEditSnipFunc()
require('luasnip.loaders.from_lua').edit_snippet_files()
end
26 changes: 26 additions & 0 deletions lua/config/defaults.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
local M = {}

M.config = {
figlet_name = {
[[ __ .__ __ ___________ ____ ]],
[[ | | _|__| ____ | | __\ \ \ / / ]],
[[ | |/ / |/ ___\| |/ // | \ Y / ]],
[[ | <| \ \___| </ | \ / ]],
[[ |__|_ \__|\___ >__|_ \____|__ /\___/ ]],
[[ \/ \/ \/ \/ ]],
},
themes = {
"tokyonight",
"catppuccin",
"kanagawa",
"nightfox",
"night-owl",
},
colorscheme = "catppuccin",
transparent_background = true
}

function M.setup()
end

return M
6 changes: 6 additions & 0 deletions lua/config/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require("config.options")
require("config.lazy")
require("config.keymaps")
require("config.autocmds")
local color_scheme = require("config.defaults").config.colorscheme
vim.cmd("colorscheme " .. color_scheme)
50 changes: 50 additions & 0 deletions lua/config/keymaps.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
local keymap = vim.api.nvim_set_keymap
local map = vim.keymap.set
local opts = { noremap = true, silent = true }
local expr_opts = { expr = true, silent = true }

keymap("n", "<leader>aa", ":hide<cr>", opts)

-- Stay in indent mode
keymap("v", "<", "<gv", opts)
keymap("v", ">", ">gv", opts)

keymap("n", "<leader>v", ":vsp<cr>", opts)
keymap("n", "<leader>V", ":sp<cr>", opts)

-- better up/down
map({ "n", "x" }, "j", "v:count == 0 ? 'gj' : 'j'", expr_opts)
map({ "n", "x" }, "<Down>", "v:count == 0 ? 'gj' : 'j'", expr_opts)
map({ "n", "x" }, "k", "v:count == 0 ? 'gk' : 'k'", expr_opts)
map({ "n", "x" }, "<Up>", "v:count == 0 ? 'gk' : 'k'", expr_opts)

-- Resize window using <ctrl> arrow keys
map("n", "<C-Up>", "<cmd>resize +2<cr>", { desc = "Increase window height" })
map("n", "<C-Down>", "<cmd>resize -2<cr>", { desc = "Decrease window height" })
map("n", "<C-Left>", "<cmd>vertical resize -2<cr>", { desc = "Decrease window width" })
map("n", "<C-Right>", "<cmd>vertical resize +2<cr>", { desc = "Increase window width" })

-- Move Lines
map("n", "<A-j>", "<cmd>m .+1<cr>==", { desc = "Move down" })
map("n", "<A-k>", "<cmd>m .-2<cr>==", { desc = "Move up" })
map("i", "<A-j>", "<esc><cmd>m .+1<cr>==gi", { desc = "Move down" })
map("i", "<A-k>", "<esc><cmd>m .-2<cr>==gi", { desc = "Move up" })
map("v", "<A-j>", ":m '>+1<cr>gv=gv", { desc = "Move down" })
map("v", "<A-k>", ":m '<-2<cr>gv=gv", { desc = "Move up" })

-- Clear search with <leader><Enter>
map({ "i", "n" }, "<leader><Enter>", "<cmd>noh<cr><esc>", { desc = "Escape and clear hlsearch" })

function load_extra_options()
local function bind_extra_cmd(options)
for optionCount = 1, #options do vim.cmd(options[optionCount]) end
end
local options = {
"filetype plugin on", "filetype indent on", "cabbr Q q", "cabbr Q! q!",
"cabbr W! w!", "cabbr W w", "cabbr WA wa", "cabbr Wa wa", "cabbr Wq wq",
"cabbr WQ wq", "cabbr Qa qa", "cabbr QA qa"
}
bind_extra_cmd(options)
end

load_extra_options()
Loading