diff --git a/README.md b/README.md new file mode 100644 index 0000000..feab9a0 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# My personal nvim configuration + +I made this public so I can easily clone without authentication, +but since I treat this as a personal use only stuff, +there can be some(read "a lot of") messy stuff. + +Much of this might have been selectively copy pasted from plugin repos. +Those repos are obviously listed in plugin setup part. + diff --git a/coc-settings.json b/coc-settings.json new file mode 100644 index 0000000..e241048 --- /dev/null +++ b/coc-settings.json @@ -0,0 +1,102 @@ +{ + "codeLens.enable": true, + "codeLens.position": "eol", + "coc.preferences.extensionUpdateCheck": "daily", + "coc.preferences.enableMessageDialog": true, + "coc.preferences.formatOnType": true, + "coc.preferences.willSaveHandlerTimeout": 1000, + "coc.preferences.enableLinkedEditing": true, + "coc.preferences.formatOnSaveFiletypes": [ + "c", + "go", + "python", + "rust", + "markdown", + "javascript", + "typescript", + "json", + "jsonc" + ], + "coc.source.file.ignoreHidden": false, + "clangd.path": "~/bin/clangd", + "clangd.arguments": [ + "--query-driver=/usr/bin/clang++", + "--header-insertion-decorators=false", + "--background-index" + ], + "deno.importMap": "./import_map.json", + "diagnostic.floatConfig": { + "rounded": true, + "border": true + }, + "diagnostic.format": "%message [%source]", + "diagnostic.virtualText": true, + "diagnostic.checkCurrentLine": true, + "diagnostic.separateRelatedInformationAsDiagnostics": true, + "eslint.autoFixOnSave": true, + "eslint.format.enable": true, + "eslint.packageManager": "yarn", + "git.addGBlameToVirtualText": true, + "hover.floatConfig": { + "rounded": true, + "border": true + }, + "list.normalMappings": { + "": "do:exit" + }, + "list.insertMappings": { + "": "do:exit" + }, + "list.source.grep.useLiteral": false, + "list.source.grep.defaultArgs": [ + "--ignore-case" + ], + "markdownlint.config": { + "default": true, + "line-length": false + }, + "python.formatting.provider": "autopep8", + "python.linting.enabled": true, + "python.analysis.diagnosticMode": "workspace", + "python.linting.pylintEnabled": false, + "python.linting.flake8Enabled": true, + "python.linting.pycodestyle": true, + "python.linting.pylamaEnabled": true, + "python.linting.banditEnabled": true, + "python.linting.mypyEnabled": true, + "python.linting.pytypeEnabled": true, + "semanticTokens.enable": true, + "signature.target": "echo", + "suggest.detailField": "abbr", + "suggest.defaultSortMethod": "none", + "suggest.selection": "recentlyUsedByPrefix", + "suggest.noselect": false, + "suggest.floatConfig": { + "rounded": true, + "border": true + }, + "signature.floatConfig": { + "rounded": true, + "border": true + }, + "sumneko-lua.enableNvimLuaDev": true, + "Lua.completion.callSnippet": "Both", + "Lua.completion.postfix": ".", + "Lua.runtime.version": "LuaJIT", + "Lua.telemetry.enable": false, + "Lua.diagnostics.globals": [ + "vim", + "jit" + ], + "snippet.choicesMenuPicker": true, + "snippets.ultisnips.enable": false, + "snippets.extends": { + "javascriptreact": [ + "javascript" + ], + "typescript": [ + "javascript" + ] + }, + "languageserver": {} +} diff --git a/init.vim b/init.vim new file mode 100644 index 0000000..44e5c85 --- /dev/null +++ b/init.vim @@ -0,0 +1,118 @@ +call plug#begin() + +" TODO +" Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } + +Plug 'scrooloose/nerdtree' +Plug 'dracula/vim' +Plug 'neoclide/coc.nvim', {'branch': 'release'} +Plug 'preservim/nerdcommenter' +Plug 'mhinz/vim-startify' +Plug 'rmagatti/auto-session' + +"Fuzzy search by Telescope and its dependencies: +Plug 'nvim-lua/plenary.nvim' +Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.0' } +Plug 'BurntSushi/ripgrep' + +call plug#end() + +" load lua file (empty for now) +lua require("general") + +"inoremap: maps the key in insert mode +"nnoremap: maps the key in normal mode +"vnoremap: maps the key in visual mode +" : represents Control key +" : Alt key + +" nerdcommenter custom bindings +nmap NERDCommenterToggle +vmap NERDCommenterToggle + +"plugin configuration +syntax enable +colorscheme dracula + +set splitright +set splitbelow + + +" indent/unindent with tab/shift-tab +nmap >> +nmap << +imap < >gv +vmap and for scroll float windows/popups. +if has('nvim-0.4.0') || has('patch-8.2.0750') + nnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" + nnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" + inoremap coc#float#has_scroll() ? "\=coc#float#scroll(1)\" : "\" + inoremap coc#float#has_scroll() ? "\=coc#float#scroll(0)\" : "\" + vnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" + vnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" +endif + +" Run the Code Lens action on the current line. +nmap cl (coc-codelens-action) + +" Find files using Telescope command-line sugar. +nnoremap ff Telescope find_files +nnoremap fg Telescope live_grep +nnoremap fb Telescope buffers +nnoremap fh Telescope help_tags + +" Use tab for trigger completion with characters ahead and navigate. +" NOTE: There's always complete item selected by default, you may want to enable +" no select by `"suggest.noselect": true` in your configuration file. +" NOTE: Use command ':verbose imap ' to make sure tab is not mapped by +" other plugin before putting this into your config. +inoremap + \ coc#pum#visible() ? coc#pum#next(1) : + \ CheckBackspace() ? "\" : + \ coc#refresh() +inoremap coc#pum#visible() ? coc#pum#prev(1) : "\" + +" Make to accept selected completion item or notify coc.nvim to format +" u breaks current undo, please make your own choice. +inoremap coc#pum#visible() ? coc#pum#confirm() + \: "\u\\=coc#on_enter()\" + +function! CheckBackspace() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' +endfunction + +" Use to trigger completion. +if has('nvim') + inoremap coc#refresh() +else + inoremap coc#refresh() +endif + +" general configs +set showmatch " show matching +set ignorecase " case insensitive +"set mouse=v " middle-click paste with +set hlsearch " highlight search +set incsearch " incremental search +set tabstop=4 " number of columns occupied by a tab +set softtabstop=4 " see multiple spaces as tabstops so does the right thing +set expandtab " converts tabs to white space +set shiftwidth=4 " width for autoindents +set autoindent " indent a new line the same amount as the line just typed +set number " add line numbers +set wildmode=longest,list " get bash-like tab completions +set cc=80 " set an 80 column border for good coding style +filetype plugin indent on "allow auto-indenting depending on file type +syntax on " syntax highlighting +"set mouse=a " enable mouse click +set clipboard=unnamedplus " using system clipboard +filetype plugin on +set cursorline " highlight current cursorline +set ttyfast " Speed up scrolling in Vim +" set spell " enable spell check (may need to download language package) +" set noswapfile " disable creating swap file +" set backupdir=~/.cache/vim " Directory to store backup files. diff --git a/lua/general.lua b/lua/general.lua new file mode 100644 index 0000000..e69de29