Skip to content

Commit 9dfa9cf

Browse files
first commit
0 parents  commit 9dfa9cf

16 files changed

+432
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
plugged

init.lua

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
local map = vim.api.nvim_set_keymap
2+
vim.g.mapleader = ' ' -- 'vim.g' sets global variables
3+
Options = { noremap = false, silent = true }
4+
5+
require("plugins")
6+
7+
--fancy-Stuff
8+
require('presence_config')
9+
require('dracula_config')
10+
11+
--lualine
12+
require("lualine_config")
13+
14+
--Filetree
15+
require("nvimtree_config")
16+
map('n', '<C-n>', ':NvimTreeToggle<cr>', Options)
17+
18+
--Bufferline
19+
require("bufferline_config")
20+
map('n', '<C-h>', ':BufferLineCyclePrev<cr>', Options)
21+
map('n', '<C-l>', ':BufferLineCycleNext<cr>', Options)
22+
map('n', '<A-h>', ':BufferLineMovePrev<cr>', Options)
23+
map('n', '<A-l>', ':BufferLineMoveNext<cr>', Options)
24+
25+
--Nerd-Stuff
26+
map('n', '##', '<plug>NERDCommenterToggle', Options)
27+
28+
--Native-Shit
29+
map('n', '<Leader>q', ':qa!<cr>', Options)
30+
map('n', '<Leader>x', ':xa!<cr>', Options)
31+
map('n', '<Leader>w', ':wa!<cr>', Options)
32+
map('n', '<C-w>', ':bdelete!<cr>', Options)
33+
map('n', '<Leader>y', '"+y', Options)
34+
map('v', '<Leader>y', '"+y', Options)
35+
vim.o.scrolloff = 15
36+
vim.o.termguicolors = true
37+
vim.o.tabstop = 2
38+
vim.o.shiftwidth = 2
39+
vim.o.expandtab = true
40+
vim.opt.wrap = false
41+
vim.o.relativenumber = true
42+
vim.o.number = true
43+
44+
45+
--LSP
46+
require("lsp.lsp_config")
47+
require("lsp.lspkind_config")
48+
49+
--LSP-CMP
50+
vim.o.completeopt = "menu,menuone,noselect"
51+
52+
--Lspsaga
53+
require("lsp.Lspsaga_config")
54+
map('n', '<Leader>ld', ':Lspsaga lsp_finder<cr>', Options)
55+
map('n', '<Leader>ln', ':Lspsaga diagnostic_jump_next<cr>', Options)
56+
map('n', '<Leader>lp', ':Lspsaga diagnostic_jump_prev<cr>', Options)
57+
map('n', '<Leader>la', ':Lspsaga code_action<cr>', Options)
58+
map('n', '<Leader>lr', ':Lspsaga rename<cr>', Options)
59+
map('n', '<C-Space>', ':Lspsaga hover_doc<cr>', Options)
60+
require("rust-tools").inlay_hints.enable()
61+
62+
63+
--lspsignature
64+
require("lsp.lspsignature_config")
65+
66+
--telescope
67+
require("telescope_config")
68+
map('n', '<Leader>ff', ':Telescope find_files<cr>', Options)
69+
map('n', '<Leader>fg', ':Telescope live_grep<cr>', Options)

lua/bufferline_config.lua

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
vim.opt.termguicolors = true
2+
require("bufferline").setup{}

lua/copilot_config.lua

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
vim.g.copilot_filetypes = { rust = true }

lua/dracula_config.lua

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
vim.g.dracula_show_end_of_buffer = true -- default false, Turn on or off EndOfBuffer symbol
2+
vim.g.dracula_transparent_bg = true -- default false, enables transparent background
3+
vim.cmd[[colorscheme dracula]]

lua/lsp/Lspsaga_config.lua

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
--require('lspsaga').setup {
2+
--debug = false,
3+
--use_saga_diagnostic_sign = true,
4+
--error_sign = "",
5+
--warn_sign = "",
6+
--hint_sign = "",
7+
--infor_sign = "",
8+
--diagnostic_header_icon = "  ",
9+
--code_action_icon = " ",
10+
--code_action_prompt = {
11+
--enable = true,
12+
--sign = true,
13+
--sign_priority = 40,
14+
--virtual_text = true,
15+
--},
16+
--finder_definition_icon = " ",
17+
--finder_reference_icon = " ",
18+
--max_preview_lines = 10,
19+
--finder_action_keys = {
20+
--open = "o",
21+
--vsplit = "s",
22+
--split = "i",
23+
--quit = "q",
24+
--scroll_down = "<C-f>",
25+
--scroll_up = "<C-b>",
26+
--},
27+
--code_action_keys = {
28+
--quit = "q",
29+
--exec = "<CR>",
30+
--},
31+
--rename_action_keys = {
32+
--quit = "<C-c>",
33+
--exec = "<CR>",
34+
--},
35+
--definition_preview_icon = " ",
36+
--border_style = "single",
37+
--rename_prompt_prefix = "➤",
38+
--server_filetype_map = {},
39+
--}
40+
local saga = require('lspsaga')
41+
42+
saga.init_lsp_saga()

