Skip to content

Commit 967d33a

Browse files
committed
Updated a lot of vim configs
1 parent ccfd4aa commit 967d33a

19 files changed

+604
-227
lines changed

nvim/.config/nvim/ftplugin/rust.vim

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
let g:rustfmt_autosave = 1
2+
let g:rust_recommended_style = v:false
3+
24
autocmd FileType rust setlocal ts=2 sw=2 expandtab equalprg=rustfmt
35

46
nnoremap <leader>r :!tmux send-keys -t 1 C-c "clear; cargo run" C-m<CR><C-L>

nvim/.config/nvim/init.lua

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
require('plugins')
2+
require('custom.keys')
3+
require('custom.lsp')
4+
require('custom.line')
5+
require('custom.tabs')
6+
require('custom.telescope')
7+
require('custom.treesitter')
8+
require('custom.discord')
9+
10+
vim.opt.termguicolors = true
11+
12+
vim.opt.swapfile = false
13+
vim.opt.backup = false
14+
vim.opt.clipboard = "unnamedplus"
15+
vim.opt.mouse = "a"
16+
vim.opt.wrap = false
17+
vim.opt.textwidth = 0
18+
vim.opt.wrapmargin = 0
19+
vim.opt.tabstop = 2
20+
vim.opt.shiftwidth = 2
21+
vim.opt.softtabstop = 2
22+
vim.opt.expandtab = true
23+
vim.opt.smarttab = false
24+
vim.opt.autoindent = true
25+
vim.opt.nu = true
26+
vim.opt.rnu = true
27+
vim.opt.incsearch = true
28+
vim.opt.inccommand = "split"
29+
vim.opt.showmatch = true
30+
vim.opt.showtabline = 2
31+
vim.opt.showmode = false
32+
33+
vim.opt.list = true
34+
vim.o.listchars = 'space:·,tab:→ '
35+
36+
local autocmd = vim.api.nvim_create_autocmd
37+
local augroup = vim.api.nvim_create_augroup
38+
local yank_group = augroup('HighlightYank', {})
39+
autocmd('TextYankPost', {
40+
group = yank_group,
41+
pattern = '*',
42+
callback = function()
43+
vim.highlight.on_yank({
44+
higroup = 'IncSearch',
45+
timeout = 40,
46+
})
47+
end,
48+
})
49+
50+
51+
local onedark = require('onedark')
52+
onedark.setup {
53+
style = 'cool',
54+
transparent = true,
55+
code_style = {
56+
comments = 'italic',
57+
keywords = 'italic',
58+
functions = 'italic',
59+
strings = 'none',
60+
variables = 'none'
61+
},
62+
colors = {
63+
nontext = "#fff000"
64+
},
65+
lualine = {
66+
transparent = true,
67+
},
68+
}
69+
onedark.load()

nvim/.config/nvim/init.vim

-105
This file was deleted.
File renamed without changes.

nvim/.config/nvim/lua/custom/keys.lua

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
vim.g.mapleader = ","
2+
vim.keymap.set('n', '<leader>o', '<cmd>!tmux splitw -h -p 30 -c $(pwd)<cr><c-l>')
3+
vim.keymap.set('n', '<leader>t', '<cmd>!tmux send-keys -t 1 C-c<cr><c-l>')
4+
5+
require('Comment').setup({
6+
mappings = {
7+
basic = true,
8+
extra = false,
9+
},
10+
toggler = {
11+
line = '<leader>c',
12+
block = '<leader>x',
13+
},
14+
opleader = {
15+
line = '<leader>c',
16+
block = '<leader>x',
17+
},
18+
})

