summaryrefslogtreecommitdiff
path: root/config/nvim
diff options
context:
space:
mode:
authoraltaf-creator <dev@altafcreator.com>2024-05-19 14:54:41 +0700
committeraltaf-creator <dev@altafcreator.com>2024-05-19 14:54:41 +0700
commit3ec8d42fbf6eed78c24de2caca63d91a2604ff50 (patch)
tree985517bcce150969a050f7f408bea6670177bbb7 /config/nvim
Diffstat (limited to 'config/nvim')
-rw-r--r--config/nvim/init.vim434
1 files changed, 434 insertions, 0 deletions
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 <silent> <C-l> o<Esc>
+
+" nnoremap <silent> <C-y> :NERDTree<CR>
+" nnoremap <silent> <C-t> :NERDTreeToggle<CR>
+
+nnoremap <silent> <C-q> :Telescope<CR>
+nnoremap <silent> <C-f> :Telescope current_buffer_fuzzy_find<CR>
+nnoremap <silent> <C-g> :Telescope find_files<CR>
+nnoremap <silent> <C-h> :Telescope buffers<CR>
+nnoremap <silent> <C-a> :Telescope tags<CR>
+
+" " Move to previous/next
+" nnoremap <silent> <A-Tab> <Cmd>BufferPrevious<CR>
+" nnoremap <silent> <A-Tab> <Cmd>BufferNext<CR>
+"
+" " Re-order to previous/next
+" nnoremap <silent> <A-<> <Cmd>BufferMovePrevious<CR>
+" nnoremap <silent> <A->> <Cmd>BufferMoveNext<CR>
+"
+" " Goto buffer in position...
+" nnoremap <silent> <A-1> <Cmd>BufferGoto 1<CR>
+" nnoremap <silent> <A-2> <Cmd>BufferGoto 2<CR>
+" nnoremap <silent> <A-3> <Cmd>BufferGoto 3<CR>
+" nnoremap <silent> <A-4> <Cmd>BufferGoto 4<CR>
+" nnoremap <silent> <A-5> <Cmd>BufferGoto 5<CR>
+" nnoremap <silent> <A-6> <Cmd>BufferGoto 6<CR>
+" nnoremap <silent> <A-7> <Cmd>BufferGoto 7<CR>
+" nnoremap <silent> <A-8> <Cmd>BufferGoto 8<CR>
+" nnoremap <silent> <A-9> <Cmd>BufferGoto 9<CR>
+" nnoremap <silent> <A-0> <Cmd>BufferLast<CR>
+"
+" " Pin/unpin buffer
+" nnoremap <silent> <A-p> <Cmd>BufferPin<CR>
+"
+" " Close buffer
+" nnoremap <silent> <A-c> <Cmd>BufferClose<CR>
+" " Restore buffer
+" nnoremap <silent> <A-s-c> <Cmd>BufferRestore<CR>
+"
+" " Wipeout buffer
+" " :BufferWipeout
+" " Close commands
+" " :BufferCloseAllButCurrent
+" " :BufferCloseAllButVisible
+" " :BufferCloseAllButPinned
+" " :BufferCloseAllButCurrentOrPinned
+" " :BufferCloseBuffersLeft
+" " :BufferCloseBuffersRight
+"
+" " Magic buffer-picking mode
+" nnoremap <silent> <C-p> <Cmd>BufferPick<CR>
+" nnoremap <silent> <C-p> <Cmd>BufferPickDelete<CR>
+"
+" " Sort automatically by...
+" nnoremap <silent> <Space>bb <Cmd>BufferOrderByBufferNumber<CR>
+" nnoremap <silent> <Space>bd <Cmd>BufferOrderByDirectory<CR>
+" nnoremap <silent> <Space>bl <Cmd>BufferOrderByLanguage<CR>
+" nnoremap <silent> <Space>bw <Cmd>BufferOrderByWindowNumber<CR>
+
+" Prettier
+" nnoremap <A-S-p> <Cmd>Prettier<CR>
+
+" Visual Block Mode
+nnoremap <A-v> <c-v>
+
+" Compile
+nnoremap <F5> <Cmd>wa<CR><Cmd>DapContinue<CR>
+
+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 <silent><expr> <Tab> coc#pum#visible() ? coc#pum#confirm() : "\<Tab>"
+" inoremap <silent><expr> <S-Tab> coc#pum#visible() ? coc#pum#close() : "\<S-Tab>"
+
+" 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 <args>
+command! -nargs=* VT vsplit | terminal <args>
+
+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 = {
+ [ "<C-A-q>" ] = 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({
+ ['<C-d>'] = cmp.mapping.scroll_docs(-4),
+ ['<C-f>'] = cmp.mapping.scroll_docs(4),
+ ['<C-Space>'] = cmp.mapping.complete(),
+ ['<CR>'] = cmp.mapping.confirm({ select = true }),
+ ['<Tab>'] = 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