lua/lsp/lsp_config.lua

+111
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
local lspkind = require('lspkind')
2+
local source_mapping = {
3+
buffer = "[Buffer]",
4+
nvim_lsp = "[LSP]",
5+
nvim_lua = "[Lua]",
6+
cmp_tabnine = "[TN]",
7+
path = "[Path]",
8+
vsnip = "[vsnip]",
9+
cmdline = "[cmdline]"
10+
}
11+
12+
13+
14+
local cmp = require'cmp'
15+
16+
cmp.setup({
17+
formatting = {
18+
format = lspkind.cmp_format({
19+
mode = 'symbol_text', -- show only symbol annotations
20+
maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
21+
22+
-- The function below will be called before any actual modifications from lspkind
23+
-- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30))
24+
before = function (entry, vim_item)
25+
vim_item.menu = source_mapping[entry.source.name]
26+
return vim_item
27+
end
28+
}),
29+
30+
},
31+
snippet = {
32+
-- REQUIRED - you must specify a snippet engine
33+
expand = function(args)
34+
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
35+
-- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
36+
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
37+
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
38+
end,
39+
},
40+
window = {
41+
-- completion = cmp.config.window.bordered(),
42+
-- documentation = cmp.config.window.bordered(),
43+
},
44+
mapping = cmp.mapping.preset.insert({
45+
['<C-j>'] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }),
46+
['<C-k>'] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
47+
['<C-e>'] = cmp.mapping.close(),
48+
['<CR>'] = cmp.mapping.confirm({ select = true }),
49+
}),
50+
sources = cmp.config.sources({
51+
{ name = 'nvim_lsp' },
52+
{ name = 'vsnip' }, -- For vsnip users.
53+
{ name = 'cmdline' },
54+
{ name = 'buffer' },
55+
{ name = 'path' },
56+
{ name = 'buffer' }
57+
-- { name = 'luasnip' }, -- For luasnip users.
58+
-- { name = 'ultisnips' }, -- For ultisnips users.
59+
-- { name = 'snippy' }, -- For snippy users.
60+
})
61+
})
62+
63+
-- Set configuration for specific filetype.
64+
cmp.setup.filetype('gitcommit', {
65+
sources = cmp.config.sources({
66+
{ name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it.
67+
}, {
68+
{ name = 'buffer' },
69+
})
70+
})
71+
72+
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
73+
cmp.setup.cmdline('/', {
74+
mapping = cmp.mapping.preset.cmdline(),
75+
sources = {
76+
{ name = 'buffer' }
77+
}
78+
})
79+
80+
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
81+
cmp.setup.cmdline(':', {
82+
mapping = cmp.mapping.preset.cmdline(),
83+
sources = cmp.config.sources({
84+
{ name = 'path' }
85+
}, {
86+
{ name = 'cmdline' }
87+
})
88+
})
89+
90+
91+
92+
93+
local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities())
94+
local function on_attach(client, bufnr)
95+
require("lsp-inlayhints").on_attach(client, bufnr)
96+
end
97+
98+
require("nvim-lsp-installer").setup {}
99+
local lspconfig = require("lspconfig")
100+
lspconfig.sumneko_lua.setup { on_attach = on_attach, capabilites = capabilities }
101+
lspconfig.tsserver.setup { on_attach = on_attach, capabilities = capabilities }
102+
103+
local rt = require("rust-tools")
104+
105+
rt.setup({
106+
server = {
107+
on_attach = function(_, bufnr)
108+
end,
109+
},
110+
})
111+

lua/lsp/lspkind_config.lua

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
require('lspkind').init({
2+
-- DEPRECATED (use mode instead): enables text annotations
3+
--
4+
-- default: true
5+
-- with_text = true,
6+
7+
-- defines how annotations are shown
8+
-- default: symbol
9+
-- options: 'text', 'text_symbol', 'symbol_text', 'symbol'
10+
mode = 'symbol_text',
11+
12+
-- default symbol map
13+
-- can be either 'default' (requires nerd-fonts font) or
14+
-- 'codicons' for codicon preset (requires vscode-codicons font)
15+
--
16+
-- default: 'default'
17+
preset = 'codicons',
18+
19+
-- override preset symbols
20+
--
21+
-- default: {}
22+
symbol_map = {
23+
Text = "",
24+
Method = "",
25+
Function = "",
26+
Constructor = "",
27+
Field = "",
28+
Variable = "",
29+
Class = "",
30+
Interface = "",
31+
Module = "",
32+
Property = "",
33+
Unit = "",
34+
Value = "",
35+
Enum = "",
36+
Keyword = "",
37+
Snippet = "",
38+
Color = "",
39+
File = "",
40+
Reference = "",
41+
Folder = "",
42+
EnumMember = "",
43+
Constant = "",
44+
Struct = "",
45+
Event = "",
46+
Operator = "",
47+
TypeParameter = ""
48+
},
49+
})

