Skip to content

Nguyen-Hoang-Nam/nvim-dotfiles-kitty

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nvim-Dotfiles-Kitty

Neovim is great, but time-consuming to configure it works properly. I deal with it from 2021, and still change it weekly to fit my job at cooperation.

This configuration works properly with JavaScript, Python, Go, Rust, Lua, PHP and Java.

Main Kitty with Fira, Cascadia, and Mini-File-Icons

What I have done so far

  • Use ligature font, italic font and icon font. (Thanks to Kitty)
  • Saving the last session. (Thanks to auto-session)
  • Support debug (Thanks to Nvim-Dap)
  • Support test (Thanks to Vim-Test)
  • Support RESTFul api test. (Thanks to Rest.nvim)
  • Support several language's snippet. (I get snippets from rafamadriz/friendly-snippets)
  • Support Emmet. (Thanks to Emmet-Ls)
  • Support lint and formatter. (Thanks to Efm-Langsever)
  • All in one sidebar. (Explorer, Symbol, Debug)
  • Install all plugins manually.

Supported frameworks

  • React
  • Svelte
  • Tailwind
  • Express
  • Gin
  • FastAPI
  • Laravel
  • Spring Boot

Supported languages

Language LSP Treesitter Formatter Lint Debug Test
Bash 👍
C 👍
CMake 👍 👍 👍
CPP 👍 👍 👍
CSS 👍👍👍 👍 👍
Dart 👍 👍 👍 👍👍
Dockerfile 👍 👍 👍
Go 👍 👍 👍👍 👍 👍 👍
Haskell 👍 👍 👍
HTML 👍👍👍 👍 👍
HTTP 👍
Java 👍 👍 👍 👍 👍
Javascript 👍 👍👍 👍 👍
JSON 👍 👍 👍
Lua 👍 👍 👍
Markdown 👍 👍 👍
PHP 👍 👍 👍 👍
Python 👍 👍 👍 👍
React 👍👍 👍 👍
Rust 👍 👍 👍 👍
Scala 👍
Solidity 👍 👍 👍
Svelte 👍👍 👍 👍
Tex 👍 👍 👍
TOML 👍
Typescript 👍 👍 👍 👍
XML 👍 👍 👍
YAML 👍 👍 👍
Zig 👍 👍

Startup

Last updated Jan 2 2021

=====================================
Top 10 plugins slowing nvim's startup
=====================================
1   3.097   vim-test
2   1.636   nvim-scrollview
3   1.290   nvim-treesitter
4   0.467   nvim-cmp
5   0.400   vim-ultest
6   0.398   nvim-ts-autotag
7   0.326   indent-blankline.nvim
8   0.163   cmp_luasnip
9   0.162   LuaSnip
10  0.156   cmp-path
=====================================

Screenshot

Dashboard

Dashboard

Telescope

Telescope

Terminal

Terminal

Help

Help

JavaScript

JavaScript

Go

Go

Find more in wiki

Configuration

All settings are store in lua/settings.lua

