Skip to content

Commit 04edf3d

Browse files
committed
init
0 parents  commit 04edf3d

32 files changed

+1045
-0
lines changed

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Huszár Bence
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
![Header](./img/hussar-header-image.png)
2+
# Neovide to LSP
3+
4+
> [!WARNING]
5+
> If you read this keep in mind that this config is tailored for my needs with plugins and shortcuts. Also I use `Neovide` not Neovim for the animated cursor so Neovim is broken with this config.
6+
7+
## Important cp
8+
Install Neovim & Neovide.
9+
```
10+
sudo pacman -S neovim neovide
11+
```
12+
13+
Clone repo and copy dotfiles to ~/.config/neovide
14+
```
15+
git clone https://github.com/huss4r/neovide-config.git
16+
cd neovide-config
17+
mkdir -p ~/.config/neovide
18+
cp -r * ~/.config/neovide
19+
```
20+
21+
Set environment variables for config location.
22+
```
23+
export XDG_CONFIG_HOME=~/.config/
24+
export XDG_CONFIG=~/.config/
25+
```
26+
27+
Install packer plugin manager.
28+
```
29+
git clone --depth 1 https://github.com/wbthomason/packer.nvim\
30+
~/.local/share/nvim/site/pack/packer/start/packer.nvim
31+
```
32+
33+
> Put this in .zshrc if you will
34+
```
35+
alias vim='neovide'
36+
```
37+
38+
## Showcase
39+
### `Nvim-tree` + `Barbar tabs` and split screen coding capabilities
40+
Toggle the file tree with a shortcut, navigate your directory and start coding, If you want to look up something or write code in multiple files there is a shortcut for splitting the screen horizontally/vertically.
41+
42+
<img src="./img/nvim-tree.png">
43+
44+
### `Telescope` aka fuzzyfinder
45+
Big projects are a pain in the butt to navigate between files, this plugin is a fuzzyfinder integration for Neovim to go between files faster.
46+
47+
<img src="./img/fuzzyfinder.png">
48+
49+
### `Grep string`
50+
Telescope let's you search for a string in all the files inside your opened directory. After the search results you can preview the code part containing the string you searched for before opening a file for editing.
51+
52+
<img src="./img/grepString.png">
53+
54+
### "`Harpoon` man"
55+
Harpoon is probably the fastest way to navigate files. Save the files you are currently working on in a buffer and switch between them with shortcuts. Insanely fast.
56+
57+
<img src="./img/harpoon.png">
58+
59+
### `Zero LSP`
60+
Install your favorite LSP servers for your languages and enjoy the code autocompletion.
61+
62+
<img src="./img/zero-lsp.png">
63+
64+
### `Toggle term`
65+
Toggle the terminal window with a shortcut whenever you are in need of a terminal instead of opening an entirely new terminal taking up space on your screen just to close it afterwards.
66+
67+
<img src="./img/toggleTerm.png">
68+
69+
## Other Resources
70+
71+
- [Dockerplates](https://github.com/huss4r/prod-dockerplates) - Docker-compose templates for your homelab.

after/plugin/autopairs.lua

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
-- import nvim-autopairs safely
2+
local autopairs_setup, autopairs = pcall(require, "nvim-autopairs")
3+
if not autopairs_setup then
4+
return
5+
end
6+
7+
-- configure autopairs
8+
autopairs.setup({
9+
check_ts = true, -- enable treesitter
10+
ts_config = {
11+
lua = { "string" }, -- don't add pairs in lua string treesitter nodes
12+
javascript = { "template_string" }, -- don't add pairs in javscript template_string treesitter nodes
13+
java = false, -- don't check treesitter on java
14+
},
15+
})
16+
17+
-- import nvim-autopairs completion functionality safely
18+
local cmp_autopairs_setup, cmp_autopairs = pcall(require, "nvim-autopairs.completion.cmp")
19+
if not cmp_autopairs_setup then
20+
return
21+
end
22+
23+
-- import nvim-cmp plugin safely (completions plugin)
24+
local cmp_setup, cmp = pcall(require, "cmp")
25+
if not cmp_setup then
26+
return
27+
end
28+
29+
-- make autopairs and completion work together
30+
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())