nvim/.config/nvim/plugin/line.lua nvim/.config/nvim/lua/custom/line.lua

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
1-
local custom_ayu_dark = require'lualine.themes.ayu_dark'
2-
custom_ayu_dark.normal.c.bg = '#08090D'
3-
custom_ayu_dark.normal.a.bg = '#161D26'
4-
custom_ayu_dark.normal.a.fg = '#4B5263'
5-
custom_ayu_dark.insert.a.bg = '#60AFEF'
6-
custom_ayu_dark.visual.a.bg = '#C376DB'
7-
81
require('lualine').setup({
92
options = {
103
icons_enabled = true,
11-
theme = custom_ayu_dark,
4+
theme = 'onedark',
125
component_separators = { '', ' '},
136
-- section_separators = { '', '' },
147
section_separators = { '', '' },
@@ -35,3 +28,8 @@ require('lualine').setup({
3528
lualine_z = { 'location' }
3629
}
3730
})
31+
32+
require('lualine').hide({
33+
place = {'statusline', 'tabline', 'winbar'},
34+
unhide = false,
35+
})

nvim/.config/nvim/lua/custom/lsp.lua

+119
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
local lsp = require('lspconfig')
2+
local cmp = require('cmp')
3+
local luasnip = require('luasnip')
4+
5+
local defaults = lsp.util.default_config
6+
7+
defaults.capabilities = vim.tbl_deep_extend(
8+
'force',
9+
defaults.capabilities,
10+
require('cmp_nvim_lsp').default_capabilities()
11+
)
12+
13+
vim.api.nvim_create_autocmd('LspAttach', {
14+
desc = 'LSP actions',
15+
callback = function(args)
16+
local bufmap = function(mode, lhs, rhs)
17+
local opts = { buffer = true, remap = false }
18+
vim.keymap.set(mode, lhs, rhs, opts)
19+
end
20+
21+
bufmap("n", "gd", function() vim.lsp.buf.definition() end)
22+
bufmap("n", "rn", function() vim.lsp.buf.rename() end)
23+
bufmap("n", "<C-k>", function() vim.lsp.buf.hover() end)
24+
25+
local client = vim.lsp.get_client_by_id(args.data.client_id)
26+
27+
client.server_capabilities.semanticTokensProvider = nil
28+
end
29+
})
30+
31+
vim.opt.completeopt = {'menuone', 'noselect'}
32+
33+
require("mason").setup()
34+
require("mason-lspconfig").setup()
35+
36+
lsp.rust_analyzer.setup{
37+
procMacro = {
38+
enable = true
39+
}
40+
}
41+
lsp.tsserver.setup {
42+
on_attach = on_attach,
43+
root_dir = lsp.util.root_pattern("package.json")
44+
}
45+
lsp.denols.setup {
46+
on_attach = on_attach,
47+
root_dir = lsp.util.root_pattern("deno.json", "deno.jsonc")
48+
}
49+
lsp.graphql.setup{}
50+
lsp.dockerls.setup{}
51+
lsp.prismals.setup{}
52+
lsp.tailwindcss.setup{}
53+
lsp.bufls.setup{}
54+
55+
require('luasnip.loaders.from_vscode').lazy_load()
56+
cmp.setup({
57+
snippet = {
58+
expand = function(args)
59+
luasnip.lsp_expand(args.body)
60+
end,
61+
},
62+
window = {
63+
documentation = cmp.config.window.bordered(),
64+
completion = cmp.config.window.bordered()
65+
},
66+
mapping = {
67+
['<C-Space>'] = cmp.mapping.complete(),
68+
['<C-e>'] = cmp.mapping.abort(),
69+
["<CR>"] = cmp.mapping.confirm {
70+
behavior = cmp.ConfirmBehavior.Replace,
71+
select = false,
72+
},
73+
["<Tab>"] = cmp.mapping(function(fallback)
74+
if cmp.visible() then
75+
cmp.select_next_item()
76+
elseif require("luasnip").expand_or_jumpable() then
77+
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
78+
else
79+
fallback()
80+
end
81+
end, {
82+
"i",
83+
"s",
84+
}),
85+
["<S-Tab>"] = cmp.mapping(function(fallback)
86+
if cmp.visible() then
87+
cmp.select_prev_item()
88+
elseif require("luasnip").jumpable(-1) then
89+
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
90+
else
91+
fallback()
92+
end
93+
end, {
94+
"i",
95+
"s",
96+
}),
97+
},
98+
sources = {
99+
{ name = "nvim_lsp" },
100+
{ name = "luasnip" },
101+
{ name = "buffer" },
102+
{ name = "nvim_lua" },
103+
{ name = "path" },
104+
},
105+
formatting = {
106+
fields = {'menu', 'abbr', 'kind'},
107+
format = function(entry, item)
108+
local menu_icon = {
109+
nvim_lsp = 'λ',
110+
luasnip = '',
111+
buffer = 'Ω',
112+
path = '🖫',
113+
}
114+
115+
item.menu = menu_icon[entry.source.name]
116+
return item
117+
end,
118+
},
119+
})

nvim/.config/nvim/lua/custom/tabs.lua

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
require("bufferline").setup({
2+
options = {
3+
diagnostics = "nvim_lsp",
4+
always_show_bufferline = true,
5+
buffer_close_icon = ''
6+
},
7+
})
8+
9+
vim.keymap.set("n", "<Tab>", '<cmd>BufferLineCycleNext<cr>')
10+
vim.keymap.set("n", "<S-Tab>", '<cmd>BufferLineCycleNext<cr>')
11+
vim.keymap.set("n", "<S-W>", '<cmd>bd!<cr>')
12+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
local status_ok, configs = pcall(require, "nvim-treesitter.configs")
2+
3+
if not status_ok then
4+
vim.notify("nvim-treesitter not found!")
5+
return
6+
end
7+
8+
configs.setup {
9+
sync_install = false,
10+
ensure_installed = { "vimdoc", "javascript", "typescript", "yaml", "json", "lua", "rust" },
11+
autopairs = {
12+
enable = true,
13+
},
14+
highlight = {
15+
enable = true,
16+
additional_vim_regex_highlighting = true,
17+
use_languagetree = true,
18+
},
19+
}

0 commit comments

Comments
 (0)