Post

C++ in Termux

In this, I’d like to provide a quick guide for setting up the Termux app for C++ dev.

Steps

  1. pkg install nodejs
  2. First install neovim
  3. Install Vim-plug
  4. apt install clang
  5. put the following commands into your init.vim file:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    
    set number
     " set relativenumber
     set autoindent
     set tabstop=4
     set shiftwidth=4
     set smarttab
     set softtabstop=4
     set mouse=a
     set encoding=UTF-8
     set clipboard+=unnamedplus
     " Make sure you use single juotes
     call plug#begin('~/.config/nvim/autoload')
    
     " Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
     Plug 'junegunn/vim-easy-align'
    
     " Any valid git URL is allowed
     Plug 'https://github.com/junegunn/vim-github-dashboard.git'
    
     " Multiple Plug commands can be written in a single line using | separators
     Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
    
     " On-demand loading
     Plug 'scrooloose/nerdtree', { 'on':  'NERDTreeToggle' }
     Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
    
     " Using a non-default branch
     Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
    
     " Using a tagged release; wildcard allowed (requires git 1.9.2 or above)
     Plug 'fatih/vim-go', { 'tag': '*' }
    
     " Plugin options
     Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }
    
     " Plugin outside ~/.vim/plugged with post-update hook
     Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
    
     " Unmanaged plugin (manually installed and updated)
     Plug '~/my-prototype-plugin'
    
     " Surrounding ysw)
     Plug 'http://github.com/tpope/vim-surround' 
    
     " NerdTree
     Plug 'https://github.com/preservim/nerdtree' 
    
     " For Commenting gcc & gc
     Plug 'https://github.com/tpope/vim-commentary' 
    
     " Status bar
     Plug 'https://github.com/vim-airline/vim-airline' 
    
     " PSQL Pluging needs :SQLSetType pgsql.vim
     "  -  Plug 'https://github.com/lifepillar/pgsql.vim' 
    
     " CSS Color Preview
     "  -  Plug 'https://github.com/ap/vim-css-color' 
    
     " Retro Scheme
     Plug 'https://github.com/rafi/awesome-vim-colorschemes' 
    
     " Auto Completion, Only Available in NeoVim (Not Vim), Needed Nodejs for Build Plugin
     Plug 'neoclide/coc.nvim', {'branch': 'release'}
     " Developer Icons
     " clie/coc.nvim',{':ranch':'release'}
     Plug 'https://github.com/ryanoasis/vim-devicons' 
    
     " Vim Terminal
     Plug 'https://github.com/tc50cal/vim-terminal' 
    
     " Tagbar for code navigation
     Plug 'https://github.com/preservim/tagbar' 
     " For this Plugin Need $sudo apt install exuberant-ctags
    
     " CTRL + N for multiple cursors
     Plug 'https://github.com/terryma/vim-multiple-cursors' 
    
     " Initialize plugin system
     call plug#end()
    
     colorscheme jellybeans
    
     nnoremap <C-f> :NERDTreeFocus<CR>
     nnoremap <C-n> :NERDTree<CR>
     nnoremap <C-t> :NERDTreeToggle<CR>
     nnoremap <C-l> :call CocActionAsync('jumpDefinition')<CR>
    
     nmap <F8> :TagbarToggle<CR>
     " For No Previews
     set completeopt-=preview 
    
     let g:NERDTreeDirArrowExpandable="+"
     let g:NERDTreeDirArrowCollapsible="~"
    
     "--- Just Some Notes ---
     " :PlugClean :PlugInstall :UpdateRemotePlugins
     "
     " :CocInstall coc-python
     " :CocInstall coc-clangd
     " :CocInstall coc-snippets
     " :CocCommand snippets.edit... FOR EACH FILE TYPE
    
     " air-line
     let g:airline_powerline_fonts = 1
    
     if !exists('g:airline_symbols')
     let g:airline_symbols = {}
     endif
    
     " airline symbols
     let g:airline_left_sep = ''
     let g:airline_left_alt_sep = ''
     let g:airline_right_sep = ''
     let g:airline_right_alt_sep = ''
     let g:airline_symbols.branch = ''
     let g:airline_symbols.readonly = ''
     let g:airline_symbols.linenr = ''
    
     inoremap <expr> <Tab> pumvisible() ? coc#_select_confirm() : "<Tab>"
    
  6. PlugInstall
  7. Install coc-clangd with coc-install
This post is licensed under CC BY 4.0 by the author.