after/plugin/barbar.lua

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
require'barbar'.setup {
2+
sidebar_filetypes = {
3+
NvimTree = true,
4+
undotree = {
5+
text = 'undotree',
6+
align = 'center', -- *optionally* specify an alignment (either 'left', 'center', or 'right')
7+
},
8+
['neo-tree'] = {event = 'BufWipeout'},
9+
Outline = {event = 'BufWinLeave', text = 'symbols-outline', align = 'right'},
10+
},
11+
}
12+
13+
local map = vim.api.nvim_set_keymap
14+
local opts = { noremap = true, silent = true }
15+
16+
-- Move to previous/next
17+
map('n', '<A-Left>', '<Cmd>BufferPrevious<CR>', opts)
18+
map('n', '<A-Right>', '<Cmd>BufferNext<CR>', opts)
19+
-- Re-order to previous/next
20+
map('n', '<A-S-Left>', '<Cmd>BufferMovePrevious<CR>', opts)
21+
map('n', '<A-S-Right>', '<Cmd>BufferMoveNext<CR>', opts)
22+
-- Goto buffer in position...
23+
map('n', '<A-1>', '<Cmd>BufferGoto 1<CR>', opts)
24+
map('n', '<A-2>', '<Cmd>BufferGoto 2<CR>', opts)
25+
map('n', '<A-3>', '<Cmd>BufferGoto 3<CR>', opts)
26+
map('n', '<A-4>', '<Cmd>BufferGoto 4<CR>', opts)
27+
map('n', '<A-5>', '<Cmd>BufferGoto 5<CR>', opts)
28+
map('n', '<A-6>', '<Cmd>BufferGoto 6<CR>', opts)
29+
map('n', '<A-7>', '<Cmd>BufferGoto 7<CR>', opts)
30+
map('n', '<A-8>', '<Cmd>BufferGoto 8<CR>', opts)
31+
map('n', '<A-9>', '<Cmd>BufferGoto 9<CR>', opts)
32+
map('n', '<A-0>', '<Cmd>BufferLast<CR>', opts)
33+
-- Pin/unpin buffer
34+
map('n', '<A-p>', '<Cmd>BufferPin<CR>', opts)
35+
-- Close buffer
36+
map('n', '<A-q>', '<Cmd>BufferClose<CR>', opts)

after/plugin/ccc.lua

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
-- Enable true color
2+
vim.opt.termguicolors = true
3+
4+
local ccc = require("ccc")
5+
6+
ccc.setup({
7+
-- Your preferred settings
8+
-- Example: enable highlighter
9+
highlighter = {
10+
auto_enable = true,
11+
lsp = true,
12+
},
13+
})