return {
    efm = {
        filetypes = {
            'css',
            'cpp',
            'dart',
            'dockerfile',
            'go',
            'html',
            'java',
            'javascript',
            'javascriptreact',
            'json',
            'lua',
            'markdown',
            'php',
            'python',
            'rust',
            'svelte',
            'tex',
            'typescript',
            'typescriptreact',
            'xml',
            'yaml',
        },
    },

    lspconfigs = {
        filetypes = {
            'cmake',
            'css',
            'cpp',
            'dart',
            'dockerfile',
            'go',
            'haskell',
            'html',
            'javascript',
            'json',
            'lua',
            'php',
            'python',
            'rust',
            'svelte',
            'tex',
            'xml',
            -- 'yaml',
            'zig',
        },

        features = {
            'efm',
            'emmet',
            'tailwindcss',
        },
    },

    autoformat = {
        filetypes = {
            'cmake',
            'css',
            'cpp',
            'dart',
            'dockerfile',
            'go',
            'html',
            'java',
            'javascript',
            'javascriptreact',
            'json',
            'lua',
            'markdown',
            'php',
            'python',
            'rust',
            'svelte',
            'tex',
            'typescript',
            'typescriptreact',
            'xml',
            'yaml',
        },
    },

    colors = {
        red = '#F9867B',
        orange = '#CD9731',
        yellow = '#FDCE68',
        green = '#A3EEA0',
        cyan = '#6796E6',
        blue = '#7BE2F9',
        purple = '#E19EF5',
        tomato = '#F44747',
        white = '#FFFFFF',

        background = '#212835',
        dark_background = '#1B212C',

        border = '#3E4451',
        comment = '#5C6370',
        lineNumber = '#495162',
        scrollbar = '#4E5666',
        cursorLine = '#2C313A',
        indent = '#383C44',
    },

    signs = {
        DiagnosticSignError = '',
        DiagnosticSignWarning = '',
        DiagnosticSignHint = '',
        DiagnosticSignInfo = '',
        CodeActionSign = '',
    },

    kinds = {
        Class = ' (class)',
        Color = ' (color)',
        Constant = ' (constant)',
        Constructor = ' (constructor)',
        Enum = ' (enum)',
        EnumMember = ' (enum member)',
        Event = ' (event)',
        Field = ' (field)',
        File = ' (file)',
        Folder = ' (folder)',
        Function = ' (function)',
        Interface = ' (interface)',
        Keyword = ' (keyword)',
        Method = ' (method)',
        Module = '{} (module)',
        Operator = ' (operator)',
        Property = ' (property)',
        Reference = ' (reference)',
        Snippet = ' (snippet)',
        Struct = ' (enum)',
        Text = ' (text)',
        TypeParameter = ' (type parameter)',
        Unit = ' (unit)',
        Value = ' (value)',
        Variable = ' (variable)',
    },

    statusline = {
        git_branch_enabled = true,
        diagnostic_enabled = true,
        git_diff_enabled = true,
        line_column_enabled = true,
        tab_enabled = true,
        line_break_enabled = true,
        file_format_enabled = true,
        efm_enabled = true,
        emoji_enabled = true,
        emoji_icon = '',
    },
}

Installation

Requirements

  • Kitty
  • Neovim 0.7.0-dev (Last updated Feb 1 2021)

Fonts

  • mini-file-icons
  • Fira code (Or any ligature font)
  • Cascadia (Or any italic font)

Kitty

font_family FiraCode Nerd Font Mono
bold_font Cascadia Code
italic_font Cascadia Mono
bold_italic_font Cascadia Code
symbol_map U+e900-U+e954 mini-file-icons
font_size 16
cursor #6796E6

Plugin list