lua/lsp/lspsignature_config.lua

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
require "lsp_signature".setup({
2+
bind = true, -- This is mandatory, otherwise border config won't get registered.
3+
floating_window = true,
4+
floating_window_above_cur_line = true,
5+
use_lspsaga = true,
6+
handler_opts = {
7+
border = "single"
8+
}
9+
})

lua/lsp/new_lsp_config.lua

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
local nvim_lsp = require'lspconfig'
2+
3+
local on_attach = function(client)
4+
require'completion'.on_attach(client)
5+
end
6+
7+
nvim_lsp.rust_analyzer.setup({
8+
on_attach=on_attach,
9+
settings = {
10+
["rust-analyzer"] = {
11+
imports = {
12+
granularity = {
13+
group = "module",
14+
},
15+
prefix = "self",
16+
},
17+
cargo = {
18+
buildScripts = {
19+
enable = true,
20+
},
21+
},
22+
procMacro = {
23+
enable = true
24+
},
25+
}
26+
}
27+
})

lua/lualine_config.lua

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
local custom_gruvbox = require'lualine.themes.gruvbox'
2+
3+
-- Change the background of lualine_c section for normal mode
4+
custom_gruvbox.normal.c.bg = '#112233'
5+
6+
require('lualine').setup {
7+
options = { theme = custom_gruvbox },
8+
}

lua/nvimtree_config.lua

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
require'nvim-tree'.setup {
2+
diagnostics = {
3+
enable = true,
4+
icons = {
5+
hint = "",
6+
info = "",
7+
warning = "",
8+
error = "",
9+
}
10+
}
11+
}

lua/plugins.lua

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
local Plug = vim.fn['plug#']
2+
vim.call('plug#begin', '~/.config/nvim/plugged')
3+
--Fancy-Stuff
4+
Plug 'ryanoasis/vim-devicons'
5+
Plug 'kyazdani42/nvim-web-devicons'
6+
Plug 'andweeb/presence.nvim'
7+
Plug 'onsails/lspkind-nvim'
8+
Plug 'mhinz/vim-startify'
9+
Plug 'Mofiqul/dracula.nvim'
10+
--Nerd-Stuff
11+
Plug 'preservim/nerdcommenter'
12+
--Bufferline
13+
Plug 'akinsho/bufferline.nvim'
14+
--Convenience-Stuff
15+
Plug 'jiangmiao/auto-pairs'
16+
Plug 'machakann/vim-sandwich'
17+
Plug 'nvim-lualine/lualine.nvim'
18+
Plug 'vimwiki/vimwiki'
19+
--Syntax-Stuff
20+
Plug 'nvim-treesitter/nvim-treesitter'
21+
--LSP
22+
Plug 'tami5/lspsaga.nvim'
23+
Plug 'neovim/nvim-lspconfig'
24+
Plug 'ray-x/lsp_signature.nvim'
25+
Plug 'williamboman/nvim-lsp-installer'
26+
Plug 'lvimuser/lsp-inlayhints.nvim'
27+
Plug 'simrat39/rust-tools.nvim'
28+
--LSP-CMP
29+
Plug 'hrsh7th/cmp-nvim-lsp'
30+
Plug 'hrsh7th/cmp-buffer'
31+
Plug 'hrsh7th/cmp-path'
32+
Plug 'hrsh7th/cmp-cmdline'
33+
Plug 'hrsh7th/nvim-cmp'
34+
Plug 'hrsh7th/vim-vsnip'
35+
Plug 'hrsh7th/vim-vsnip-integ'
36+
--Filetree
37+
Plug 'kyazdani42/nvim-tree.lua'
38+
--Telescope
39+
Plug 'nvim-telescope/telescope.nvim'
40+
--Dependencies
41+
Plug 'nvim-lua/plenary.nvim'
42+
--Github
43+
Plug 'tanvirtin/vgit.nvim'
44+
Plug 'github/copilot.vim'
45+
vim.call('plug#end')

0 commit comments

Comments
 (0)