after/plugin/colors.lua

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
function ColorMyPencils(color)
2+
color = color or "catppuccin-frappe"
3+
vim.cmd.colorscheme(color)
4+
5+
-- vim.api.nvim_set_hl(0, "Normal", { bg = "none"})
6+
-- vim.api.nvim_set_hl(0, "NormaliFloat", { bg = "none"})
7+
vim.api.nvim_set_hl(0, "Visual", { bg = "#ff00ff", fg = '#f0f6fc'})
8+
-- vim.api.nvim_set_hl(0, "LineNr", { fg = '#f5b0b6'})
9+
vim.api.nvim_set_hl(0, "LineNr", { fg = '#e3dac9'})
10+
vim.api.nvim_set_hl(0, 'NonText', { fg = '#888888' })
11+
vim.api.nvim_set_hl(0, 'SpecialKey', { fg = '#e3dac9' })
12+
vim.api.nvim_set_hl(0, 'Whitespace', { fg = '#888888' })
13+
vim.api.nvim_set_hl(0, "CursorLine", { bg = "#607691" })
14+
vim.api.nvim_set_hl(0, "CursorLineNr", { fg = "#db88ce" })
15+
vim.o.guifont = "JetBrainsMono Nerd Font:h10"
16+
17+
vim.g.neovide_transparency = 0.6
18+
vim.g.transparency = 0.6
19+
vim.g.neovide_background_color = ("#ffffff" .. string.format("%x", math.floor(((255 * vim.g.transparency) or 0.6 ))))
20+
end
21+
22+
23+
vim.opt.termguicolors = true
24+
25+
require("nvim-highlight-colors").setup {
26+
render = 'background',
27+
28+
virtual_symbol = '',
29+
30+
enable_named_colors = true,
31+
32+
enable_tailwind = false,
33+
34+
custom_colors = {
35+
{ label = '%-%-theme%-primary%-color', color = '#0f1219' },
36+
{ label = '%-%-theme%-secondary%-color', color = '#5a5d64' },
37+
}
38+
}
39+
40+
require("catppuccin").setup {
41+
custom_highlights = function(colors)
42+
return {
43+
Comment = { fg = colors.red },
44+
TabLineSel = { bg = colors.black },
45+
CmpBorder = { fg = colors.surface2 },
46+
Pmenu = { bg = colors.black },
47+
}
48+
end,
49+
integrations = {
50+
treesitter = true,
51+
}
52+
}
53+
54+
ColorMyPencils()

after/plugin/fugitive.lua

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
vim.keymap.set("n", "<leader>o", vim.cmd.Git);

after/plugin/harpoon.lua

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
local mark = require("harpoon.mark")
2+
local ui = require("harpoon.ui")
3+
4+
vim.keymap.set("n", "<leader>a", mark.add_file)
5+
vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu)
6+
7+
vim.keymap.set("n", "<C-1>", function() ui.nav_file(1) end)
8+
vim.keymap.set("n", "<C-2>", function() ui.nav_file(2) end)
9+
vim.keymap.set("n", "<C-3>", function() ui.nav_file(3) end)
10+
vim.keymap.set("n", "<C-4>", function() ui.nav_file(4) end)
11+
vim.keymap.set("n", "<C-5>", function() ui.nav_file(5) end)
12+
vim.keymap.set("n", "<C-6>", function() ui.nav_file(6) end)
13+
vim.keymap.set("n", "<C-7>", function() ui.nav_file(7) end)
14+
vim.keymap.set("n", "<C-8>", function() ui.nav_file(8) end)
15+
vim.keymap.set("n", "<C-9>", function() ui.nav_file(9) end)

after/plugin/lsp.lua

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
local lsp_zero = require('lsp-zero')
2+
3+
lsp_zero.on_attach(function(client, bufnr)
4+
local opts = {buffer = bufnr, remap = false}
5+
6+
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
7+
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts)
8+
vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts)
9+
vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts)
10+
vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts)
11+
vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts)
12+
vim.keymap.set("n", "<leader>vca", function() vim.lsp.buf.code_action() end, opts)
13+
vim.keymap.set("n", "<leader>vrr", function() vim.lsp.buf.references() end, opts)
14+
vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts)
15+
vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts)
16+
end)
17+
18+
require('mason').setup({})
19+
require('mason-lspconfig').setup({
20+
ensure_installed = {'tsserver', 'rust_analyzer', 'intelephense', 'pyright', 'html', 'cssmodules_ls', 'bashls', 'jsonls', 'marksman', 'ansiblels'},
21+
handlers = {
22+
lsp_zero.default_setup,
23+
lua_ls = function()
24+
local lua_opts = lsp_zero.nvim_lua_ls()
25+
require('lspconfig').lua_ls.setup(lua_opts)
26+
end,
27+
}
28+
})
29+
30+
local cmp = require('cmp')
31+
local cmp_select = {behavior = cmp.SelectBehavior.Select}
32+
33+
cmp.setup({
34+
sources = {
35+
{name = 'path'},
36+
{name = 'nvim_lsp'},
37+
{name = 'nvim_lua'},
38+
},
39+
mapping = cmp.mapping.preset.insert({
40+
--['<C-y>'] = cmp.mapping.confirm({ select = true }),
41+
--['<C-Space>'] = cmp.mapping.complete(),
42+
['<return>'] = cmp.mapping.confirm({ select = true }),
43+
['<tab>'] = cmp.mapping.select_next_item(cmp_select),
44+
-- ['<S-down>'] = cmp.mapping.select_next_item(cmp_select),
45+
['<S-tab>'] = cmp.mapping.select_prev_item(cmp_select),
46+
}),
47+
})
48+

