From 3ec8d42fbf6eed78c24de2caca63d91a2604ff50 Mon Sep 17 00:00:00 2001 From: altaf-creator Date: Sun, 19 May 2024 14:54:41 +0700 Subject: init --- config/nvim/init.vim | 434 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 434 insertions(+) create mode 100644 config/nvim/init.vim (limited to 'config/nvim') diff --git a/config/nvim/init.vim b/config/nvim/init.vim new file mode 100644 index 0000000..8141374 --- /dev/null +++ b/config/nvim/init.vim @@ -0,0 +1,434 @@ +call plug#begin('~/.config/nvim/plugged') + +Plug 'dikiaap/minimalist' +Plug 'sainnhe/sonokai' +Plug 'folke/tokyonight.nvim' +Plug 'marko-cerovac/material.nvim' +Plug 'rmehri01/onenord.nvim' +Plug 'AlexvZyl/nordic.nvim' +Plug 'RRethy/nvim-base16' +Plug 'catppuccin/nvim', { 'as': 'catppuccin' } + +Plug 'preservim/nerdtree' +Plug 'https://github.com/vim-airline/vim-airline' +Plug 'vim-airline/vim-airline-themes' +" Plug 'https://github.com/neoclide/coc.nvim' +Plug 'lewis6991/gitsigns.nvim' +Plug 'nvim-tree/nvim-web-devicons' +Plug 'ryanoasis/vim-devicons' +" Plug 'romgrk/barbar.nvim' +Plug 'mattn/emmet-vim' +Plug 'RRethy/vim-illuminate' +" Plug 'folke/noice.nvim' +" Plug 'MunifTanjim/nui.nvim' +" Plug 'rcarriga/nvim-notify' +Plug 'nvim-lua/plenary.nvim' +Plug 'nvim-telescope/telescope.nvim' +Plug 'williamboman/mason.nvim' +" Plug 'fannheyward/telescope-coc.nvim' + +" Treesitter, a highlighter +Plug 'nvim-treesitter/nvim-treesitter' + +" LSP Installer +Plug 'neovim/nvim-lspconfig' +Plug 'williamboman/mason-lspconfig.nvim' + +" Completion & Actual LSP +Plug 'hrsh7th/nvim-cmp' +Plug 'hrsh7th/cmp-buffer' +Plug 'hrsh7th/cmp-nvim-lsp' +Plug 'hrsh7th/cmp-vsnip' +Plug 'hrsh7th/cmp-cmdline' +Plug 'hrsh7th/cmp-path' +Plug 'hrsh7th/vim-vsnip' +Plug 'hrsh7th/vim-vsnip-integ' + +" Debugger +Plug 'mfussenegger/nvim-dap' + +Plug 'windwp/nvim-autopairs' + +Plug 'vimwiki/vimwiki' + +Plug '3rd/image.nvim' + +call plug#end() + +" lua require("noice").setup() + +set encoding=UTF-8 +set number +set relativenumber +set mouse=a +set clipboard=unnamedplus +" set shiftwidth=4 smarttab +set cursorline +set termguicolors +set completeopt=menu,menuone,noselect +set nocompatible +set noshowmode +" set nowrap +filetype plugin on +syntax on + +colorscheme catppuccin-frappe + +nnoremap o + +" nnoremap :NERDTree +" nnoremap :NERDTreeToggle + +nnoremap :Telescope +nnoremap :Telescope current_buffer_fuzzy_find +nnoremap :Telescope find_files +nnoremap :Telescope buffers +nnoremap :Telescope tags + +" " Move to previous/next +" nnoremap BufferPrevious +" nnoremap BufferNext +" +" " Re-order to previous/next +" nnoremap BufferMovePrevious +" nnoremap > BufferMoveNext +" +" " Goto buffer in position... +" nnoremap BufferGoto 1 +" nnoremap BufferGoto 2 +" nnoremap BufferGoto 3 +" nnoremap BufferGoto 4 +" nnoremap BufferGoto 5 +" nnoremap BufferGoto 6 +" nnoremap BufferGoto 7 +" nnoremap BufferGoto 8 +" nnoremap BufferGoto 9 +" nnoremap BufferLast +" +" " Pin/unpin buffer +" nnoremap BufferPin +" +" " Close buffer +" nnoremap BufferClose +" " Restore buffer +" nnoremap BufferRestore +" +" " Wipeout buffer +" " :BufferWipeout +" " Close commands +" " :BufferCloseAllButCurrent +" " :BufferCloseAllButVisible +" " :BufferCloseAllButPinned +" " :BufferCloseAllButCurrentOrPinned +" " :BufferCloseBuffersLeft +" " :BufferCloseBuffersRight +" +" " Magic buffer-picking mode +" nnoremap BufferPick +" nnoremap BufferPickDelete +" +" " Sort automatically by... +" nnoremap bb BufferOrderByBufferNumber +" nnoremap bd BufferOrderByDirectory +" nnoremap bl BufferOrderByLanguage +" nnoremap bw BufferOrderByWindowNumber + +" Prettier +" nnoremap Prettier + +" Visual Block Mode +nnoremap + +" Compile +nnoremap waDapContinue + +if exists("g:neovide") + let g:neovide_fullscreen = 'false' + let g:neovide_remember_window_size = v:false + set guifont=JetBrainsMono\ Nerd\ Font:h12 +endif + +let g:vimwiki_list = [{'syntax': 'markdown', 'filetype': 'md'}] + +" Emmet +let g:user_emmet_mode='n' +let g:user_emmet_leader_key=',' + +" Other: +" :BarbarEnable - enables barbar (enabled by default) +" :BarbarDisable - very bad command, should never be used + +" Terminal & neoterm +let g:neoterm_default_mod = 'vertical' + +" airline +let g:airline_theme = 'catppuccin' + +let g:airline_powerline_fonts = 1 + +if !exists('g:airline_symbols') + let g:airline_symbols = {} +endif + +let g:airline#extensions#wordcount#enabled = 1 +let g:airline#extensions#wordcount#filetypes = '\vnotes|help|markdown|rst|org|text|asciidoc|tex|mail|vimwiki' + +let g:airline_left_sep = '' +let g:airline_right_sep = '' +let g:airline_symbols.linenr = '␊' +let g:airline_symbols.linenr = '␤' +let g:airline_symbols.linenr = '¶' +let g:airline_symbols.branch = '⎇' +let g:airline_symbols.paste = 'ρ' +let g:airline_symbols.paste = 'Þ' +let g:airline_symbols.paste = '∥' +let g:airline_symbols.whitespace = 'Ξ' +let g:airline_symbols.branch = '' +let g:airline_symbols.readonly = '' +let g:airline_symbols.linenr = '' + +let g:WebDevIconsUnicodeDecorateFolderNodes = 1 +let g:WebDevIconsUnicodeDecorateFolderNodeDefaultSymbol = '' + +let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols = {} +let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['nerdtree'] = '' + +let g:NERDTreeDirArrowExpandable="" +let g:NERDTreeDirArrowCollapsible="" + +" inoremap coc#pum#visible() ? coc#pum#confirm() : "\" +" inoremap coc#pum#visible() ? coc#pum#close() : "\" + +" command! -nargs=0 Prettier :CocCommand prettier.forceFormatDocument + +set splitbelow +set splitright + +" this is linux idiot set shell=powershell +set shellcmdflag=-command +set shellquote=\" +set shellxquote= + +command! -nargs=* T split | terminal +command! -nargs=* VT vsplit | terminal + +lua require("telescope").setup() +lua require("mason").setup() +lua require("mason-lspconfig").setup() +lua require("nvim-autopairs").setup {} + +lua << EOF +local dap = require('dap') + +dap.adapters.godot = { + type = "server", + host = '127.0.0.1', + port = 6006, +} + +dap.configurations.gdscript = { + { + type = "godot", + request = "launch", + name = "Launch scene", + project = "${workspaceFolder}", + } +} + +require("telescope").setup({ + defaults = { + mappings = { + i = { + [ "" ] = require("telescope.actions.layout").toggle_preview + } + } + } +}) + + -- Set up nvim-cmp. + + local cmp = require'cmp' + + local working_dir = vim.loop.cwd() + + -- Global setup. + cmp.setup({ + snippet = { + expand = function(args) + vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. + -- require('luasnip').lsp_expand(args.body) -- For `luasnip` users. + -- require'snippy'.expand_snippet(args.body) -- For `snippy` users. + -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users. + end, + }, + window = { + -- completion = cmp.config.window.bordered(), + -- documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.confirm({ select = true }), + [''] = cmp.mapping.confirm({ select = true }), + ['`'] = cmp.mapping.abort(), + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'vsnip' }, -- For vsnip users. + -- { name = 'luasnip' }, -- For luasnip users. + -- { name = 'snippy' }, -- For snippy users. + -- { name = 'ultisnips' }, -- For ultisnips users. + }, { + { name = 'buffer' }, + { + name = 'path', + option = { + get_cwd = function(working_dir) + end + } + } + }) + }) + + -- `/` cmdline setup. + cmp.setup.cmdline('/', { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = 'buffer' }, + { + name = 'path', + option = { + get_cwd = function(working_dir) + end + } + } + } + }) + + -- `:` cmdline setup. + cmp.setup.cmdline(':', { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { + name = 'path', + option = { + get_cwd = function(working_dir) + end + } + } + }, { + { name = 'cmdline' } + }) + }) + + -- Setup lspconfig. + local capabilities = require('cmp_nvim_lsp').default_capabilities() + require("lspconfig")["tsserver"].setup{ + capabilities = capabilities + } + require("lspconfig")["html"].setup{ + capabilities = capabilities + } + require("lspconfig")["cssls"].setup{ + capabilities = capabilities + } + require("lspconfig")["jsonls"].setup{ + capabilities = capabilities + } + require("lspconfig")["clangd"].setup{ + capabilities = capabilities + } + require("lspconfig")["texlab"].setup{ + capabilities = capabilities + } + require("lspconfig")["ltex"].setup{ + capabilities = capabilities, + settings = { + ltex = { + language = "en-GB", + dictionary = { + ["en-GB"] = {'Altaf', 'altaf', 'altaf-creator', 'altaf-devlogs', 'simpliCity'}, + ["en-US"] = {'Altaf', 'altaf', 'altaf-creator', 'altaf-devlogs', 'simpliCity'}, + ["id-ID"] = {'Altaf', 'altaf', 'altaf-creator', 'altaf-devlogs', 'simpliCity'}, + }, + enabled = {"markdown", "vimwiki", "texlab"}, + }, + }, + } + require("lspconfig")["rust_analyzer"].setup{ + capabilities = capabilities + } + require("lspconfig").gdscript.setup{ + capabilities = capabilities, + on_attach = on_attach, + flags = { + debounce_text_changes = 150, + } + } + +-- Setup nvim-treesitter +require'nvim-treesitter.configs'.setup { + -- A list of parser names, or "all" (the five listed parsers should always be installed) + ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "html", "javascript", "css", "cpp", "gdscript"}, + + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, + + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally + auto_install = true, + + ---- If you need to change the installation directory of the parsers (see -> Advanced Setup) + -- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")! + + highlight = { + enable = true, + disable = { "html" }, -- currently, nvim-treesitter segfaults when trying to type 2 whitespaces + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = true, + }, +} + +-- default config nvim.image +if not vim.g.neovide then + require("image").setup({ + backend = "kitty", + integrations = { + markdown = { + enabled = true, + clear_in_insert_mode = false, + download_remote_images = true, + only_render_image_at_cursor = false, + filetypes = { "markdown", "vimwiki" }, -- markdown extensions (ie. quarto) can go here + }, + neorg = { + enabled = true, + clear_in_insert_mode = false, + download_remote_images = true, + only_render_image_at_cursor = false, + filetypes = { "norg" }, + }, + html = { + enabled = false, + }, + css = { + enabled = false, + }, + }, + max_width = nil, + max_height = nil, + max_width_window_percentage = nil, + max_height_window_percentage = 50, + window_overlap_clear_enabled = false, -- toggles images when windows are overlapped + window_overlap_clear_ft_ignore = { "cmp_menu", "cmp_docs", "" }, + editor_only_render_when_focused = false, -- auto show/hide images when the editor gains/looses focus + tmux_show_only_in_active_window = false, -- auto show/hide images in the correct Tmux window (needs visual-activity off) + hijack_file_patterns = { "*.png", "*.jpg", "*.jpeg", "*.gif", "*.webp" }, -- render image files as images when opened + }) +end + print("Hello, World!") +EOF -- cgit v1.2.3