diff options
Diffstat (limited to 'nvim')
| -rw-r--r-- | nvim/init.vim | 156 |
1 files changed, 132 insertions, 24 deletions
diff --git a/nvim/init.vim b/nvim/init.vim index 69bc148..433dd2d 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -51,9 +51,11 @@ autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o call plug#begin('~/.vim/plugged') " Appearance and UI - Plug 'vim-airline/vim-airline' - Plug 'vim-airline/vim-airline-themes' - Plug 'ryanoasis/vim-devicons' + Plug 'nvim-lualine/lualine.nvim' + "Plug 'vim-airline/vim-airline' " DEPRECATED: IN NEW VERSION, SWITCHED TO LUALINE + "Plug 'vim-airline/vim-airline-themes' + "Plug 'ryanoasis/vim-devicons' + Plug 'nvim-tree/nvim-web-devicons' " Text manipulation Plug 'tpope/vim-surround' @@ -94,10 +96,15 @@ call plug#begin('~/.vim/plugged') Plug 'hrsh7th/cmp-buffer' Plug 'hrsh7th/cmp-path' Plug 'hrsh7th/cmp-cmdline' + Plug 'saadparwaiz1/cmp_luasnip' + + " Snippets Plug 'L3MON4D3/LuaSnip' + Plug 'rafamadriz/friendly-snippets' " null-ls (for linters and formatters) - Plug 'jose-elias-alvarez/null-ls.nvim' + "Plug 'jose-elias-alvarez/null-ls.nvim' " DEPRECATED: after neovim 0.10 + Plug 'nvimtools/none-ls.nvim' " fork that supports neovim 0.11 " Diagnostics UI (optional UI for LSP diagnostics) Plug 'j-hui/fidget.nvim' @@ -146,6 +153,14 @@ let g:vimtex_view_general_viewer = 'okular' let g:vimtex_view_general_options = '--unique file:@pdf\#src:@line@tex' let maplocalleader = "," +" Do not automatically open the quickfix window, if you want to open it, use ,le +let g:vimtex_quickfix_mode = 0 + +augroup vimtex_auto_compile + autocmd! + autocmd BufWritePost *.tex call vimtex#compiler#compile() +augroup END + " ============================================================================= " Discord Presence " ============================================================================= @@ -157,12 +172,14 @@ let g:presence_main_image="file" " Airline Configurations " ============================================================================= -let g:airline_powerline_fonts = 1 -let g:airline#extensions#tabline#enabled = 1 -let g:airline_theme='deus' +" DEPRECATED: I used to use airline, but I switched to lualine for better performance and more customization options. I keep these settings here in case I want to switch back or if I want to use some of the themes or extensions that airline offers. + +"let g:airline_powerline_fonts = 1 +"let g:airline#extensions#tabline#enabled = 1 +"let g:airline_theme='deus' " for vimtex -let g:airline#extensions#vimtex#enabled = 1 +"let g:airline#extensions#vimtex#enabled = 1 " Enable filetype plugins and indentation filetype plugin indent on @@ -180,6 +197,11 @@ set termguicolors " Setup nvim-colorizer lua require'colorizer'.setup() +" Lualine transparent background +highlight StatusLine guibg=NONE ctermbg=NONE +highlight StatusLineNC guibg=NONE ctermbg=NONE +highlight TabLineFill guibg=NONE ctermbg=NONE + " ============================================================================= " Cursor highlight line " ============================================================================= @@ -214,36 +236,28 @@ autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTr " Spell check toggle map S :setlocal spell! spelllang=en_us<CR> -" Movement -map J k -map K j - " Quick save and exit map zz :wq<CR> map zx :q!<CR> map zs :w<CR> -" Ergonomic save and exit -map <leader>w :wq<CR> -map <leader>q :q!<CR> -map <leader>s :w<CR> - " ============================================================================= " Copilot Setup " ============================================================================= -" Disable copilot for text and markdown files +" Disable copilot for text, markdown and latex files autocmd FileType text let g:copilot_enabled = 0 autocmd FileType markdown let g:copilot_enabled = 0 +autocmd FileType tex let g:copilot_enabled = 0 " ============================================================================= " NeoVide Setup " ============================================================================= if exists("g:neovide") - set guifont="Inconsolata" - let g:neovide_transparency = 0.75 - let g:airline_powerline_fonts = 0 + set guifont=Inconsolata:h8 + let g:neovide_opacity = 1 + let g:neovide_normal_opacity = 0.70 let g:neovide_cursor_vfx_mode = "pixiedust" endif @@ -252,6 +266,47 @@ endif " ============================================================================= lua << EOF + +local custom_onedark = require('lualine.themes.onedark') + +for _, mode in pairs(custom_onedark) do + if mode.c then + mode.c.bg = 'NONE' + end +end + +require('lualine').setup { + options = { + theme = custom_onedark, + + icons_enabled = true, + component_separators = { left = '', right = ''}, + section_separators = { left = '', right = ''}, + globalstatus = true, + }, + + tabline = { + lualine_a = {'buffers'}, + lualine_b = {}, + lualine_c = {}, + lualine_x = {}, + lualine_y = {}, + lualine_z = {'tabs'} + }, + + sections = { + lualine_c = { + 'filename', + function() + if vim.bo.filetype == 'tex' and vim.fn.exists('*vimtex#statusline') == 1 then + return vim.fn['vimtex#statusline']() + end + return '' + end + } + } +} + -- Keymap utility functions local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(0, ...) end @@ -401,7 +456,14 @@ for server, config in pairs(servers) do capabilities = capabilities, }, config or {}) - require("lspconfig")[server].setup(config) + -- Verify if we're on Neovim 0.11+ (which has native vim.lsp.config) + if vim.lsp.config then + vim.lsp.config(server, config) + vim.lsp.enable(server) + else + -- Fallback for Neovim 0.10 + require("lspconfig")[server].setup(config) + end end -- null-ls (for formatters/linters not provided by LSP) @@ -420,15 +482,18 @@ null_ls.setup({ end, }), null_ls.builtins.formatting.isort, - null_ls.builtins.diagnostics.flake8, + -- null_ls.builtins.diagnostics.flake8, null_ls.builtins.formatting.gofmt, null_ls.builtins.formatting.goimports, - null_ls.builtins.formatting.rustfmt, + -- null_ls.builtins.formatting.rustfmt, }, }) -- cmp setup local cmp = require 'cmp' + +require("luasnip.loaders.from_vscode").lazy_load() + cmp.setup({ snippet = { expand = function(args) @@ -458,4 +523,47 @@ require("fidget").setup({ } } }) + +local ls = require("luasnip") +local s = ls.snippet +local t = ls.text_node +local i = ls.insert_node +local fmt = require("luasnip.extras.fmt").fmt + +ls.add_snippets("tex", { + -- 1. Mediu matematic inline rapid + -- Scrii "mk" -> devine "$ cursor $" + s("mk", { + t("$"), i(1), t("$"), i(0) + }), + + -- 2. Fracții + -- Scrii "ff" -> devine "\frac{ cursor }{ }" + s("ff", { + t("\\frac{"), i(1), t("}{"), i(2), t("}"), i(0) + }), + + -- 3. Ecuație numerotată + -- Scrii "eq" -> mediu equation + s("eq", { + t({"\\begin{equation}", "\t"}), + i(1), + t({"", "\\end{equation}"}), i(0) + }), + + -- 4. Ecuație nenumerotată (align*) + -- Scrii "al" -> mediu align* + s("al", { + t({"\\begin{align*}", "\t"}), + i(1), + t({"", "\\end{align*}"}), i(0) + }), + + -- 5. Bold text + -- Scrii "bf" -> \textbf{} + s("bf", { + t("\\textbf{"), i(1), t("}"), i(0) + }), +}) + EOF |