after/plugin/lualine.lua

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
-- import lualine plugin safely
2+
local status, lualine = pcall(require, "lualine")
3+
if not status then
4+
return
5+
end
6+
7+
-- get lualine nightfly theme
8+
local lualine_nightfly = require("lualine.themes.nightfly")
9+
10+
-- new colors for theme
11+
local new_colors = {
12+
blue = "#65D1FF",
13+
green = "#3EFFDC",
14+
violet = "#FF61EF",
15+
yellow = "#FFDA7B",
16+
black = "#000000",
17+
}
18+
19+
-- change nightlfy theme colors
20+
lualine_nightfly.normal.a.bg = new_colors.blue
21+
lualine_nightfly.insert.a.bg = new_colors.green
22+
lualine_nightfly.visual.a.bg = new_colors.violet
23+
lualine_nightfly.command = {
24+
a = {
25+
gui = "bold",
26+
bg = new_colors.yellow,
27+
fg = new_colors.black, -- black
28+
},
29+
}
30+
31+
-- configure lualine with modified theme
32+
lualine.setup({
33+
options = {
34+
theme = lualine_nightfly,
35+
},
36+
})

after/plugin/neoscroll.lua

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
require('neoscroll').setup({
2+
-- All these keys will be mapped to their corresponding default scrolling animation
3+
mappings = {'<C-u>', '<C-d>',},
4+
hide_cursor = false, -- Hide cursor while scrolling
5+
stop_eof = true, -- Stop at <EOF> when scrolling downwards
6+
respect_scrolloff = false, -- Stop scrolling when the cursor reaches the scrolloff margin of the file
7+
cursor_scrolls_alone = true, -- The cursor will keep on scrolling even if the window cannot scroll further
8+
easing_function = nil, -- Default easing function
9+
pre_hook = nil, -- Function to run before the scrolling animation starts
10+
post_hook = nil, -- Function to run after the scrolling animation ends
11+
performance_mode = false, -- Disable "Performance Mode" on all buffers.
12+
})

after/plugin/noice.lua

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
require("noice").setup({
2+
lsp = {
3+
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
4+
override = {
5+
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
6+
["vim.lsp.util.stylize_markdown"] = true,
7+
["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp
8+
},
9+
},
10+
-- you can enable a preset for easier configuration
11+
presets = {
12+
bottom_search = true, -- use a classic bottom cmdline for search
13+
command_palette = true, -- position the cmdline and popupmenu together
14+
long_message_to_split = true, -- long messages will be sent to a split
15+
inc_rename = false, -- enables an input dialog for inc-rename.nvim
16+
lsp_doc_border = false, -- add a border to hover docs and signature help
17+
},
18+
})

after/plugin/nvim-tree.lua

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
vim.g.loaded_netrw = 1
2+
vim.g.loaded_netrwPlugin = 1
3+
4+
vim.opt.termguicolors = true
5+
6+
require("nvim-tree").setup({
7+
sort = {
8+
sorter = "case_sensitive",
9+
},
10+
view = {
11+
width = 40,
12+
},
13+
renderer = {
14+
group_empty = true,
15+
},
16+
filters = {
17+
dotfiles = true,
18+
},
19+
})

0 commit comments

Comments
 (0)