If you plan to install plugins manually, you can clone below plugins and store in ~/.local/share/nvim/site/pack/*/start/.

Plugin Last updated
aerial Mar 23 2022
auto-session Mar 14 2022
cmp-nvim-lsp Feb 15 2022
cmp-nvim-lsp-signature-help Mar 22 2022
cmp-path Feb 3 2022
cmp_luasnip Mar 26 2022
dashboard-nvim Apr 17 2021
diffview.nvim Feb 21 2022
friendly-snippets Mar 5 2022
git-utils.nvim
gitsigns.nvim Mar 25 2022
goto-preview Dec 25 2021
indent-blankline.nvim Mar 25 2022
LuaSnip Mar 26 2022
nvim-autopair Mar 25 2022
nvim-bufferline.lua Mar 21 2022
nvim-cmp Mar 22 2022
nvim-colorizer.lua Apr 20 2020
nvim-dap Mar 25 2022
nvim-dap-ui Mar 21 2022
nvim-dap-virtual-text Feb 19 2021
nvim-jdtls Feb 24 2022
nvim-lspconfig Mar 23 2022
nvim-mini-file-icons
nvim-scrollview Mar 14 2022
nvim-toggleterm.lua Mar 24 2022
nvim-treesitter Mar 21 2022
nvim-ts-autotag Mar 1 2022
nvim-ts-context-commentstring Mar 18 2022
nvim-ts-rainbow Feb 23 2022
plenary.nvim Mar 20 2022
rest.nvim Jan 26 2022
tabout.nvim Mar 19 2021
telescope-fzf-native.nvim Feb 19 2022
telescope.nvim Mar 26 2022
vim-test Mar 26 2022
vim-ultest Mar 19 2022
yanil

Treesitter (Optional)

Check wiki

Language Server

Check wiki

Formatter

Check wiki

Linter

Check wiki

Debug

Check wiki

Test

Check wiki

Mappings

Key Description
<Leader>0 Add break point
<Leader>1 Toggle debug
<Leader>2 Step over
<Leader>3 Step into
<Leader>4 Step out
<Leader>9 Scope information
<Leader>a Code action
<Leader>b Toggle Explorer
<Leader>c Range format
<Leader>d Go to definition
<Leader>e Search Gitmojis
<Leader>f Search text
<Leader>g Toggle git hover
<Leader>m Format code
<Leader>o Search buffers
<Leader>p Search file
<Leader>q Turn off search's highlight
<Leader>r Rename variable
<Leader>s Save file
<Leader>t Toggle test
<Leader>u Toggle debug sidebar
<Leader>v Run Restful API
<Leader>w Delete current buffer
<Leader>x Toggle symbol sidebar
<Leader>z Preview definition
<Leader>/ Toggle comment
<M-t> Toggle terminal
<M-r> Toggle rest
jk Insert to normal
gh Go to left window
gj Go to below window
gk Go to above window
gl Go to right window
]d Go to next diagnostic
[d Go to previous diagnostic
]b Go to next buffer
[b Go to previous buffer
]q Go to next tab
[q Go to previous tab
]t Go to next failed test
[t Go to previous failed test
]x Go to next function
[x Go to previous function

Add new languages

If you want some languages that I don't support yet, then you can follow these steps to add manually.

The first thing I do is check nvim-treesitter and install parser for this language. After this step, your editor will highlight your syntax.

Then, you may want to find LSP in here . After you've installed the LSP, you need to create a file in /after/ftplugin, /lug/languages.

-- /lua/langauges/your-language.lua
local lsp = require('languages.lsp')
local M = {}

M.lsp_server = '<name of LSP>'

M.lsp = {
    capabilities = lsp.capabilities,
    on_attach = lsp.on_attach,
    -- Any extra configuration should put there
}

return M
-- /after/ftplugin/your-language.lua
vim.opt.indentexpr = 'nvim_treesitter#indent()' -- Optional, If you use indent of treesitter

require('cmp').setup.buffer({
    sources = {
        { name = 'nvim_lsp' },
        { name = 'luasnip' }, -- Optional, If you use snippet
        { name = 'path' }, -- Optional, If your language need path
        { name = 'nvim_lsp_signature_help' }, -- Optional, If your language has signature
    },
})

You also need to add your language to /lua/settings.lua

-- /lua/settings.lua
return {
    lspconfigs = {
        filetypes = {
            'cmake',
            '<your lanugage>',
            'zig',
        },
    },
}

If you know that there are formatters and linters for this language. Then you need to install these tools first and go to /lua/languages/<your language>.lua

-- /lua/languages/<your language>.lua
M.efm = {
    {
        formatCommand = 'formatter1',
        formatStdin = true,
    },
    {
        formatCommand = 'formatter2',
        formatStdin = true,
    },
    {
        lintCommand = 'linter1',
        lintIgnoreExitCode = true,
        lintStdin = true,
        lintFormats = {
            'Your linter format',
        },
    },
}

M.all_format = { efm = 'Formatter1   Formatter2   Linter1' }

M.default_format = 'efm'

If you want debug when you need to check this

TODO

  • Show theme in wiki
  • Support Flutter
  • Perfect center dashboard header and show dashboard if there is no buffer.
  • Use nix to manage package.
  • Support reload configuration in this
  • Add test summary to sidebar
  • Change highlight of nvim-dap-ui
  • Change highlight of vim-ultest
  • Handle lsp_extension

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT